Error when loading in AnimControl for an actor

I keep getting this error/warning when I try loading in the animation control for an actor. This is the warning:

:Actor(warning): couldn't find part: modelRoot

I am unsure as to what is causing this error, but what I am trying to do in this code is play the jump animation once all the way through when pressing the spacebar. So it would look kind of like this: spacebar -> jump, spacebar -> jump, etc. Here is the code I have so far for when I load in the actor:

    def __init__(self):
        # Attach camera and other objects to this custom root
        self.root = render.attachNewNode("Root");
        ...

    def loadToon(self):
        # Load in 3d body parts of the toon
        legs = Actor("phase_3/models/char/tt_a_chr_dgm_shorts_legs_1000");
        torso = Actor("phase_3/models/char/tt_a_chr_dgm_shorts_torso_1000");
        head = Actor("phase_3/models/char/tt_a_chr_dgm_shorts_head_1000");
        # Animations:
        self.body = Actor({'legs': legs, 'torso': torso, 'head': head},
                          {'legs': {"neutral": "phase_3/models/char/tt_a_chr_dgm_shorts_legs_neutral",
                                    "run" : "phase_3/models/char/tt_a_chr_dgm_shorts_legs_run",
                                    "jump" : "phase_3/models/char/tt_a_chr_dgm_shorts_legs_jump"},
                           'torso': {"neutral": "phase_3/models/char/tt_a_chr_dgm_shorts_torso_neutral",
                                     "run" : "phase_3/models/char/tt_a_chr_dgm_shorts_torso_run",
                                     "jump" : "phase_3/models/char/tt_a_chr_dgm_shorts_torso_jump"},
                           'head': {"neutral": "phase_3/models/char/tt_a_chr_dgm_shorts_head_neutral",
                                    "run" : "phase_3/models/char/tt_a_chr_dgm_shorts_head_run",
                                    "jump" : "phase_3/models/char/tt_a_chr_dgm_shorts_head_jump"}});
        # 'Attach' body parts together
        self.body.attach("torso", "legs", 'joint_hips');
        self.body.attach("head", "torso", 'def_head');
        # Put the toon on the screen / re-parent it to the custom root I have in the class
        self.body.reparentTo(self.root);
        # Play the toon's default animation
        self.body.loop('neutral');

Here is the code for when I try to call the animation control for the actor class:

        # I don't get an error here unless I press the spacebar. That error says:
        # AttributeError: 'NoneType' object has no attribute 'isPlaying'
        myJumpingAC = self.body.getAnimControl('jump');
        if(self.keyMap["space"]):
            if(not myJumpingAC.isPlaying()):
                self.body.stop();
                self.body.play("jump");

Sorry if this was a lot of code all at once. I just have no idea what could be causing the error. If anybody could point me in the right direction, I’d be glad to hear what you would have to say.

Multiple edits: corrected/updated some code I had. It still doesn’t work unfortunately.

It looks like AnimControl doesn’t exists when you haven’t played the animation yet. So “getAnimControl” just returns “None”.

1 Like

Thank you! Even a problem as simple as that and yet I couldn’t figure it out. Guess I need more practice when it comes to this!

Goodness, okay, also learning how to read documentation. I’ve fixed my errors now using this page in the Panda3d manual:
https://docs.panda3d.org/1.10/python/programming/models-and-actors/multi-part-actors