[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12903] trunk/blender/source/blender: Python API Merged from branch,

Campbell Barton ideasman42 at gmail.com
Sun Dec 16 04:42:42 CET 2007


Revision: 12903
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12903
Author:   campbellbarton
Date:     2007-12-16 04:42:41 +0100 (Sun, 16 Dec 2007)

Log Message:
-----------
Python API Merged from branch,
http://wiki.blender.org/index.php/Rewriting_the_2.4x_BPython_API

Some areas are not yet finished, the 2.4 api can remain "import Blender" and the bpy api "import bpy" gives access to the new api.

Todo
* event, link, etc are not assigned to Blender.*
* Scripts need to be tested and updated.
* Scripts cannot mix bpy and Blender modules anymore.
* Makefiles need to be updated (only works with scons now)
* Make the 2.4 api optional with IFDEF's
* Lots of testing and small fixes

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/library.c
    trunk/blender/source/blender/python/BPY_extern.h
    trunk/blender/source/blender/python/BPY_interface.c
    trunk/blender/source/blender/python/BPY_menus.c
    trunk/blender/source/blender/python/SConscript

Added Paths:
-----------
    trunk/blender/source/blender/python/api2_4x/
    trunk/blender/source/blender/python/api2_4x/0-todo.txt
    trunk/blender/source/blender/python/api2_4x/Armature.c
    trunk/blender/source/blender/python/api2_4x/Armature.h
    trunk/blender/source/blender/python/api2_4x/BGL.c
    trunk/blender/source/blender/python/api2_4x/Blender.h
    trunk/blender/source/blender/python/api2_4x/Bone.h
    trunk/blender/source/blender/python/api2_4x/Constraint.c
    trunk/blender/source/blender/python/api2_4x/Constraint.h
    trunk/blender/source/blender/python/api2_4x/CurNurb.c
    trunk/blender/source/blender/python/api2_4x/CurNurb.h
    trunk/blender/source/blender/python/api2_4x/Curve.h
    trunk/blender/source/blender/python/api2_4x/Draw.c
    trunk/blender/source/blender/python/api2_4x/EXPP_interface.c
    trunk/blender/source/blender/python/api2_4x/Font.c
    trunk/blender/source/blender/python/api2_4x/Font.h
    trunk/blender/source/blender/python/api2_4x/Geometry.c
    trunk/blender/source/blender/python/api2_4x/Group.h
    trunk/blender/source/blender/python/api2_4x/IDProp.c
    trunk/blender/source/blender/python/api2_4x/IDProp.h
    trunk/blender/source/blender/python/api2_4x/Image.c
    trunk/blender/source/blender/python/api2_4x/Ipo.h
    trunk/blender/source/blender/python/api2_4x/Key.c
    trunk/blender/source/blender/python/api2_4x/Key.h
    trunk/blender/source/blender/python/api2_4x/Lamp.c
    trunk/blender/source/blender/python/api2_4x/Lamp.h
    trunk/blender/source/blender/python/api2_4x/Lattice.c
    trunk/blender/source/blender/python/api2_4x/Lattice.h
    trunk/blender/source/blender/python/api2_4x/Library.c
    trunk/blender/source/blender/python/api2_4x/Library.h
    trunk/blender/source/blender/python/api2_4x/MTex.h
    trunk/blender/source/blender/python/api2_4x/Material.c
    trunk/blender/source/blender/python/api2_4x/Material.h
    trunk/blender/source/blender/python/api2_4x/Mathutils.c
    trunk/blender/source/blender/python/api2_4x/Mesh.c
    trunk/blender/source/blender/python/api2_4x/Modifier.c
    trunk/blender/source/blender/python/api2_4x/NLA.h
    trunk/blender/source/blender/python/api2_4x/NMesh.c
    trunk/blender/source/blender/python/api2_4x/NMesh.h
    trunk/blender/source/blender/python/api2_4x/Node.h
    trunk/blender/source/blender/python/api2_4x/Noise.c
    trunk/blender/source/blender/python/api2_4x/Object.h
    trunk/blender/source/blender/python/api2_4x/Particle.c
    trunk/blender/source/blender/python/api2_4x/Particle.h
    trunk/blender/source/blender/python/api2_4x/Pose.h
    trunk/blender/source/blender/python/api2_4x/Registry.h
    trunk/blender/source/blender/python/api2_4x/Scene.c
    trunk/blender/source/blender/python/api2_4x/Sound.c
    trunk/blender/source/blender/python/api2_4x/Sound.h
    trunk/blender/source/blender/python/api2_4x/SurfNurb.c
    trunk/blender/source/blender/python/api2_4x/SurfNurb.h
    trunk/blender/source/blender/python/api2_4x/Sys.c
    trunk/blender/source/blender/python/api2_4x/Text.c
    trunk/blender/source/blender/python/api2_4x/Text.h
    trunk/blender/source/blender/python/api2_4x/Text3d.h
    trunk/blender/source/blender/python/api2_4x/Texture.h
    trunk/blender/source/blender/python/api2_4x/Types.c
    trunk/blender/source/blender/python/api2_4x/Window.h
    trunk/blender/source/blender/python/api2_4x/World.c
    trunk/blender/source/blender/python/api2_4x/charRGBA.c
    trunk/blender/source/blender/python/api2_4x/constant.c
    trunk/blender/source/blender/python/api2_4x/constant.h
    trunk/blender/source/blender/python/api2_4x/euler.c
    trunk/blender/source/blender/python/api2_4x/gen_library.h
    trunk/blender/source/blender/python/api2_4x/gen_utils.h
    trunk/blender/source/blender/python/api2_4x/logic.h
    trunk/blender/source/blender/python/api2_4x/matrix.c
    trunk/blender/source/blender/python/api2_4x/meshPrimitive.c
    trunk/blender/source/blender/python/api2_4x/modules.h
    trunk/blender/source/blender/python/api2_4x/point.c
    trunk/blender/source/blender/python/api2_4x/point.h
    trunk/blender/source/blender/python/api2_4x/rgbTuple.c
    trunk/blender/source/blender/python/api2_4x/rgbTuple.h
    trunk/blender/source/blender/python/api2_4x/sceneRadio.c
    trunk/blender/source/blender/python/api2_4x/sceneSequence.h
    trunk/blender/source/blender/python/api2_4x/sceneTimeLine.h
    trunk/blender/source/blender/python/api2_4x/vector.c
    trunk/blender/source/blender/python/api2_4x/vector.h
    trunk/blender/source/blender/python/api2_4x/windowTheme.h
    trunk/blender/source/blender/python/api2_5x/
    trunk/blender/source/blender/python/api2_5x/0-todo.txt
    trunk/blender/source/blender/python/api2_5x/Armature.c
    trunk/blender/source/blender/python/api2_5x/Armature.h
    trunk/blender/source/blender/python/api2_5x/Bone.h
    trunk/blender/source/blender/python/api2_5x/Const.h
    trunk/blender/source/blender/python/api2_5x/Constraint.c
    trunk/blender/source/blender/python/api2_5x/Constraint.h
    trunk/blender/source/blender/python/api2_5x/CurNurb.c
    trunk/blender/source/blender/python/api2_5x/CurNurb.h
    trunk/blender/source/blender/python/api2_5x/Curve.h
    trunk/blender/source/blender/python/api2_5x/CurveBase.c
    trunk/blender/source/blender/python/api2_5x/CurveBase.h
    trunk/blender/source/blender/python/api2_5x/CurveText.c
    trunk/blender/source/blender/python/api2_5x/CurveText.h
    trunk/blender/source/blender/python/api2_5x/Draw.c
    trunk/blender/source/blender/python/api2_5x/EXPP_interface.c
    trunk/blender/source/blender/python/api2_5x/Font.c
    trunk/blender/source/blender/python/api2_5x/Font.h
    trunk/blender/source/blender/python/api2_5x/Geometry.c
    trunk/blender/source/blender/python/api2_5x/Group.h
    trunk/blender/source/blender/python/api2_5x/IDProp.c
    trunk/blender/source/blender/python/api2_5x/IDProp.h
    trunk/blender/source/blender/python/api2_5x/Image.c
    trunk/blender/source/blender/python/api2_5x/Ipo.h
    trunk/blender/source/blender/python/api2_5x/Key.c
    trunk/blender/source/blender/python/api2_5x/Key.h
    trunk/blender/source/blender/python/api2_5x/Lamp.c
    trunk/blender/source/blender/python/api2_5x/Lamp.h
    trunk/blender/source/blender/python/api2_5x/Lattice.c
    trunk/blender/source/blender/python/api2_5x/Lattice.h
    trunk/blender/source/blender/python/api2_5x/Library.c
    trunk/blender/source/blender/python/api2_5x/Library.h
    trunk/blender/source/blender/python/api2_5x/MTex.h
    trunk/blender/source/blender/python/api2_5x/MTexSeq.c
    trunk/blender/source/blender/python/api2_5x/MTexSeq.h
    trunk/blender/source/blender/python/api2_5x/Material.c
    trunk/blender/source/blender/python/api2_5x/Material.h
    trunk/blender/source/blender/python/api2_5x/Mathutils.c
    trunk/blender/source/blender/python/api2_5x/Mesh.c
    trunk/blender/source/blender/python/api2_5x/Modifier.c
    trunk/blender/source/blender/python/api2_5x/NLA.h
    trunk/blender/source/blender/python/api2_5x/Noise.c
    trunk/blender/source/blender/python/api2_5x/Object.h
    trunk/blender/source/blender/python/api2_5x/Particle.c
    trunk/blender/source/blender/python/api2_5x/Particle.h
    trunk/blender/source/blender/python/api2_5x/Pose.h
    trunk/blender/source/blender/python/api2_5x/Registry.h
    trunk/blender/source/blender/python/api2_5x/Scene.c
    trunk/blender/source/blender/python/api2_5x/Sound.c
    trunk/blender/source/blender/python/api2_5x/Sound.h
    trunk/blender/source/blender/python/api2_5x/SurfNurb.c
    trunk/blender/source/blender/python/api2_5x/SurfNurb.h
    trunk/blender/source/blender/python/api2_5x/Text.c
    trunk/blender/source/blender/python/api2_5x/Text.h
    trunk/blender/source/blender/python/api2_5x/Texture.h
    trunk/blender/source/blender/python/api2_5x/Window.h
    trunk/blender/source/blender/python/api2_5x/World.c
    trunk/blender/source/blender/python/api2_5x/bpy.h
    trunk/blender/source/blender/python/api2_5x/bpy_app.h
    trunk/blender/source/blender/python/api2_5x/bpy_config.c
    trunk/blender/source/blender/python/api2_5x/bpy_config.h
    trunk/blender/source/blender/python/api2_5x/bpy_data.c
    trunk/blender/source/blender/python/api2_5x/bpy_data.h
    trunk/blender/source/blender/python/api2_5x/bpy_float.c
    trunk/blender/source/blender/python/api2_5x/bpy_float.h
    trunk/blender/source/blender/python/api2_5x/bpy_gl.c
    trunk/blender/source/blender/python/api2_5x/bpy_list.h
    trunk/blender/source/blender/python/api2_5x/bpy_state.c
    trunk/blender/source/blender/python/api2_5x/bpy_state.h
    trunk/blender/source/blender/python/api2_5x/bpy_types.c
    trunk/blender/source/blender/python/api2_5x/bpy_types.h
    trunk/blender/source/blender/python/api2_5x/bpy_utils.c
    trunk/blender/source/blender/python/api2_5x/bpy_utils.h
    trunk/blender/source/blender/python/api2_5x/charRGBA.c
    trunk/blender/source/blender/python/api2_5x/color.c
    trunk/blender/source/blender/python/api2_5x/doc/
    trunk/blender/source/blender/python/api2_5x/euler.c
    trunk/blender/source/blender/python/api2_5x/gen_library.h
    trunk/blender/source/blender/python/api2_5x/gen_utils.h
    trunk/blender/source/blender/python/api2_5x/layer_set.h
    trunk/blender/source/blender/python/api2_5x/logic.h
    trunk/blender/source/blender/python/api2_5x/matrix.c
    trunk/blender/source/blender/python/api2_5x/meshPrimitive.c
    trunk/blender/source/blender/python/api2_5x/modules.h
    trunk/blender/source/blender/python/api2_5x/object_softbody.c
    trunk/blender/source/blender/python/api2_5x/object_softbody.h
    trunk/blender/source/blender/python/api2_5x/sceneObSeq.c
    trunk/blender/source/blender/python/api2_5x/sceneObSeq.h
    trunk/blender/source/blender/python/api2_5x/sceneRadio.c
    trunk/blender/source/blender/python/api2_5x/sceneSequence.h
    trunk/blender/source/blender/python/api2_5x/sceneTimeLine.h
    trunk/blender/source/blender/python/api2_5x/vector.c
    trunk/blender/source/blender/python/api2_5x/vector.h
    trunk/blender/source/blender/python/api2_5x/windowTheme.h

Removed Paths:
-------------
    trunk/blender/source/blender/python/api2_2x/

Modified: trunk/blender/source/blender/blenkernel/intern/library.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/library.c	2007-12-16 00:59:06 UTC (rev 12902)
+++ trunk/blender/source/blender/blenkernel/intern/library.c	2007-12-16 03:42:41 UTC (rev 12903)
@@ -116,6 +116,9 @@
 
 #include "BPI_script.h"
 
+/* for maintaining the python id hash when removeing data */
+#include "BPY_extern.h"
+
 #define MAX_IDPUP		60	/* was 24 */
 
 /* ************* general ************************ */
@@ -432,6 +435,9 @@
 {
 	ID *id= idv;
 	
+	/* invalidate the data if its in the python pool */
+	BPY_idhash_invalidate(id);
+	
 	switch( GS(id->name) ) {	/* GetShort from util.h */
 		case ID_SCE:
 			free_scene((Scene *)id);

Modified: trunk/blender/source/blender/python/BPY_extern.h
===================================================================
--- trunk/blender/source/blender/python/BPY_extern.h	2007-12-16 00:59:06 UTC (rev 12902)
+++ trunk/blender/source/blender/python/BPY_extern.h	2007-12-16 03:42:41 UTC (rev 12903)
@@ -30,9 +30,12 @@
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */
 
+
 #ifndef BPY_EXTERN_H
 #define BPY_EXTERN_H
 
+#define EXPP_BUTTON_EVENTS_OFFSET 1001
+
 extern char bprogname[];	/* holds a copy of argv[0], from creator.c */
 
 struct Text; /* defined in DNA_text_types.h */
@@ -124,6 +127,12 @@
 	void BPY_clear_script( struct Script *script );
 	void BPY_free_finished_script( struct Script *script );
 
+/* tell python were removing this ID so python can NULL the pointers */
+	void BPY_idhash_add(void * value);
+	void *BPY_idhash_get(ID *id);
+	void BPY_idhash_remove(ID *id);
+	void BPY_idhash_invalidate(ID *id);
+
 /* void BPY_Err_Handle(struct Text *text); */
 /* void BPY_clear_bad_scriptlink(struct ID *id, struct Text *byebye); */
 /* void BPY_clear_bad_scriptlist(struct ListBase *, struct Text *byebye); */

Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c	2007-12-16 00:59:06 UTC (rev 12902)
+++ trunk/blender/source/blender/python/BPY_interface.c	2007-12-16 03:42:41 UTC (rev 12903)
@@ -36,6 +36,7 @@
 #include "compile.h"		/* for the PyCodeObject */
 #include "eval.h"		/* for PyEval_EvalCode */
 #include "BLI_blenlib.h"	/* for BLI_last_slash() */
+#include "BLI_ghash.h"	/* for tracking removed data */
 #include "BIF_interface.h"	/* for pupmenu() */
 #include "BIF_space.h"
 #include "BIF_screen.h"
@@ -45,7 +46,6 @@
 #include "BKE_object.h"		/* during_scriptlink() */
 #include "BKE_text.h"
 #include "BKE_constraint.h" /* for bConstraintOb */
-#include "BKE_idprop.h"
 
 #include "DNA_curve_types.h" /* for struct IpoDriver */
 #include "DNA_ID.h" /* ipo driver */
@@ -61,23 +61,31 @@
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_armature.h"
-#include "api2_2x/EXPP_interface.h"
-#include "api2_2x/constant.h"
-#include "api2_2x/gen_utils.h"
-#include "api2_2x/gen_library.h" /* V24_GetPyObjectFromID */
-#include "api2_2x/BGL.h" 
-#include "api2_2x/Blender.h"
-#include "api2_2x/Camera.h"
-#include "api2_2x/Draw.h"
-#include "api2_2x/Object.h"
-#include "api2_2x/Registry.h"
-#include "api2_2x/Pose.h"
-#include "api2_2x/bpy.h" /* for the new "bpy" module */
+#include "api2_5x/EXPP_interface.h"
+#include "api2_5x/gen_utils.h"
+#include "api2_5x/gen_library.h" /* GetPyObjectFromID */
+#include "api2_5x/bpy_gl.h" 
+#include "api2_5x/bpy.h"
+#include "api2_5x/bpy_state.h"
+#include "api2_5x/Camera.h"
+#include "api2_5x/Draw.h"
+#include "api2_5x/Object.h"
+#include "api2_5x/Registry.h"
+#include "api2_5x/Pose.h"
+#include "api2_5x/bpy.h" /* for the new "bpy" module */
 
+/* old 2.4x api */
+#include "api2_4x/Blender.h"
+
 /*these next two are for pyconstraints*/
-#include "api2_2x/IDProp.h"
-#include "api2_2x/matrix.h"
+#include "api2_5x/IDProp.h"
+#include "api2_5x/matrix.h"
 
+#include "api2_5x/gen_utils.h"
+#include "api2_5x/gen_library.h"
+#include "blendef.h"
+#include "BKE_utildefines.h"
+
 /* for scriptlinks */
 #include "DNA_lamp_types.h"
 #include "DNA_camera_types.h"
@@ -85,17 +93,191 @@
 #include "DNA_scene_types.h"
 #include "DNA_material_types.h"
 
-/* V24_bpy_registryDict is declared in api2_2x/Registry.h and defined
- * in api2_2x/Registry.c
+#include "DNA_ID.h"
+
+#include "mydevice.h"		/*@ for all the event constants, only because we have to access QKEY etc */
+
+/* bpy_registryDict is declared in api2_5x/Registry.h and defined
+ * in api2_5x/Registry.c
  * This Python dictionary will be used to store data that scripts
  * choose to preserve after they are executed, so user changes can be
  * restored next time the script is used.  Check the Blender.Registry module. 
  */
-/*#include "api2_2x/Registry.h" */
+/*#include "api2_5x/Registry.h" */
 
 /* for pydrivers (ipo drivers defined by one-line Python expressions) */
 PyObject *bpy_pydriver_Dict = NULL;
 
+
+/*This is needed for button callbacks.  Any button that uses a callback gets added to this list.
+  On the C side of drawing begin, this list should be cleared.
+  Each entry is a tuple of the form (button, callback py object)
+*/
+PyObject *M_Button_List = NULL;
+
+void BPy_Set_DrawButtonsList(void *list)
+{
+	M_Button_List = list;
+}
+
+/*this MUST be called after doing UI stuff.*/
+void BPy_Free_DrawButtonsList(void)
+{
+	/*Clear the list.*/
+	if (M_Button_List) {
+		PyList_SetSlice(M_Button_List, 0, PyList_Size(M_Button_List), NULL);
+		Py_DECREF(M_Button_List);
+		M_Button_List = NULL;
+	}
+}
+
+void exit_pydraw( SpaceScript * sc, short err )
+{
+	Script *script = NULL;
+
+	if( !sc || !sc->script )
+		return;
+
+	script = sc->script;
+
+	if( err ) {
+		PyErr_Print(  );
+		script->flags = 0;	/* mark script struct for deletion */
+		error( "Python script error: check console" );
+		scrarea_queue_redraw( sc->area );
+	}
+
+	BPy_Set_DrawButtonsList(sc->but_refs);
+	BPy_Free_DrawButtonsList(); /*clear all temp button references*/
+	sc->but_refs = NULL;
+	
+	Py_XDECREF( ( PyObject * ) script->py_draw );
+	Py_XDECREF( ( PyObject * ) script->py_event );
+	Py_XDECREF( ( PyObject * ) script->py_button );
+
+	script->py_draw = script->py_event = script->py_button = NULL;
+}
+
+static void exec_callback( SpaceScript * sc, PyObject * callback,
+			   PyObject * args )
+{
+	PyObject *result = PyObject_CallObject( callback, args );
+
+	if( result == NULL && sc->script ) {	/* errors in the script */
+
+		if( sc->script->lastspace == SPACE_TEXT ) {	/*if it can be an ALT+P script */
+			Text *text = G.main->text.first;
+
+			while( text ) {	/* find it and free its compiled code */
+
+				if( !strcmp
+				    ( text->id.name + 2,
+				      sc->script->id.name + 2 ) ) {
+					BPY_free_compiled_text( text );
+					break;
+				}
+
+				text = text->id.next;
+			}
+		}
+		exit_pydraw( sc, 1 );
+	}
+
+	Py_XDECREF( result );
+	Py_DECREF( args );
+}
+
+/* BPY_spacescript_do_pywin_draw, the static spacescript_do_pywin_buttons and
+ * BPY_spacescript_do_pywin_event are the three functions responsible for
+ * calling the draw, buttons and event callbacks registered with Draw.Register
+ * (see Method_Register below).  They are called (only the two BPY_ ones)
+ * from blender/src/drawscript.c */
+
+void BPY_spacescript_do_pywin_draw( SpaceScript * sc )
+{
+	uiBlock *block;
+	char butblock[20];
+	Script *script = sc->script;
+
+	sprintf( butblock, "win %d", curarea->win );
+	block = uiNewBlock( &curarea->uiblocks, butblock, UI_EMBOSSX,
+			    UI_HELV, curarea->win );
+
+	if( script->py_draw ) {
+		if (sc->but_refs) {
+			BPy_Set_DrawButtonsList(sc->but_refs);
+			BPy_Free_DrawButtonsList(); /*clear all temp button references*/
+		}
+		sc->but_refs = PyList_New(0);
+		BPy_Set_DrawButtonsList(sc->but_refs);
+		
+		glPushAttrib( GL_ALL_ATTRIB_BITS );
+		exec_callback( sc, script->py_draw, Py_BuildValue( "()" ) );
+		glPopAttrib(  );
+	} else {
+		glClearColor( 0.4375, 0.4375, 0.4375, 0.0 );
+		glClear( GL_COLOR_BUFFER_BIT );
+	}
+
+	uiDrawBlock( block );
+
+	curarea->win_swap = WIN_BACK_OK;
+}
+
+void spacescript_do_pywin_buttons( SpaceScript * sc,
+					  unsigned short event )
+{
+	if( sc->script->py_button )
+		exec_callback( sc, sc->script->py_button,
+			       Py_BuildValue( "(i)", event ) );
+}
+
+void BPY_spacescript_do_pywin_event( SpaceScript * sc, unsigned short event,
+	short val, char ascii )
+{
+	if( event == QKEY && G.qual & ( LR_ALTKEY | LR_CTRLKEY ) ) {
+		/* finish script: user pressed ALT+Q or CONTROL+Q */
+		Script *script = sc->script;
+
+		exit_pydraw( sc, 0 );
+
+		script->flags &= ~SCRIPT_GUI;	/* we're done with this script */
+
+		return;
+	}
+
+	if (val) {
+
+		if (uiDoBlocks( &curarea->uiblocks, event, 1 ) != UI_NOTHING) event = 0;
+
+		if (event == UI_BUT_EVENT) {
+			/* check that event is in free range for script button events;
+			 * read the comment before check_button_event() below to understand */
+			if (val >= EXPP_BUTTON_EVENTS_OFFSET && val < 0x4000)
+				spacescript_do_pywin_buttons(sc, val - EXPP_BUTTON_EVENTS_OFFSET);
+			return;
+		}
+	}
+
+	/* We use the "event" main module var, used by scriptlinks, to pass the ascii
+	 * value to event callbacks (gui/event/button callbacks are not allowed
+	 * inside scriptlinks, so this is ok) */
+	if( sc->script->py_event ) {
+		int pass_ascii = 0;
+		if (ascii > 31 && ascii != 127) {
+			pass_ascii = 1;
+			EXPP_dict_set_item_str(g_bpystatedict, "event",
+					PyInt_FromLong((long)ascii));
+		}
+		exec_callback( sc, sc->script->py_event,
+			Py_BuildValue( "(ii)", event, val ) );
+		if (pass_ascii)
+			EXPP_dict_set_item_str(g_bpystatedict, "event",
+					PyString_FromString(""));
+	}
+}
+
+
 /*
  * set up a weakref list for Armatures
  *    creates list in __main__ module dict 
@@ -136,7 +318,7 @@
  * These are TOP-LEVEL modules e.g. import `module` - there is no
  * support for packages here e.g. import `package.module` */
 
-static struct _inittab BPy_Inittab_Modules[] = {
+static struct _inittab BPyInittab_Modules[] = {
 	{"Blender", V24_M_Blender_Init},
 	{"bpy", m_bpy_init},
 	{NULL, NULL}
@@ -175,7 +357,79 @@
 void BPY_Err_Handle( char *script_name );
 PyObject *traceback_getFilename( PyObject * tb );
 
+
 /****************************************************************************
+* Description: These functions deal with maintaining a python hash of ID
+* types that can be removed. This is important because when blender data is
+* removed, python needs to invalidate the BPy data by setting its ID pointer

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list