Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-02 11:32:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-02 11:32:00 +0300
commitdd130350d5650dc85133a9fde2f84f82c2d8df2c (patch)
treefbbcc0283b3ef5006dba7048ea51c9ba85a8b828 /source/blender/python/intern/bpy_operator_wrap.c
parentab7a174f92d872955389f5226970344983f9e56f (diff)
make python operator instances subclasses of the wmOperator when called.
was subclassing the operator's type before. Removes the need for passing self.__operator__, can pass self directly.
Diffstat (limited to 'source/blender/python/intern/bpy_operator_wrap.c')
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index fcfea7db885..b0754ee1cde 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -90,14 +90,18 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
PointerRNA ptr_context;
PointerRNA ptr_operator;
PointerRNA ptr_event;
- PyObject *py_operator;
PyGILState_STATE gilstate;
bpy_context_set(C, &gilstate);
args = PyTuple_New(1);
- PyTuple_SET_ITEM(args, 0, PyObject_GetAttrString(py_class, "bl_rna")); // need to use an rna instance as the first arg
+
+ /* poll has no 'op', should be ok still */
+ /* use an rna instance as the first arg */
+ RNA_pointer_create(NULL, &RNA_Operator, op, &ptr_operator);
+ PyTuple_SET_ITEM(args, 0, pyrna_struct_CreatePyObject(&ptr_operator));
+
py_class_instance = PyObject_Call(py_class, args, NULL);
Py_DECREF(args);
@@ -120,14 +124,6 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
RNA_STRUCT_END;
}
- /* set operator pointer RNA as instance "__operator__" attribute */
- if(op) {
- RNA_pointer_create(NULL, &RNA_Operator, op, &ptr_operator);
- py_operator= pyrna_struct_CreatePyObject(&ptr_operator);
- PyDict_SetItemString(class_dict, "__operator__", py_operator);
- Py_DECREF(py_operator);
- }
-
RNA_pointer_create(NULL, &RNA_Context, C, &ptr_context);
if (mode==PYOP_INVOKE) {
@@ -160,6 +156,10 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
Py_DECREF(item);
Py_DECREF(class_dict);
}
+ else {
+ PyErr_Print();
+ PyErr_Clear();
+ }
if (ret == NULL) { /* covers py_class_instance failing too */
if(op)