diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-09-20 14:30:10 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-09-20 14:30:10 +0400 |
commit | a12375cb4f8dd97b8985854486485a94a869a5f1 (patch) | |
tree | a8afe0f86c911e22ace9d69036e9e0ac75b5c54a /source | |
parent | 224607982ad664eaccfd703cff105eb6393b2d3e (diff) |
PyAPI - *.insertkey()
Updated insertkey calls in PyAPI so that they behave like the new common_insertkey() behaviour.
Diffstat (limited to 'source')
-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 | 88 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Pose.c | 29 | ||||
-rw-r--r-- | source/blender/python/api2_2x/World.c | 48 |
6 files changed, 158 insertions, 127 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 e8f45b82da4..5151fae8c65 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; 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/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); |