*added new Object method Object.evaluatePose(frame)

- the new methods will advance an object's pose correctly to any frame

Example:
myobj = Blender.Object.Get('obert')
for x in range(10):
  myobj.evaluatePose(x)
  pose = myobj.getPose()
  print 'Data at Frame %d' % x
  for bone in pose.bones.values():
    print bone.head, bone.tail
    print bone.head, bone.tail
This commit is contained in:
2006-05-16 20:32:21 +00:00
parent d4ec63235a
commit bb69543fa9
2 changed files with 25 additions and 0 deletions

View File

@@ -215,6 +215,7 @@ static PyObject *Object_getType( BPy_Object * self );
static PyObject *Object_getBoundBox( BPy_Object * self );
static PyObject *Object_getAction( BPy_Object * self );
static PyObject *Object_getPose( BPy_Object * self );
static PyObject *Object_evaluatePose( BPy_Object * self, PyObject *args );
static PyObject *Object_isSelected( BPy_Object * self );
static PyObject *Object_makeDisplayList( BPy_Object * self );
static PyObject *Object_link( BPy_Object * self, PyObject * args );
@@ -347,6 +348,9 @@ If 'name_only' is nonzero or True, only the name of the datablock is returned"},
"Returns the object draw type"},
{"getAction", ( PyCFunction ) Object_getAction, METH_NOARGS,
"Returns the active action for this object"},
{"evaluatePose", ( PyCFunction ) Object_evaluatePose, METH_VARARGS,
"(framenum) - Updates the pose to a certain frame number when the Object is\
bound to an Action"},
{"getPose", ( PyCFunction ) Object_getPose, METH_NOARGS,
"() - returns the pose from an object if it exists, else None"},
{"isSelected", ( PyCFunction ) Object_isSelected, METH_NOARGS,
@@ -1243,6 +1247,20 @@ static PyObject *Object_getPose( BPy_Object * self )
#endif
static PyObject *Object_evaluatePose(BPy_Object *self, PyObject *args)
{
int frame = 1;
if( !PyArg_ParseTuple( args, "i", &frame ))
return EXPP_ReturnPyObjError( PyExc_AttributeError, "expected int argument" );
frame = EXPP_ClampInt(frame, MINFRAME, MAXFRAME);
G.scene->r.cfra = frame;
do_all_pose_actions(self->object);
where_is_pose (self->object);
return EXPP_incr_ret(Py_None);
}
static PyObject * Object_getPose(BPy_Object *self)
{
/*if there is no pose will return PyNone*/

View File

@@ -351,6 +351,13 @@ class Object:
@return: the current pose object
"""
def evaluatePose(framenumber):
"""
Evaluates the Pose based on its currently bound action at a certain frame.
@type framenumber: Int
@param framenumber: The frame number to evaluate to.
"""
def clearIpo():
"""
Unlinks the ipo from this object.