fix Curve.update() method to use new DAG features.

This commit is contained in:
Stephen Swaney
2005-09-29 07:05:00 +00:00
parent f6c7cf7c13
commit c4b8a431bc
3 changed files with 26 additions and 8 deletions

View File

@@ -440,7 +440,8 @@ PyObject *Curve_Init( void )
{
PyObject *submodule;
Curve_Type.ob_type = &PyType_Type;
if( PyType_Ready( &Curve_Type) < 0) /* set exception. -1 is failure */
return NULL;
submodule =
Py_InitModule3( "Blender.Curve", M_Curve_methods,
@@ -1280,10 +1281,9 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * args )
PyObject *Curve_update( BPy_Curve * self )
{
freedisplist( &self->curve->disp );
Object_updateDag( (void*) self->curve );
Py_INCREF( Py_None );
return Py_None;
Py_RETURN_NONE;
}
/*

View File

@@ -116,10 +116,6 @@ static PyObject *M_Object_GetSelected( PyObject * self, PyObject * args );
/* HELPER FUNCTION FOR PARENTING */
static PyObject *internal_makeParent(Object *parent, PyObject *py_child, int partype, int noninverse, int fast, int v1, int v2, int v3);
extern int Text3d_CheckPyObject( PyObject * py_obj );
extern struct Text3d *Text3d_FromPyObject( PyObject * py_obj );
/*****************************************************************************/
/* The following string definitions are used for documentation strings. */
/* In Python these will be written to the console when doing a */
@@ -4077,3 +4073,23 @@ int setupPI(Object* ob){
return 0;
}
}
/*
* scan list of Objects looking for matching obdata.
* if found, set OB_RECALC_DATA flag.
* call this from a bpy type update() method.
*/
void Object_updateDag( void *data )
{
Object *ob;
if( !data)
return;
for( ob= G.main->object.first; ob; ob= ob->id.next){
if( ob->data == data){
ob->recalc |= OB_RECALC_DATA;
}
}
}

View File

@@ -57,6 +57,8 @@ Object *Object_FromPyObject( PyObject * py_obj );
int Object_CheckPyObject( PyObject * py_obj );
Object *GetObjectByName( char *name );
void Object_updateDag( void *data );
int EXPP_add_obdata( struct Object *object );
#endif /* EXPP_OBJECT_H */