Index: source/blender/python/api2_2x/Object.c =================================================================== --- source/blender/python/api2_2x/Object.c (revision 13661) +++ source/blender/python/api2_2x/Object.c (working copy) @@ -169,6 +169,7 @@ EXPP_OBJ_ATTR_COLBITS, EXPP_OBJ_ATTR_DRAWMODE, EXPP_OBJ_ATTR_DRAWTYPE, + EXPP_OBJ_ATTR_EMPTYDRAWTYPE, EXPP_OBJ_ATTR_DUPON, EXPP_OBJ_ATTR_DUPOFF, EXPP_OBJ_ATTR_DUPSTA, @@ -347,6 +348,7 @@ static PyObject *Object_getDeltaLocation( BPy_Object * self ); static PyObject *Object_getDrawMode( BPy_Object * self ); static PyObject *Object_getDrawType( BPy_Object * self ); +static PyObject *Object_getEmptyDrawType( BPy_Object * self ); static PyObject *Object_GetEuler( BPy_Object * self, PyObject * args ); static PyObject *Object_getInverseMatrix( BPy_Object * self ); static PyObject *Object_getIpo( BPy_Object * self ); @@ -378,6 +380,7 @@ static PyObject *Object_setDeltaLocation( BPy_Object * self, PyObject * args ); static PyObject *Object_SetDrawMode( BPy_Object * self, PyObject * args ); static PyObject *Object_SetDrawType( BPy_Object * self, PyObject * args ); +static PyObject *Object_SetEmptyDrawType( BPy_Object * self, PyObject * args ); static PyObject *Object_SetEuler( BPy_Object * self, PyObject * args ); static PyObject *Object_SetMatrix( BPy_Object * self, PyObject * args ); static PyObject *Object_SetIpo( BPy_Object * self, PyObject * args ); @@ -488,6 +491,8 @@ "Returns the object draw modes"}, {"getDrawType", ( PyCFunction ) Object_getDrawType, METH_NOARGS, "Returns the object draw type"}, + {"getEmptyDrawType", ( PyCFunction ) Object_getEmptyDrawType, METH_NOARGS, + "Returns the empty draw type"}, {"getAction", ( PyCFunction ) Object_getAction, METH_NOARGS, "Returns the active action for this object"}, {"evaluatePose", ( PyCFunction ) Object_evaluatePose, METH_VARARGS, @@ -688,6 +693,9 @@ {"setDrawType", ( PyCFunction ) Object_SetDrawType, METH_VARARGS, "Sets the object's drawing type. The argument must be one of:\n\ 1: Bounding box\n2: Wire\n3: Solid\n4: Shaded\n5: Textured"}, + {"setEmptyDrawType", ( PyCFunction ) Object_SetEmptyDrawType, METH_VARARGS, + "Sets the empty's drawing type. The argument must be one of:\n\ +1: Arrows\n2: Plain axes\n3: Circle\n4: Single arrow\n5: Cube\n6: Sphere\n7: Cone"}, {"setEuler", ( PyCFunction ) Object_SetEuler, METH_VARARGS, "Set the object's rotation according to the specified Euler\n\ angles. The argument must be a vector triple"}, @@ -2222,6 +2230,20 @@ OB_BOUNDBOX, OB_TEXTURE, 'b' ); } +static PyObject *Object_getEmptyDrawType( BPy_Object * self ) +{ + return PyInt_FromLong( (long)self->object->empty_drawtype ); +} + +static int Object_setEmptyDrawType( BPy_Object * self, PyObject * value ) +{ + /* since we mess with object, we need to flag for DAG recalc */ + self->object->recalc |= OB_RECALC_OB; + + return EXPP_setIValueRange( value, &self->object->empty_drawtype, + OB_ARROWS, OB_EMPTY_CONE, 'b' ); +} + static int Object_setEuler( BPy_Object * self, PyObject * args ) { float rot1, rot2, rot3; @@ -3570,6 +3592,9 @@ case EXPP_OBJ_ATTR_DRAWTYPE: param = object->dt; break; + case EXPP_OBJ_ATTR_EMPTYDRAWTYPE: + param = object->empty_drawtype; + break; case EXPP_OBJ_ATTR_PARENT_TYPE: param = object->partype; break; @@ -4750,6 +4775,10 @@ (getter)getIntAttr, (setter)Object_setDrawType, "The object's drawing type", (void *)EXPP_OBJ_ATTR_DRAWTYPE}, + {"emptyDrawType", + (getter)getIntAttr, (setter)Object_setEmptyDrawType, + "The object's drawing type", + (void *)EXPP_OBJ_ATTR_EMPTYDRAWTYPE}, {"parentType", (getter)getIntAttr, (setter)NULL, "The object's parent type", @@ -5216,6 +5245,23 @@ return M; } +static PyObject *M_Object_EmptyDrawTypesDict( void ) +{ + PyObject *M = PyConstant_New( ); + + if( M ) { + BPy_constant *d = ( BPy_constant * ) M; + PyConstant_Insert( d, "ARROWS", PyInt_FromLong( OB_ARROWS ) ); + PyConstant_Insert( d, "PLAINAXES", PyInt_FromLong( OB_PLAINAXES ) ); + PyConstant_Insert( d, "CIRCLE", PyInt_FromLong( OB_CIRCLE ) ); + PyConstant_Insert( d, "SINGLE_ARROW", PyInt_FromLong( OB_SINGLE_ARROW ) ); + PyConstant_Insert( d, "CUBE", PyInt_FromLong( OB_CUBE ) ); + PyConstant_Insert( d, "EMPTY_SPHERE", PyInt_FromLong( OB_EMPTY_SPHERE ) ); + PyConstant_Insert( d, "EMPTY_CONE", PyInt_FromLong( OB_EMPTY_CONE ) ); + } + return M; +} + static PyObject *M_Object_ParentTypesDict( void ) { PyObject *M = PyConstant_New( ); @@ -5346,6 +5392,7 @@ PyObject *module, *dict; PyObject *DrawModesDict = M_Object_DrawModesDict( ); PyObject *DrawTypesDict = M_Object_DrawTypesDict( ); + PyObject *EmptyDrawTypesDict = M_Object_EmptyDrawTypesDict( ); PyObject *ParentTypesDict = M_Object_ParentTypesDict( ); PyObject *ProtectDict = M_Object_ProtectDict( ); PyObject *PITypesDict = M_Object_PITypesDict( ); @@ -5385,6 +5432,8 @@ PyModule_AddObject( module, "DrawModes", DrawModesDict ); if( DrawTypesDict ) PyModule_AddObject( module, "DrawTypes", DrawTypesDict ); + if( EmptyDrawTypesDict ) + PyModule_AddObject( module, "EmptyDrawTypes", EmptyDrawTypesDict ); if( ParentTypesDict ) PyModule_AddObject( module, "ParentTypes", ParentTypesDict ); if( PITypesDict ) @@ -5430,6 +5479,12 @@ (setter)Object_setDrawType ); } +static PyObject *Object_SetEmptyDrawType( BPy_Object * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, + (setter)Object_setEmptyDrawType ); +} + static PyObject *Object_SetMatrix( BPy_Object * self, PyObject * args ) { return EXPP_setterWrapper( (void *)self, args,