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:
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_operator.c11
-rw-r--r--source/blender/python/intern/bpy_opwrapper.c11
2 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index d0ced50e70f..b62693828a6 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -82,17 +82,16 @@ static PyObject *pyop_base_getattro( BPy_OperatorBase * self, PyObject *pyname )
if( strcmp( name, "__members__" ) == 0 ) {
PyObject *item;
-
- ret = PyList_New(0);
+ ret = PyList_New(2);
+
+ PyList_SET_ITEM(ret, 0, PyUnicode_FromString("add"));
+ PyList_SET_ITEM(ret, 1, PyUnicode_FromString("remove"));
for(ot= WM_operatortype_first(); ot; ot= ot->next) {
item = PyUnicode_FromString( ot->idname );
PyList_Append(ret, item);
Py_DECREF(item);
}
-
- item = PyUnicode_FromString("add"); PyList_Append(ret, item); Py_DECREF(item);
- item = PyUnicode_FromString("remove"); PyList_Append(ret, item); Py_DECREF(item);
}
else if ( strcmp( name, "add" ) == 0 ) {
ret= PYOP_wrap_add_func();
@@ -168,7 +167,7 @@ static PyObject * pyop_func_call(BPy_OperatorFunc * self, PyObject *args, PyObje
error_val = 1; /* pyrna_py_to_prop sets the error */
break;
}
-
+
if (pyrna_py_to_prop(&ptr, prop, item)) {
error_val= 1;
break;
diff --git a/source/blender/python/intern/bpy_opwrapper.c b/source/blender/python/intern/bpy_opwrapper.c
index 89783ee3852..779f876390b 100644
--- a/source/blender/python/intern/bpy_opwrapper.c
+++ b/source/blender/python/intern/bpy_opwrapper.c
@@ -63,7 +63,7 @@ static void pyop_kwargs_from_operator(PyObject *dict, wmOperator *op)
if (strcmp(arg_name, "rna_type")==0) continue;
- item = pyrna_prop_to_py(&iter.ptr, prop);
+ item = pyrna_prop_to_py(op->ptr, prop);
PyDict_SetItemString(dict, arg_name, item);
Py_DECREF(item);
}
@@ -80,7 +80,7 @@ static int PYTHON_OT_exec(bContext *C, wmOperator *op)
pyop_kwargs_from_operator(kw, op);
ret = PyObject_Call(pyot->py_exec, args, kw);
-
+
Py_DECREF(args);
Py_DECREF(kw);
@@ -176,10 +176,11 @@ static PyObject *pyop_add(PyObject *self, PyObject *args)
char *name= NULL;
PyObject *invoke= NULL;
PyObject *exec= NULL;
-
- if (!PyArg_ParseTuple(args, "ssOO", &idname, &name, &invoke, &exec))
+
+ if (!PyArg_ParseTuple(args, "ssOO", &idname, &name, &invoke, &exec)) {
PyErr_SetString( PyExc_AttributeError, "expected 2 strings and 2 function objects");
return NULL;
+ }
if (WM_operatortype_find(idname)) {
PyErr_Format( PyExc_AttributeError, "First argument \"%s\" operator alredy exists with this name", idname);
@@ -190,7 +191,7 @@ static PyObject *pyop_add(PyObject *self, PyObject *args)
PyErr_SetString( PyExc_AttributeError, "the 2nd arg must be a function or None, the secons must be a function");
return NULL;
}
-
+
pyot= MEM_callocN(sizeof(PyOperatorType), "PyOperatorType");
strcpy(pyot->idname, idname);