Object.c - made object action writable
gen_library - fixed bug, wasnt adjusting user counts properly. bpy_data.c - added default new names for new data
This commit is contained in:
@@ -267,32 +267,6 @@ PyTypeObject Modifier_Type = {
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
static int Modifier_set_object__internal(BPy_Modifier *self, PyObject *value, Object *ob, short type, short assign_self)
|
||||
{
|
||||
Object *ob_new=NULL;
|
||||
if (value == Py_None) {
|
||||
ob = NULL;
|
||||
} else if (BPy_Object_Check( value )) {
|
||||
ob = ((( BPy_Object * )value)->object);
|
||||
if( type != -1 && ob_new->type != type) {
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"this object is not a supported type" );
|
||||
}
|
||||
|
||||
if( !assign_self && ob == self->object )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"Cannot assign the object to its self" );
|
||||
*ob = *ob_new;
|
||||
} else {
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"Expected an Object or None value" );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Modifier methods: */
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -1167,6 +1167,11 @@ static PyObject *Object_getAction( BPy_Object * self )
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static int Object_setAction( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
return GenericLib_assignData(value, (void **) &self->object->action, 0, 1, ID_AC, 0);
|
||||
}
|
||||
|
||||
static PyObject *Object_evaluatePose(BPy_Object *self, PyObject *args)
|
||||
{
|
||||
int frame = 1;
|
||||
@@ -1326,9 +1331,7 @@ static PyObject *Object_getMaterials( BPy_Object * self, PyObject * args )
|
||||
|
||||
static PyObject *Object_getParent( BPy_Object * self )
|
||||
{
|
||||
if( self->object->parent )
|
||||
return Object_CreatePyObject( self->object->parent );
|
||||
Py_RETURN_NONE;
|
||||
return Object_CreatePyObject( self->object->parent );
|
||||
}
|
||||
|
||||
static PyObject *Object_getParentBoneName( BPy_Object * self )
|
||||
@@ -1404,9 +1407,7 @@ static PyObject *Object_getTimeOffset( BPy_Object * self )
|
||||
|
||||
static PyObject *Object_getTracked( BPy_Object * self )
|
||||
{
|
||||
if( self->object->track )
|
||||
return Object_CreatePyObject( self->object->track );
|
||||
Py_RETURN_NONE;
|
||||
return Object_CreatePyObject( self->object->track );
|
||||
}
|
||||
|
||||
static PyObject *Object_getType( BPy_Object * self )
|
||||
@@ -4746,7 +4747,7 @@ static PyGetSetDef BPy_Object_getseters[] = {
|
||||
"The bounding box of this object",
|
||||
NULL},
|
||||
{"action",
|
||||
(getter)Object_getAction, (setter)NULL,
|
||||
(getter)Object_getAction, (setter)Object_setAction,
|
||||
"The action associated with this object (if defined)",
|
||||
NULL},
|
||||
{"game_properties",
|
||||
|
||||
@@ -502,18 +502,18 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
|
||||
}
|
||||
|
||||
switch (self->type) {
|
||||
case ID_SCE:
|
||||
id = (ID *)add_scene( name );
|
||||
case ID_SCE:
|
||||
id = (ID *)add_scene( name?name:"Scene" );
|
||||
user_count = 1;
|
||||
break;
|
||||
case ID_OB:
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"Add objects through the scenes objects iterator" );
|
||||
case ID_ME:
|
||||
id = (ID *)add_mesh__internal( name );
|
||||
id = (ID *)add_mesh__internal( name?name:"Mesh" );
|
||||
break;
|
||||
case ID_CU:
|
||||
id = (ID *)add_curve( name, data_code );
|
||||
id = (ID *)add_curve( name?name:"Curve", data_code );
|
||||
if (data_code==OB_FONT) {
|
||||
Text3d *text3d = (Text3d *)id;
|
||||
text3d->vfont= get_builtin_font();
|
||||
@@ -527,17 +527,17 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
|
||||
} /*else { CURVE - Dont need to do anything } */
|
||||
break;
|
||||
case ID_MB:
|
||||
id = (ID *)add_mball( name );
|
||||
id = (ID *)add_mball( name?name:"MBall" );
|
||||
break;
|
||||
case ID_MA:
|
||||
id = (ID *)add_material( name );
|
||||
id = (ID *)add_material( name?name:"Material" );
|
||||
break;
|
||||
case ID_TE:
|
||||
id = (ID *)add_texture( name );
|
||||
id = (ID *)add_texture( name?name:"Texture" );
|
||||
break;
|
||||
case ID_IM:
|
||||
{
|
||||
id = (ID *)BKE_add_image_size(img_width, img_height, name, 0);
|
||||
id = (ID *)BKE_add_image_size(img_width, img_height, name?name:"Image", 0);
|
||||
if( !id )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
||||
"couldn't create PyObject Image_Type" ) );
|
||||
@@ -545,39 +545,39 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
|
||||
break;
|
||||
}
|
||||
case ID_LT:
|
||||
id = (ID *)add_lattice( name );
|
||||
id = (ID *)add_lattice( name?name:"Lattice" );
|
||||
break;
|
||||
case ID_LA:
|
||||
id = (ID *)add_lamp( name );
|
||||
id = (ID *)add_lamp( name?name:"Lamp" );
|
||||
break;
|
||||
case ID_CA:
|
||||
id = (ID *)add_camera( name );
|
||||
id = (ID *)add_camera( name?name:"Camera" );
|
||||
break;
|
||||
case ID_IP:
|
||||
id = (ID *)add_ipo( name, data_code );
|
||||
id = (ID *)add_ipo( name?name:"Ipo", data_code );
|
||||
break;
|
||||
case ID_WO:
|
||||
id = (ID *)add_world( name );
|
||||
id = (ID *)add_world( name?name:"World" );
|
||||
break;
|
||||
case ID_VF:
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"Cannot create new fonts, use the load() function to load from a file" );
|
||||
case ID_TXT:
|
||||
id = (ID *)add_empty_text( name );
|
||||
id = (ID *)add_empty_text( name?name:"Text" );
|
||||
user_count = 1;
|
||||
break;
|
||||
case ID_SO:
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"Cannot create new sounds, use the load() function to load from a file" );
|
||||
case ID_GR:
|
||||
id = (ID *)add_group( name );
|
||||
id = (ID *)add_group( name?name:"Group" );
|
||||
user_count = 1;
|
||||
break;
|
||||
case ID_AR:
|
||||
id = (ID *)add_armature( name );
|
||||
id = (ID *)add_armature( name?name:"Armature" );
|
||||
break;
|
||||
case ID_AC:
|
||||
id = (ID *)add_empty_action( name );
|
||||
id = (ID *)add_empty_action( name?name:"Action" );
|
||||
user_count = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,6 @@ class Object:
|
||||
L{action strips<NLA.ActionStrip>} for the object. Read-only.
|
||||
@type actionStrips: BPy_ActionStrips
|
||||
@ivar action: The action associated with this object (if defined).
|
||||
Read-only.
|
||||
@type action: L{Action<NLA.Action>} or None
|
||||
@ivar oopsLoc: Object's (X,Y) OOPs location. Returns None if object
|
||||
is not found in list.
|
||||
|
||||
@@ -181,7 +181,7 @@ short GenericLib_getType(PyObject * pydata)
|
||||
//~ if (BPy_Sound_Check(pydata)) return ID_SO;
|
||||
if (BPy_Group_Check(pydata)) return ID_GR;
|
||||
//~ if (BPy_Armature_Check(pydata)) return ID_AR;
|
||||
//~ if (BPy_Action_Check(pydata)) return ID_AC;
|
||||
if (BPy_Action_Check(pydata)) return ID_AC;
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -211,14 +211,17 @@ short GenericLib_getType(PyObject * pydata)
|
||||
*/
|
||||
int GenericLib_assignData(PyObject *value, void **data, void **ndata, short refcount, short type, short subtype)
|
||||
{
|
||||
ID *id=NULL;
|
||||
ID *id= NULL;
|
||||
|
||||
if (*data && ndata && *data == *ndata) {
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"Cannot set this data to its self" );
|
||||
|
||||
if (*data) {
|
||||
id = ((ID*)*data);
|
||||
|
||||
if (ndata && *data == *ndata) {
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"Cannot set this data to its self" );
|
||||
}
|
||||
}
|
||||
|
||||
if (value == Py_None) {
|
||||
*data = NULL;
|
||||
if (refcount && id) id->us--;
|
||||
|
||||
Reference in New Issue
Block a user