Loading animations from .X file

Hey guys,
I know how to load animations from an egg file but I dont know how to do this for a .x file.

This is because the examples I saw had different .egg files for different animations.

A .x file puts it all into 1 file.

,ty in advance

Just load your file like this:

blah = Actor("blah.x")

Now you can just play the animation like blah.play(“animation name”)

ty,

…blah

Hey pro-rsoft,

I did what you said, heres my code:

#Animation Test
#This is an animationtest of a rly simple rigged character.

import direct.directbase.DirectStart
from direct.actor import Actor
import math


#Load model and animate on keypress
CubeDude = Actor.Actor("Cubeman.X")
CubeDude.setScale(0.75, 0.75, 0.75)
CubeDude.setPos(-8,42,0)
CubeDude.reparentTo(render)
CubeDude.loop("block")


run()

But still it just stands there… blah…

Hmm, did you get any warnings or errors on the commandline?
Are you sure the animation named “block” exists?

No I didn’t get any error and I’m sure the animation existed, I double checked it in the .X file

Should I post my project?
If so, what 3d app are you using?

Upload your .x file somewhere.

Here it is:
http://www.2shared.com/file/5293011/45a17dc3/Cubeman.html

Hmm, when I ran your model through “pview”, and hit A, I saw one animation - which was called “Cubeman”.
When I put “notify-level-chan info” in my Config.prc file, I could see this at the console, when pviewing the file:

:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 16 frames at 30 fps
:chan: Bind succeeded, index 0; accessible as Cubeman
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 27 frames at 30 fps
:chan: Bind succeeded, index 1; accessible as Cubeman.1
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 4 frames at 30 fps
:chan: Bind succeeded, index 2; accessible as Cubeman.2
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 6 frames at 30 fps
:chan: Bind succeeded, index 3; accessible as Cubeman.3
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 5 frames at 30 fps
:chan: Bind succeeded, index 4; accessible as Cubeman.4
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 6 frames at 30 fps
:chan: Bind succeeded, index 5; accessible as Cubeman.5
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 8 frames at 30 fps
:chan: Bind succeeded, index 6; accessible as Cubeman.6
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 33 frames at 30 fps
:chan: Bind succeeded, index 7; accessible as Cubeman.7
:chan: Attempting to bind CharacterJointBundle Cubeman to AnimBundle Cubeman, 40 frames at 30 fps
:chan: Bind succeeded, index 8; accessible as Cubeman.8

So, this means the animations are named Cubeman, Cubeman.1, Cubeman.2, Cubeman.3, Cubeman.4, Cubeman.5, Cubeman.6, Cubeman.7 and Cubeman.8.

Ty man now I can continue my research :slight_smile:
But it’s rly weird that it didn’t accepted my animation names, only the animation ranges. But whatever, I’m glad that I am able to acces it 8)