Adds groupTarget get/setters to the NLA API. Takes an object and returns an

object. groupTarget tells the animation system which object within a
dupligroup should be used for NLA. Equivalent to filling in the "target"
field in the NLA N-key panel.

Set groupTarget to None to remove the target.

Also, cleaned up some bad copy and pastes in existing NLA docs.

Also, cleaned up some bad copy and pastes in existing NLA docs.
This commit is contained in:
2006-08-31 16:30:14 +00:00
parent 32c51f3338
commit 82b40b1fc4
2 changed files with 41 additions and 7 deletions

View File

@@ -907,6 +907,19 @@ static PyObject *ActionStrip_getStrideBone( BPy_ActionStrip * self )
return PyString_FromString( self->strip->stridechannel );
}
static PyObject *ActionStrip_getGroupTarget( BPy_ActionStrip * self )
{
if( !self->strip )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"This strip has been removed!" );
if (self->strip->object) {
return Object_CreatePyObject( self->strip->object );
} else {
Py_RETURN_NONE;
}
}
/*
* set the stride bone name
*/
@@ -926,6 +939,22 @@ static int ActionStrip_setStrideBone( BPy_ActionStrip * self, PyObject * attr )
return 0;
}
static int ActionStrip_setGroupTarget( BPy_ActionStrip * self, PyObject * args )
{
if( !self->strip )
return EXPP_ReturnIntError( PyExc_RuntimeError,
"This strip has been removed!" );
if( (PyObject *)args == Py_None )
self->strip->object = NULL;
else if( BPy_Object_Check( args ) )
self->strip->object = ((BPy_Object *)args)->object;
else
return EXPP_ReturnIntError( PyExc_TypeError,
"expected an object or None" );
return 0;
}
/*****************************************************************************/
/* Python BPy_Constraint attributes get/set structure: */
/*****************************************************************************/
@@ -969,6 +998,9 @@ static PyGetSetDef BPy_ActionStrip_getseters[] = {
{"strideBone",
(getter)ActionStrip_getStrideBone, (setter)ActionStrip_setStrideBone,
"Name of Bone used for stride", NULL},
{"groupTarget",
(getter)ActionStrip_getGroupTarget, (setter)ActionStrip_setGroupTarget,
"Name of target armature within group", NULL},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};

View File

@@ -166,17 +166,17 @@ class ActionStrips:
def __getitem__(index):
"""
This operator returns one of the constraints in the stack.
This operator returns one of the action strips in the stack.
@type index: int
@return: an Constraint object
@rtype: Constraint
@return: an action strip object
@rtype: ActionStrip
@raise KeyError: index was out of range
"""
def __len__():
"""
Returns the number of action strips for the object.
@return: number of Constraints
@return: number of action strips
@rtype: int
"""
@@ -185,8 +185,8 @@ class ActionStrips:
Appends a new action to the end of the action strip sequence.
@type action: L{Action<NLA.Action>}
@param action: the action to use in the action strip
@rtype: Constraint
@return: the new Constraint
@rtype: ActionStrip
@return: the new action strip
"""
def remove(actionstrip):
@@ -240,6 +240,8 @@ class ActionStrip:
@type strideLength: float
@ivar strideBone: Name of Bone used for stride
@type strideBone: string
@ivar groupTarget: Armature object within DupliGroup for local animation
@type groupTarget: object
@ivar blendIn: Number of frames of motion blending.
@type blendIn: float
@ivar blendOut: Number of frames of ease-out.
@@ -258,7 +260,7 @@ class ActionStrip:
def resetStripSize():
"""
Activates the functionality found in NLA Strip menu under "Reset Strip
Size". This method resets the Action Strip size to its creation values.
Size". This method resets the action strip size to its creation values.
@rtype: None
"""