maya animation

Hi.
I really though that I will never ask this question.

I have a problem with animations in panda3d.
I follow the tutorial manual in this case, and export my mesh from Maya with the animation included ( since I want to have only one basic animation per object, I won’t think that matter ).

But inside panda, it seems impossible to get it working. getActorInfo get me no animation, so I though that the problem came from the Maya part/export.

Can anyone tell me if the mesh is wrong, or the method ?

from direct.actor.Actor import Actor
foo = Actor('moulin.egg')
bar = Actor('moulin.egg', {'test':'moulin.egg'}
print foo.getActorInfo()
>> []
print bar.getActorInfo()
>> []

I also try loop() and loop(‘test’) with no visible result.

the mesh:
rapidshare.com/files/258629479/moulin.egg.html

Works fine for me. You can also check it by viewing the model with pview. Are you sure you specified the correct path to your egg file? Did you get any error messages from the Actor constructor?

David

I get zero error from Actor ( I was in a pdb ).

Even If I try actor.loop(‘non-existant animation’) which is weird,…

It doesn’t necessarily raise an exception, but it prints out stuff to the console, whether it successfully loads or not. For instance, I get:

>>> a = Actor('/Users/drose/Downloads/moulin.egg')
:loader: loading file type module: ptloader
:egg2pg: Reading /Users/drose/Downloads/moulin.egg
:chan: Attempting to bind CharacterJointBundle moulin to AnimBundle moulin, 25 frames at 24 fps
:chan: Part moulin has 1 children, while matching anim node has 2:
:chan:   anim has morph, not in part.
:chan: Bind succeeded, index 0; accessible as moulin
:Actor: model contains 1 animations.
>>> a.getActorInfo()
[['lodRoot', [['modelRoot', CharacterJointBundle moulin, [['moulin', None, AnimControl(moulin, moulin: pose, frame 0)]]]]]]
>>> a.pprint()
LOD: lodRoot
  Part: modelRoot
  Bundle: CharacterJointBundle moulin
    Anim: moulin
      File: None
      NumFrames: 25 PlayRate: 1.00

David

Ah, also, you probably don’t want to do this from within a pdb shell. That shell can quietly eat certain commands, which makes things very confusing. If you pick a variable name that happens to be a pdb command, it just looks like nothing happened.

David

thank for the advice.

I can get the animation to work, but it’s very strange:

(Pdb) from direct.actor.Actor import Actor
(Pdb) act = Actor('moulin1.egg')
(Pdb) act.getActorInfo()
[['lodRoot', [['modelRoot', CharacterJointBundle moulin1, [['moulin1', None, AnimControl(moulin1, moulin1: pose, frame 0)]]]]]]
(Pdb) act.setPos(0,0,0)
(Pdb) act.reparentTo(render)
(Pdb) act.loop('moulin1')

get The animation to run one time

(Pdb) from direct.actor.Actor import Actor
(Pdb) act = Actor('moulin1.egg', {'turn':'moulin1.egg'})
(Pdb) act.setPos(0,0,0)
(Pdb) act.reparentTo(render)
(Pdb) act.loop('moulin1')

doesn’t display any animation

(Pdb) from direct.actor.Actor import Actor
(Pdb) act = Actor('moulin1.egg', {'turn':'moulin1.egg'})
(Pdb) act.getActorInfo()
[['lodRoot', [['modelRoot', CharacterJointBundle moulin1, [['turn', 'moulin1.egg', None], ['moulin1', None, AnimControl(moulin1, moulin1: pose, frame 0)]]]]]]
(Pdb) act.setPos(0,0,0)
(Pdb) act.reparentTo(render)
(Pdb) act.loop('moulin1')

work perfectly

It’s probably because I’m in a pdb surely but,…

In your second case, you are requesting the Actor to load the first animation found in ‘moulin1.egg’ and call it ‘turn’, which means that is the only animation you have bound to your Actor, so it’s not surprising that it doesn’t play anything when you try to play ‘moulin1’, a non-existent animation.

Surely something about the way you are running is eating your console output, causing you to miss all the helpful error messages the Actor is no doubt giving you. Why are you running in a pdb shell in the first place? Can’t you just run python interactively?

David

ok, tested in a python console :

from direct.directbase import DirectStart
from direct.actor.Actor import Actor
act = Actor('moulin1.egg')
act.setPos(0,0,0)
act.reparentTo(render)
act.loop('moulin1')
run()

works.

I’m starting to hate my pd,… ( it was so useful to try it exactly where I needed it,…)

Sorry for the inconvenience.

Hi.
So It wasn’t pdb the problem…

I try to place the code where it should be. Impossible to get any animation.
I use the part of the code above that still work in a python console.

Each time the mesh is displayed but without any animation.
getActorInfo get me the same thing that in the console.

Is there any change in window Properties, task manager,… that I could have forget / put in other part of the code that block animations ?

I changed my config .prc to get more info:

notify-level info
default-directnotify-level info

now I get this when creting the Actor:

:chan: Attempting to bind CharacterJointBundle moulin1 to AnimBundle moulin1, 25 frames at 24 fps
:chan: Part moulin1 has 1 children, while matching anim node has 2:
:chan:   anim has morph, not in part.
:chan: Bind succeeded, index 0; accessible as moulin1
:Actor: model contains 1 animations.

but still nothing if I try to to a

actor.loop('non_existant_animation')

Hmm, you’re right, there’s no error message if you try to loop a non-existent animation. That’s a minor bug, it should at least say something.

Other than that, what response did you expect? If you want to play your bound animation above, you should loop(‘moulin1’).

David

Arf!

I mean I do

mesh = Actor('moulin.egg')
mesh.reparentTo(render)
mesh.setPos(0,0,0)
mesh.loop('moulin')

where I used to import my meshes.

But doesn’t get any animation.
The same code work independently, in a console, so I assume that I have something changed in the config.prc, window properties or you-tell-me that interfere with animation.

I can’t think of any option that globally disables animation. There must be something else going wrong. Is it possible that you’re loading a different egg file in this second case?

Ah! I think I know what the problem is. If you’re not saving a pointer to your Actor object, its animation will stop when it destructs. So you should save it with something like:

self.mesh = Actor('moulin.egg')
self.mesh.reparentTo(render)
self.mesh.setPos(0,0,0)
self.mesh.loop('moulin')

David

ok, thank again.

The first problem was that you said. I wouldn’t believe it because at first I was storing the mesh.

Then I remember that I haven’t try it with fixed name:
I used:

self.meshtest = Actor(self.path) # == 'moulin.egg'
self.meshtest.reparentTo(render)
self.meshtest.setPos(0,0,15)
self.meshtest.loop(self.name) #=='moulin1'

But with directly the string, that’s works.

When I tried again the code above, that wasn’t working anymore.

Then I understand.
All our meshes uses unicode string. It seems that panda3d don’t like them. ( self.meshtest.loop(str(self.name)) works )

So this part works.

But could I ask why the unicode string aren’t working ? Can’t panda does this “str(parameter_string)” just to be sure ?

Ah, that’s a good one! Another bug. In general, Panda does support unicode strings throughout. But there’s a minor bug in Actor.py. It uses the code:

if isinstance(animName, types.StringType):
    # A single animName
    animNameList = [animName]
else:
    # A list of animNames, or True to indicate all anims.
    animNameList = animName

to determine if you’ve passed it a single animName, or a list of animNames. The bug is that it checks only if animName is an instance of types.StringType, which doesn’t include unicode objects. The fix is to check against types.StringTypes instead. I’ll make that fix immediately; if you like, you can make the same fix in your own version of Actor.py.

David