PDA

View Full Version : action_end_event and the mysterious viz.ActionData


vsully
09-23-2005, 12:19 AM
Hi,

I have an avatar, and when I issue it an action/animation to play I .unlock() the headbone to give the action access to the head. After, I've set up a action_end_event callback to .lock() the head again so other operations can apply their manual transformations.

However, the "action" parameter for the callback function is given a viz.ActionData object, and I can't find information on how to access this object's data. I'd like to know which action (id?) has just ended. Thoughts?

Oh yes. And one other problem is that <avatar>.execute() doesn't seem to trigger an action_end_event. Which is unfortunate, because .execute does a nice job of blending the animations, while .act() (which i'm currently using), does not. Other thoughts?

Thanks.

farshizzo
09-23-2005, 09:23 AM
Hi,

You are mixing the term action and animation together, when they are two separate concepts. Vizard comes with the ability to create high-level actions that can be added to any node object. Take a look in the documentation under the Actions section for more info. In addition to this, avatars have the low-level ability to play/blend built-in animations.

When you call <avatar>.act() it actually creates an action which will execute the animation and adds it to the avatar. For backwards compatiblity with older scripts, whenever an action is finished it stops the avatars current built-in animations. To get around this you could do the following:#Create an action that will execute animation 5
anim5 = vizact.animation(5)

#Add the action to the avatar on action pool 1
avatar.add(anim5,1)

def onactionend(obj,action,pool):
if action == anim5:
print 'Avatar has finished executing action 5'
avatar.callback(viz.ACTION_END_EVENT,onactionend)

The object anim5 is an instance of viz.ActionData which will be returned to all callback functions.

Hope this explains everything for you. I know that the documentation on this stuff is very sparse, so let me know if something is not clear.