~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/python/intern/bpy_operator.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
#include "RNA_types.h"
37
37
 
 
38
#include "BLI_utildefines.h"
 
39
#include "BLI_string.h"
 
40
 
38
41
#include "BPY_extern.h"
39
42
#include "bpy_operator.h"
40
43
#include "bpy_operator_wrap.h"
42
45
#include "bpy_util.h"
43
46
#include "../generic/bpy_internal_import.h"
44
47
 
45
 
#include "BLI_utildefines.h"
46
 
#include "BLI_string.h"
47
 
 
48
48
#include "RNA_access.h"
49
49
#include "RNA_enum_types.h"
50
50
 
85
85
        if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
86
86
                return NULL;
87
87
        
88
 
        ot = WM_operatortype_find(opname, TRUE);
 
88
        ot = WM_operatortype_find(opname, true);
89
89
 
90
90
        if (ot == NULL) {
91
91
                PyErr_Format(PyExc_AttributeError,
147
147
 
148
148
        /* note that context is an int, python does the conversion in this case */
149
149
        int context = WM_OP_EXEC_DEFAULT;
 
150
        int is_undo = false;
150
151
 
151
152
        /* XXX Todo, work out a better solution for passing on context,
152
153
         * could make a tuple from self and pack the name and Context into it... */
157
158
                return NULL;
158
159
        }
159
160
        
160
 
        if (!PyArg_ParseTuple(args, "sO|O!s:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context_str))
 
161
        if (!PyArg_ParseTuple(args, "sO|O!si:_bpy.ops.call",
 
162
                              &opname, &context_dict, &PyDict_Type, &kw, &context_str, &is_undo))
 
163
        {
161
164
                return NULL;
 
165
        }
162
166
 
163
 
        ot = WM_operatortype_find(opname, TRUE);
 
167
        ot = WM_operatortype_find(opname, true);
164
168
 
165
169
        if (ot == NULL) {
166
170
                PyErr_Format(PyExc_AttributeError,
205
209
        CTX_py_dict_set(C, (void *)context_dict);
206
210
        Py_XINCREF(context_dict); /* so we done loose it */
207
211
 
208
 
        if (WM_operator_poll_context((bContext *)C, ot, context) == FALSE) {
 
212
        if (WM_operator_poll_context((bContext *)C, ot, context) == false) {
209
213
                const char *msg = CTX_wm_operator_poll_msg_get(C);
210
214
                PyErr_Format(PyExc_RuntimeError,
211
215
                             "Operator bpy.ops.%.200s.poll() %.200s",
230
234
#ifdef BPY_RELEASE_GIL
231
235
                        /* release GIL, since a thread could be started from an operator
232
236
                         * that updates a driver */
233
 
                        /* note: I havve not seen any examples of code that does this
 
237
                        /* note: I have not seen any examples of code that does this
234
238
                         * so it may not be officially supported but seems to work ok. */
235
239
                        {
236
240
                                PyThreadState *ts = PyEval_SaveThread();
237
241
#endif
238
242
 
239
 
                                operator_ret = WM_operator_call_py(C, ot, context, &ptr, reports);
 
243
                                operator_ret = WM_operator_call_py(C, ot, context, &ptr, reports, is_undo);
240
244
 
241
245
#ifdef BPY_RELEASE_GIL
242
246
                                /* regain GIL */
244
248
                        }
245
249
#endif
246
250
 
247
 
                        error_val = BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE);
 
251
                        error_val = BPy_reports_to_error(reports, PyExc_RuntimeError, false);
248
252
 
249
253
                        /* operator output is nice to have in the terminal/console too */
250
254
                        if (reports->list.first) {
324
328
        if (!PyArg_ParseTuple(args, "s|O!i:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args))
325
329
                return NULL;
326
330
 
327
 
        ot = WM_operatortype_find(opname, TRUE);
 
331
        ot = WM_operatortype_find(opname, true);
328
332
 
329
333
        if (ot == NULL) {
330
334
                PyErr_Format(PyExc_AttributeError,
388
392
                PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
389
393
                return NULL;
390
394
        }
391
 
        ot = WM_operatortype_find(opname, TRUE);
392
 
        if (ot  == NULL) {
 
395
        ot = WM_operatortype_find(opname, true);
 
396
        if (ot == NULL) {
393
397
                PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
394
398
                return NULL;
395
399
        }
404
408
        
405
409
        pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
406
410
#ifdef PYRNA_FREE_SUPPORT
407
 
        pyrna->freeptr = TRUE;
 
411
        pyrna->freeptr = true;
408
412
#endif
409
413
        return (PyObject *)pyrna;
410
414
}
421
425
                PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_instance() expects a string argument");
422
426
                return NULL;
423
427
        }
424
 
        ot = WM_operatortype_find(opname, TRUE);
 
428
        ot = WM_operatortype_find(opname, true);
425
429
        if (ot == NULL) {
426
430
                PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname);
427
431
                return NULL;
440
444
 
441
445
        pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
442
446
#ifdef PYRNA_FREE_SUPPORT
443
 
        pyrna->freeptr = TRUE;
 
447
        pyrna->freeptr = true;
444
448
#endif
445
449
        op->ptr = &pyrna->ptr;
446
450