More things for easying the job of replacing proxy/working armatures in the scenes of Elephants Dream with the final ones: 1) adds removing Fakeusers from Actions to PyAPI, now with a hackish call in the Blender module. Possibility of better ways should be discussed on bf-python. 2) adds BPY Object.copyNLA(otherob) - that was simple 'cause the copy_nla function was nicely in kernel nla.c. 3) Object.convertActionToStrip(), here it gets tricky: the function to convert the active action of an object to a NLA strip was buried inside the respective function in the GUI editnla.c which had also code for reading mouse coordinates and whatnot. So I took the actual copying out of it and moved it to the kernel nla.c as a new function, bActionStrip *convert_action_to_strip (Object *ob). that code used other functions, of which find_stridechannel() was also in editnla.c but free of UI code so i moved it to kernel too. kept things with UI code in editnla.c. tried to be careful with keeping mallocs and the pointer business intact, and tested that this works and after usage Blender gives no memory warnings or anything, so seems ok - but certainly is best reviewed by ppl more active with c coding than me. hopefully this little refactor makes it possible to add this function to the menus too, which was not straightforward earlier when Matt took a look at it.
This commit is contained in:
@@ -63,6 +63,7 @@ struct rctf;
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_nla.h"
|
||||
|
||||
#include "BSE_editipo.h"
|
||||
#include "BSE_edit.h"
|
||||
@@ -298,6 +299,9 @@ static PyObject *Object_setSBUseEdges( BPy_Object * self, PyObject * args );
|
||||
static PyObject *Object_getSBStiffQuads( BPy_Object * self );
|
||||
static PyObject *Object_setSBStiffQuads( BPy_Object * self, PyObject * args );
|
||||
static PyObject *Object_insertShapeKey(BPy_Object * self);
|
||||
static PyObject *Object_copyNLA( BPy_Object * self, PyObject * args );
|
||||
static PyObject *Object_convertActionToStrip( BPy_Object * self );
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Object methods table: */
|
||||
/*****************************************************************************/
|
||||
@@ -565,8 +569,11 @@ works only if self and the object specified are of the same type."},
|
||||
"( ) - creates a new action with the information from object animations"},
|
||||
{"setConstraintInfluenceForBone", ( PyCFunction ) Object_setConstraintInfluenceForBone, METH_VARARGS,
|
||||
"( ) - sets a constraint influence for a certain bone in this (armature)object."},
|
||||
{"getAllProperties", ( PyCFunction ) Object_getAllProperties,
|
||||
METH_NOARGS,
|
||||
{"copyNLA", ( PyCFunction ) Object_copyNLA, METH_VARARGS,
|
||||
"( ) - copies all NLA strips from another object to this object."},
|
||||
{"convertActionToStrip", ( PyCFunction ) Object_convertActionToStrip, METH_NOARGS,
|
||||
"( ) - copies all NLA strips from another object to this object."},
|
||||
{"getAllProperties", ( PyCFunction ) Object_getAllProperties, METH_NOARGS,
|
||||
"() - Get all the properties from this object"},
|
||||
{"addProperty", ( PyCFunction ) Object_addProperty, METH_VARARGS,
|
||||
"() - Add a property to this object"},
|
||||
@@ -2531,6 +2538,23 @@ static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self, PyObje
|
||||
return ( Py_None );
|
||||
}
|
||||
|
||||
static PyObject *Object_copyNLA( BPy_Object * self, PyObject * args ) {
|
||||
BPy_Object *bpy_fromob;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "O", &bpy_fromob ) )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "requires a Blender Object to copy NLA strips from." ) );
|
||||
copy_nlastrips(&self->object->nlastrips, &bpy_fromob->object->nlastrips);
|
||||
|
||||
Py_INCREF( Py_None );
|
||||
return ( Py_None );
|
||||
}
|
||||
|
||||
static PyObject *Object_convertActionToStrip( BPy_Object * self ) {
|
||||
//when BPY gets a Strip type, make this to return the created strip.
|
||||
convert_action_to_strip(self->object);
|
||||
return EXPP_incr_ret_True (); //figured that True is closer to a Strip than None..
|
||||
}
|
||||
|
||||
static PyObject *Object_setLocation( BPy_Object * self, PyObject * args )
|
||||
{
|
||||
float loc1;
|
||||
|
||||
Reference in New Issue
Block a user