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
path: root/source
diff options
context:
space:
mode:
authorArystanbek Dyussenov <arystan.d@gmail.com>2009-06-06 21:32:06 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-06-06 21:32:06 +0400
commit0034fbd13ebed62a9923d30f1d2a1a0ca87c0c26 (patch)
treed9acabfce64eeef83a08327976ac05b6ee3a10bc /source
parent1e03f502ae4b3171894f49a7d6570532725775f7 (diff)
Merged code passing context to python operator from soc-2009-kazanbas
branch.
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index bf92db832af..6ab990acdf5 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -189,6 +189,8 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
PyObject *args;
PyObject *ret= NULL, *py_class_instance, *item= NULL;
int ret_flag= (mode==PYOP_POLL ? 0:OPERATOR_CANCELLED);
+ PointerRNA ptr_context;
+ PyObject *py_context;
PyGILState_STATE gilstate = PyGILState_Ensure();
@@ -233,7 +235,11 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
}
else if (mode==PYOP_EXEC) {
item= PyObject_GetAttrString(py_class, "exec");
- args = PyTuple_New(1);
+ args = PyTuple_New(2);
+
+ RNA_pointer_create(NULL, &RNA_Context, C, &ptr_context);
+ py_context = pyrna_struct_CreatePyObject(&ptr_context);
+ PyTuple_SET_ITEM(args, 1, py_context);
}
else if (mode==PYOP_POLL) {
item= PyObject_GetAttrString(py_class, "poll");
@@ -391,7 +397,7 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
{PYOP_ATTR_UINAME, 's', 0, BPY_CLASS_ATTR_OPTIONAL},
{PYOP_ATTR_PROP, 'l', 0, BPY_CLASS_ATTR_OPTIONAL},
{PYOP_ATTR_DESCRIPTION, 's', 0, BPY_CLASS_ATTR_NONE_OK},
- {"exec", 'f', 1, BPY_CLASS_ATTR_OPTIONAL},
+ {"exec", 'f', 2, BPY_CLASS_ATTR_OPTIONAL},
{"invoke", 'f', 2, BPY_CLASS_ATTR_OPTIONAL},
{"poll", 'f', 2, BPY_CLASS_ATTR_OPTIONAL},
{NULL, 0, 0, 0}