diff options
Diffstat (limited to 'source/blender/python/api2_2x')
-rw-r--r-- | source/blender/python/api2_2x/Camera.c | 14 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Lamp.c | 28 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Material.c | 78 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 137 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Pose.c | 29 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Scene.c | 23 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Text.c | 95 | ||||
-rw-r--r-- | source/blender/python/api2_2x/World.c | 48 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/API_intro.py | 8 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/API_related.py | 13 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Blender.py | 10 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Object.py | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/sceneRender.c | 4 |
13 files changed, 281 insertions, 208 deletions
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c index 87c605ef612..af93a1130cb 100644 --- a/source/blender/python/api2_2x/Camera.c +++ b/source/blender/python/api2_2x/Camera.c @@ -36,6 +36,7 @@ #include "BKE_utildefines.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" /* for M_PI */ +#include "DNA_userdef_types.h" #include "BSE_editipo.h" #include "BIF_keyframing.h" #include "BIF_space.h" @@ -1032,18 +1033,21 @@ static PyObject *Camera_repr( BPy_Camera * self ) static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args ) { - int key = 0; + int key = 0, flag = 0; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected int argument" ) ); - + + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_LENS){ - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, 0); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, flag); } else if (key == IPOKEY_CLIPPING){ - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, 0); - insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, 0); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, flag); + insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 38968b64cf5..799833d4ee0 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -46,6 +46,7 @@ #include "gen_utils.h" #include "gen_library.h" #include "BKE_utildefines.h" +#include "DNA_userdef_types.h" #include "MEM_guardedalloc.h" /*****************************************************************************/ @@ -1336,7 +1337,7 @@ static int Lamp_setIpo( BPy_Lamp * self, PyObject * value ) static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -1344,26 +1345,29 @@ static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args ) map = texchannel_to_adrcode(self->lamp->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_RGB ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, flag); } if (key == IPOKEY_ENERGY ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, flag); } if (key == IPOKEY_SPOTSIZE ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, flag); } if (key == IPOKEY_OFFSET ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, flag); } if (key == IPOKEY_SIZE ) { - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index b118bdb30e7..d3bb6c8d158 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -32,6 +32,7 @@ #include "DNA_space_types.h" #include "DNA_material_types.h" +#include "DNA_userdef_types.h" #include "BKE_main.h" #include "BKE_global.h" #include "BKE_library.h" @@ -1873,7 +1874,7 @@ static int Material_setIpo( BPy_Material * self, PyObject * value ) static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -1881,59 +1882,62 @@ static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) map = texchannel_to_adrcode(self->material->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if(key==IPOKEY_RGB || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, flag); } if(key==IPOKEY_ALPHA || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, flag); } if(key==IPOKEY_HALOSIZE || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, flag); } if(key==IPOKEY_MODE || key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag); } if(key==IPOKEY_ALLCOLOR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, flag); } if(key==IPOKEY_ALLMIRROR) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, flag); } if(key==IPOKEY_OFS || key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, flag); } if(key==IPOKEY_SIZE || key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, flag); } if(key==IPOKEY_ALLMAPPING) { - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, 0); - insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, 0); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, flag); + insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 0d5af06377c..1e5445cbd80 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -2568,7 +2568,7 @@ static int Object_setMatrix( BPy_Object * self, MatrixObject * mat ) static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; - int key = 0; + int key = 0, flag = 0; char *actname= NULL; if( !PyArg_ParseTuple( args, "i", &key ) ) @@ -2578,35 +2578,39 @@ static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) if(ob->ipoflag & OB_ACTION_OB) actname= "Object"; + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_LOC || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, flag); } if (key == IPOKEY_ROT || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, flag); } if (key == IPOKEY_SIZE || key == IPOKEY_LOCROTSIZE ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, flag); } if (key == IPOKEY_LAYER ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, flag); } if (key == IPOKEY_PI_STRENGTH ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, flag); } else if (key == IPOKEY_PI_FALLOFF ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, flag); } else if (key == IPOKEY_PI_SURFACEDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, flag); } else if (key == IPOKEY_PI_RANDOMDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, flag); } else if (key == IPOKEY_PI_PERM ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, flag); } allspace(REMAKEIPO, 0); @@ -2630,6 +2634,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) BPy_Action *sourceact; char *chanName; int actframe; + int flag=0; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2648,17 +2653,21 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) /* XXX: must check chanName actually exists, otherwise segfaults! */ //achan = get_action_channel(sourceact->action, chanName); - - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; @@ -2680,6 +2689,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; + int flag = 0; char *chanName; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2695,16 +2705,20 @@ static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args /* XXX: must check chanName actually exists, otherwise segfaults! */ - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; @@ -2988,7 +3002,7 @@ static PyObject *Object_getProperty( BPy_Object * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string" ); - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) return Property_CreatePyObject( prop ); @@ -3004,7 +3018,7 @@ static PyObject *Object_addProperty( BPy_Object * self, PyObject * args ) char *prop_type = NULL; short type = -1; BPy_Property *py_prop = NULL; - int argslen = PyObject_Length( args ); + int argslen = PyTuple_Size( args ); if( argslen == 3 || argslen == 2 ) { if( !PyArg_ParseTuple( args, "sO|s", &prop_name, &prop_data, @@ -3115,7 +3129,7 @@ static PyObject *Object_removeProperty( BPy_Object * self, PyObject * args ) py_prop->property = NULL; } } else { - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) { BLI_remlink( &self->object->prop, prop ); free_property( prop ); @@ -3134,18 +3148,23 @@ static PyObject *Object_copyAllPropertiesTo( BPy_Object * self, PyObject * args ) { PyObject *dest; + Object *dest_ob; bProperty *prop = NULL; bProperty *propn = NULL; if( !PyArg_ParseTuple( args, "O!", &Object_Type, &dest ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected an Object" ); - + + if (dest == (PyObject *)self) { + Py_RETURN_NONE; + } + dest_ob = ( ( BPy_Object * ) dest )->object; + /*make a copy of all its properties*/ prop = self->object->prop.first; while( prop ) { - propn = copy_property( prop ); - BLI_addtail( &( ( BPy_Object * ) dest )->object->prop, propn ); + set_ob_property( dest_ob, prop ); prop = prop->next; } @@ -3305,6 +3324,33 @@ static PyObject *Object_insertShapeKey(BPy_Object * self) Py_RETURN_NONE; } +static PyObject *Object_getColor( BPy_Object *self, void *type ) +{ + return Py_BuildValue( "(ffff)", self->object->col[0], self->object->col[1], self->object->col[2], self->object->col[3] ); +} + +static int Object_setColor( BPy_Object *self, PyObject *value ) +{ + int i; + float color[4]; + struct Object *object = self->object; + + value = PySequence_Tuple( value ); + + if( !value || !PyArg_ParseTuple( value, "ffff", &color[0], &color[1], &color[2], &color[3] ) ) { + Py_XDECREF( value ); + return EXPP_ReturnIntError( PyExc_TypeError, + "expected a list or tuple of 3 floats" ); + } + + Py_DECREF( value ); + + for( i = 0; i < 4; ++i ) { + object->col[i] = MAX2(MIN2(color[i], 1.0), 0); + } + return 0; +} + /* __copy__() */ static PyObject *Object_copy(BPy_Object * self) { @@ -5189,7 +5235,10 @@ static PyGetSetDef BPy_Object_getseters[] = { (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits, "Transparent materials for the active object (mesh only) enabled", (void *)OB_DRAWTRANSP}, - + {"color", + (getter)Object_getColor, (setter)Object_setColor, + "Object color used by the game engine and optionally for materials", + NULL}, {"enableNLAOverride", (getter)Object_getNLAflagBits, (setter)Object_setNLAflagBits, "Toggles Action-NLA based animation", diff --git a/source/blender/python/api2_2x/Pose.c b/source/blender/python/api2_2x/Pose.c index 52ede1cb3ee..06d736f2cb6 100644 --- a/source/blender/python/api2_2x/Pose.c +++ b/source/blender/python/api2_2x/Pose.c @@ -414,16 +414,17 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args) { PyObject *parent_object = NULL; PyObject *constants = NULL, *item = NULL; - int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0; + int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0, flag = 0; bPoseChannel *pchan = NULL; if (!PyArg_ParseTuple(args, "O!i|Oi", &Object_Type, &parent_object, &frame, &constants, &no_ipo_update )) goto AttributeError; - /* incase we ever have a value other then 1 for fast */ - if (no_ipo_update) - no_ipo_update = 1; + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (no_ipo_update) flag |= INSERTKEY_FAST; + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; //verify that this pchannel is part of the object->pose for (pchan = ((BPy_Object*)parent_object)->object->pose->chanbase.first; @@ -493,29 +494,29 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args) //insert the pose keys if (self->posechannel->flag & POSE_ROT){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_QUAT_W, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_QUAT_W, flag); } if (self->posechannel->flag & POSE_LOC){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_LOC_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_LOC_Z, flag); } if (self->posechannel->flag & POSE_SIZE){ insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_X, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_X, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, flag); insertkey(&((BPy_Object*)parent_object)->object->id, - ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, no_ipo_update); + ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, flag); } //flip the frame back diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index eba951b8813..662656663c1 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -641,20 +641,18 @@ static PyObject *M_Scene_Get( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple( args, "|s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument (or nothing)" ) ); - + scene_iter = G.main->scene.first; if( name ) { /* (name) - Search scene by name */ PyObject *wanted_scene = NULL; - while( ( scene_iter ) && ( wanted_scene == NULL ) ) { - - if( strcmp( name, scene_iter->id.name + 2 ) == 0 ) - wanted_scene = - Scene_CreatePyObject( scene_iter ); - - scene_iter = scene_iter->id.next; + for(;scene_iter; scene_iter = scene_iter->id.next) { + if( strcmp( name, scene_iter->id.name + 2 ) == 0 ) { + wanted_scene = Scene_CreatePyObject( scene_iter ); + break; + } } if( wanted_scene == NULL ) { /* Requested scene doesn't exist */ @@ -678,19 +676,14 @@ static PyObject *M_Scene_Get( PyObject * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_MemoryError, "couldn't create PyList" ) ); - while( scene_iter ) { + for(; scene_iter; scene_iter = scene_iter->id.next, index++) { pyobj = Scene_CreatePyObject( scene_iter ); if( !pyobj ) { Py_DECREF(sce_pylist); - return ( EXPP_ReturnPyObjError - ( PyExc_MemoryError, - "couldn't create PyString" ) ); + return NULL; /* Scene_CreatePyObject sets an error */ } PyList_SET_ITEM( sce_pylist, index, pyobj ); - - scene_iter = scene_iter->id.next; - index++; } return sce_pylist; diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c index 9719daaa3d4..c8b96fbd97e 100644 --- a/source/blender/python/api2_2x/Text.c +++ b/source/blender/python/api2_2x/Text.c @@ -47,6 +47,10 @@ #define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW +/* checks for the group being removed */ +#define TEXT_DEL_CHECK_PY(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Text has been removed" ) ) +#define TEXT_DEL_CHECK_INT(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Text has been removed" ) ) + /*****************************************************************************/ /* Python API function prototypes for the Text module. */ /*****************************************************************************/ @@ -109,6 +113,8 @@ static PyObject *Text_markSelection( BPy_Text * self, PyObject * args ); static PyObject *Text_suggest( BPy_Text * self, PyObject * args ); static PyObject *Text_showDocs( BPy_Text * self, PyObject * args ); +static void text_reset_internal( BPy_Text * self ); /* internal func */ + /*****************************************************************************/ /* Python BPy_Text methods table: */ /*****************************************************************************/ @@ -377,8 +383,7 @@ PyObject *Text_CreatePyObject( Text * txt ) "couldn't create BPy_Text PyObject" ); pytxt->text = txt; - pytxt->iol = NULL; - pytxt->ioc = -1; + text_reset_internal(pytxt); return ( PyObject * ) pytxt; } @@ -388,6 +393,7 @@ PyObject *Text_CreatePyObject( Text * txt ) /*****************************************************************************/ static PyObject *Text_getFilename( BPy_Text * self ) { + TEXT_DEL_CHECK_PY(self); if( self->text->name ) return PyString_FromString( self->text->name ); @@ -398,7 +404,9 @@ static PyObject *Text_getNLines( BPy_Text * self ) { /* text->nlines isn't updated in Blender (?) */ int nlines = 0; TextLine *line; - + + TEXT_DEL_CHECK_PY(self); + line = self->text->lines.first; while( line ) { /* so we have to count them ourselves */ @@ -415,9 +423,7 @@ static PyObject *Text_clear( BPy_Text * self) { int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); oldstate = txt_get_undostate( ); txt_set_undostate( 1 ); @@ -428,11 +434,15 @@ static PyObject *Text_clear( BPy_Text * self) Py_RETURN_NONE; } -static PyObject *Text_reset( BPy_Text * self ) +static void text_reset_internal( BPy_Text * self ) { self->iol = NULL; self->ioc = -1; +} +static PyObject *Text_reset( BPy_Text * self ) +{ + text_reset_internal(self); Py_RETURN_NONE; } @@ -440,9 +450,7 @@ static PyObject *Text_readline( BPy_Text * self ) { PyObject *tmpstr; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); /* Reset */ if (!self->iol && self->ioc == -1) { @@ -476,20 +484,18 @@ static PyObject *Text_write( BPy_Text * self, PyObject * value ) char *str = PyString_AsString(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - if( !str ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); + TEXT_DEL_CHECK_PY(self); + oldstate = txt_get_undostate( ); txt_insert_buf( self->text, str ); txt_move_eof( self->text, 0 ); txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -499,19 +505,17 @@ static PyObject *Text_insert( BPy_Text * self, PyObject * value ) char *str = PyString_AsString(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - if( !str ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); + + TEXT_DEL_CHECK_PY(self); oldstate = txt_get_undostate( ); txt_insert_buf( self->text, str ); txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -521,11 +525,10 @@ static PyObject *Text_delete( BPy_Text * self, PyObject * value ) int num = PyInt_AsLong(value); int oldstate; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); - - if( !num ) + TEXT_DEL_CHECK_PY(self); + + /* zero num is invalid and -1 is an error value */ + if( !num || (num==-1 && PyErr_Occurred())) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected non-zero int argument" ); @@ -540,7 +543,7 @@ static PyObject *Text_delete( BPy_Text * self, PyObject * value ) } txt_set_undostate( oldstate ); - Text_reset( self ); + text_reset_internal( self ); Py_RETURN_NONE; } @@ -550,6 +553,8 @@ static PyObject *Text_set( BPy_Text * self, PyObject * args ) int ival; char *attr; + TEXT_DEL_CHECK_PY(self); + if( !PyArg_ParseTuple( args, "si", &attr, &ival ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string and an int as arguments" ); @@ -570,9 +575,7 @@ static PyObject *Text_asLines( BPy_Text * self, PyObject * args ) PyObject *list, *tmpstr; int start=0, end=-1, i; - if( !self->text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); + TEXT_DEL_CHECK_PY(self); if( !PyArg_ParseTuple( args, "|ii", &start, &end ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, @@ -608,10 +611,9 @@ static PyObject *Text_getCursorPos( BPy_Text * self ) TextLine *linep; int row, col; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if( !text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); for (row=0,linep=text->lines.first; linep!=text->curl; linep=linep->next) row++; @@ -625,9 +627,7 @@ static PyObject *Text_setCursorPos( BPy_Text * self, PyObject * args ) int row, col; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "ii", &row, &col)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -649,10 +649,9 @@ static PyObject *Text_getSelectPos( BPy_Text * self ) TextLine *linep; int row, col; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if( !text ) - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object" ); for (row=0,linep=text->lines.first; linep!=text->sell; linep=linep->next) row++; @@ -666,9 +665,7 @@ static PyObject *Text_setSelectPos( BPy_Text * self, PyObject * args ) int row, col; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "ii", &row, &col)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -690,10 +687,9 @@ static PyObject *Text_markSelection( BPy_Text * self, PyObject * args ) Text *text; char color[4]; + TEXT_DEL_CHECK_PY(self); + text = self->text; - if (!text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); if (!PyArg_ParseTuple(args, "i(iii)i", &group, &r, &g, &b, &flags)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -723,9 +719,7 @@ static PyObject *Text_suggest( BPy_Text * self, PyObject * args ) char *prefix = NULL, *name, type; SpaceText *st; - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + TEXT_DEL_CHECK_PY(self); /* Parse args for a list of strings/tuples */ if (!PyArg_ParseTuple(args, "O!|s", &PyList_Type, &list, &prefix)) @@ -782,10 +776,8 @@ static PyObject *Text_showDocs( BPy_Text * self, PyObject * args ) { char *docs; SpaceText *st; - - if (!self->text) - return EXPP_ReturnPyObjError(PyExc_RuntimeError, - "This object isn't linked to a Blender Text Object"); + + TEXT_DEL_CHECK_PY(self); if (!PyArg_ParseTuple(args, "s", &docs)) return EXPP_ReturnPyObjError( PyExc_TypeError, @@ -839,6 +831,7 @@ static PyObject *Text_repr( BPy_Text * self ) /*****************************************************************************/ static PyObject *Text_getMode(BPy_Text * self) { + TEXT_DEL_CHECK_PY(self); return PyInt_FromLong( self->text->flags ); } diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 0c57488a266..354d8cda0b7 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -43,6 +43,7 @@ #include "World.h" /*This must come first*/ #include "DNA_scene_types.h" /* for G.scene */ +#include "DNA_userdef_types.h" #include "BKE_global.h" #include "BKE_world.h" #include "BKE_main.h" @@ -988,7 +989,7 @@ World *World_FromPyObject( PyObject * py_obj ) static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args ) { - int key = 0, map; + int key = 0, flag = 0, map; if( !PyArg_ParseTuple( args, "i", &( key ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, @@ -996,38 +997,41 @@ static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args ) map = texchannel_to_adrcode(self->world->texact); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if(key == IPOKEY_ZENITH) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, flag); } if(key == IPOKEY_HORIZON) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, flag); } if(key == IPOKEY_MIST) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, flag); } if(key == IPOKEY_STARS) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, flag); } if(key == IPOKEY_OFFSET) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, flag); } if(key == IPOKEY_SIZE) { - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, 0); - insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, 0); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, flag); + insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, flag); } allspace(REMAKEIPO, 0); diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py index 2960d8ed1d2..192c9710ea2 100644 --- a/source/blender/python/api2_2x/doc/API_intro.py +++ b/source/blender/python/api2_2x/doc/API_intro.py @@ -61,6 +61,14 @@ The Blender Python API Reference - L{World} - L{sys<Sys>} + Additional information: + ----------------------- + - L{API_related}: + - Calling scripts from command line + - Script links and space handlers + - How to register scripts in menus + - Recommended ways to document and support configuration options + Introduction: ============= diff --git a/source/blender/python/api2_2x/doc/API_related.py b/source/blender/python/api2_2x/doc/API_related.py index 4e29f95e76d..dcd2bdd1e60 100644 --- a/source/blender/python/api2_2x/doc/API_related.py +++ b/source/blender/python/api2_2x/doc/API_related.py @@ -226,6 +226,7 @@ Introduction: import Blender from Blender import Draw evt = Blender.event + val = Blender.eventValue return_it = False if evt == Draw.LEFTMOUSE: @@ -233,7 +234,7 @@ Introduction: elif evt == Draw.AKEY: print "Swallowing an 'a' character" else: - print "Let the 3D View itself process this event:", evt + print "Let the 3D View itself process this event: %d with value %d" % (evt, val) return_it = True # if Blender should not process itself the passed event: @@ -249,8 +250,14 @@ Introduction: tells what space this handler belongs to and the handler's type (EVENT, DRAW); - B{event}: - - EVENT handlers: an input event (check keys and mouse events in L{Draw}) - to be processed or ignored. + - EVENT handlers: an input event (check keys and mouse events in + L{Draw}) to be processed or ignored; + - DRAW handlers: 0 always; + - B{eventValue}: + - EVENT handlers: the event value, it indicates mouse button or key + presses (since we don't pass releases) as 1 and mouse movements + (Draw.MOUSE.X and Draw.MOUSE.Y) as the current x or y coordinate, + for example; - DRAW handlers: 0 always. B{Guidelines (important)}: diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py index 964b8f70e8b..9d89cae7137 100644 --- a/source/blender/python/api2_2x/doc/Blender.py +++ b/source/blender/python/api2_2x/doc/Blender.py @@ -10,8 +10,8 @@ """ The main Blender module. -B{New}: L{Run}, L{UpdateMenus}, new options to L{Get}, L{ShowHelp}, -L{SpaceHandlers} dictionary. +B{New}: new var L{eventValue} for space handlers, L{Run}, L{UpdateMenus}, +new options to L{Get}, L{ShowHelp}, L{SpaceHandlers} dictionary. L{UnpackModes} dictionary. Blender @@ -34,7 +34,11 @@ Blender - for normal L{GUI<Draw.Register>} scripts I{during the events callback}, it holds the ascii value of the current event, if it is a valid one. Users interested in this should also check the builtin 'ord' and 'chr' - Python functions. + Python functions. +@type eventValue: int +@var eventValue: used only for EVENT space handlers, it holds the event value: + - for mouse button and key presses it's 1, for mouse movement + (Draw.MOUSEX and Draw.MOUSEY) it has the new x or y coordinate, resp. @type mode: string @var mode: Blender's current mode: - 'interactive': normal mode, with an open window answering to user input; diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py index 07942d58093..49cb14d1e66 100644 --- a/source/blender/python/api2_2x/doc/Object.py +++ b/source/blender/python/api2_2x/doc/Object.py @@ -552,6 +552,8 @@ class Object: @ivar transp: Enable transparent materials for the active object (mesh only). Also see B{TRANSP} bit in L{drawMode} attribute. @type transp: boolean + @ivar color: Object color used by the game engine and optionally for materials, 4 floats for RGBA object color. + @type color: tuple of 4 floats between 0 and 1 @ivar drawMode: The object's drawing mode bitfield. See L{DrawModes} constant dict for values. @type drawMode: int diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 7958e66b44f..7f88acd3a87 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -496,7 +496,7 @@ PyObject *RenderData_Render( BPy_RenderData * self ) tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); @@ -599,7 +599,7 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self ) BPY_do_all_scripts(SCRIPT_RENDER, 1); tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); |