[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20566] branches/soc-2009-kazanbas/source/ blender/python/intern/bpy_operator_wrap.c: Woohoo! Context is now passed to operator's exec.

Arystanbek Dyussenov arystan.d at gmail.com
Mon Jun 1 21:44:22 CEST 2009


Revision: 20566
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20566
Author:   kazanbas
Date:     2009-06-01 21:44:22 +0200 (Mon, 01 Jun 2009)

Log Message:
-----------
Woohoo! Context is now passed to operator's exec. Thanks Brecht and 
Campbell!

Modified Paths:
--------------
    branches/soc-2009-kazanbas/source/blender/python/intern/bpy_operator_wrap.c

Modified: branches/soc-2009-kazanbas/source/blender/python/intern/bpy_operator_wrap.c
===================================================================
--- branches/soc-2009-kazanbas/source/blender/python/intern/bpy_operator_wrap.c	2009-06-01 19:12:11 UTC (rev 20565)
+++ branches/soc-2009-kazanbas/source/blender/python/intern/bpy_operator_wrap.c	2009-06-01 19:44:22 UTC (rev 20566)
@@ -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, "execu");
-			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},
-		{"execu",	'f', 1,	BPY_CLASS_ATTR_OPTIONAL},
+		{"execu",	'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