[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20683] branches/blender2.5/blender/source /blender/python/intern/bpy_operator_wrap.c: Merged code passing context to python operator from soc-2009-kazanbas

Arystanbek Dyussenov arystan.d at gmail.com
Sat Jun 6 19:32:07 CEST 2009


Revision: 20683
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20683
Author:   kazanbas
Date:     2009-06-06 19:32:06 +0200 (Sat, 06 Jun 2009)

Log Message:
-----------
Merged code passing context to python operator from soc-2009-kazanbas 
branch.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/python/intern/bpy_operator_wrap.c

Modified: branches/blender2.5/blender/source/blender/python/intern/bpy_operator_wrap.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/intern/bpy_operator_wrap.c	2009-06-06 17:23:06 UTC (rev 20682)
+++ branches/blender2.5/blender/source/blender/python/intern/bpy_operator_wrap.c	2009-06-06 17:32:06 UTC (rev 20683)
@@ -189,6 +189,8 @@
 	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 @@
 		}
 		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 @@
 		{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}





More information about the Bf-blender-cvs mailing list