diff options
Diffstat (limited to 'source/blender/python/api2_2x/Lamp.c')
-rw-r--r-- | source/blender/python/api2_2x/Lamp.c | 28 |
1 files changed, 16 insertions, 12 deletions
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); |