Auto_bind renaming animations

Hello all,

I’m going through the documentation and learning Panda3D, so excuse my ignorance - but I ran into an issue while following loading-actors where when I run auto_bind, it renames all the loaded animation to panda_walk_character instead of the name of the file. My solution so far has been to rename the file to panda_walk_character and ignore the problem, but I want to understand why this is happening and what I can do to fix it.

void load_animation(WindowFramework* window, const std::string& animation_path) {
        window->load_model(actorNodePath, animation_path);
        auto_bind(actorNodePath.node(), animCollection);
}

When this runs, and I run a for loop giving me the names of all animations in animCollection, regardless of animation_path I get panda_walk_character. If I add multiple animations, the next will become panda_walk_character.1, panda_walk_character.2, and so on…

edit: I should mention I’m using the prebundled “panda-model” and trying to load the “panda-walk4” animation.

Thank you!

Hi, welcome to the community!

The name that’s used is the name associated with the AnimBundle object, not the name of the file, with the name uniquified if it already occurs in the AnimControlCollection.

If you need to specifically identify the animation with auto_bind, you can use model.find("**/+AnimBundleNode") and set the name on the AnimBundle before calling auto_bind.

Alternatively, instead of calling auto_bind, you can manually load the animation using something like this:

NodePath char_path = model.find("**/+Character");
Character *char = DCAST(Character, char_path.node());
PartBundle *bundle = char->get_bundle(0);
Loader *loader = Loader::get_global_ptr();
PT(AnimControl) control = bundle->load_bind_anim(loader, animation_path, 0, PartSubset(), false);
1 Like

This worked, thank you very much!