error on Multi-Part Actors

I am trying to use multi-part actors, but I keep getting this error:

File “game.py”, line 1738, in activate
{“ani”:“Models/plantStalk.egg”})
File “C:\Panda3D-1.5.2\direct\src\actor\Actor.py”, line 258, in init
self.loadModel(models[lodName], lodName=lodName, copy = copy)
File “C:\Panda3D-1.5.2\direct\src\actor\Actor.py”, line 1742, in loadModel
self.__prepareBundle(bundleNP, model.node(), partName, lodName)
File “C:\Panda3D-1.5.2\direct\src\actor\Actor.py”, line 1785, in __prepareBundle
self.__updateSortedLODNames()
File “C:\Panda3D-1.5.2\direct\src\actor\Actor.py”, line 549, in __updateSortedLODNames
self.__sortedLODNames.sort(sortFunc)
File “C:\Panda3D-1.5.2\direct\src\actor\Actor.py”, line 545, in sortFunc
return cmp(smap[y[0]], smap[x[0]])
KeyError: ‘s’

Here’s my code:

        self.plant01 =Actor({"stalk":"Models/plantStalk.egg","flower01":"Models/plantFlower01.egg",},
                            {"ani":"Models/plantStalkA.egg"})
        self.plant01.attach("stalk","flower01","bone_joint")

What might be the problem? Thanks

Looks like the manual was a little inaccurate. For a multi-part actor, the second parameter must be a dictionary of dictionaries, not just a simple dictionary. I’ve corrected the manual page.

Without a two-level dictionary in the second parameter, the actor code thinks you’re trying to create a multiple-LOD actor, not a multipart actor. And it’s making some assumptions about the names of your different LOD’s (which in your case aren’t LOD’s anyway).

Note that multi-part actors are pretty complicated to set up and difficult to get right.

David

You could say that again.
With this code my flower model should now be standing on top of my stalk model, since the top bone of my stalk is named ‘bone_joint’, and the botom bone of my flower carries the same name. Instead though, both are at the same level, and position.

        self.plant01 =Actor({"stalk":"Models/plantStall.egg","flower01":"Models/plantFlower01.egg",},
                            {"stalk":{"aniStalk":"Models/plantStalk.egg"},"flower01":{"aniFlower":"Models/plantFlower01A.egg"}})
        self.plant01.attach("flower01","stalk","bone_joint")

How difficult is difficult? 80% difficult, or can I get it done with a bit of understanding of what is in the manual?

You can certainly do it. It’s just that there are lots of ways for things to go wrong, and it’s not always easy to figure out why.

In this case, since your flower bloom isn’t inheriting the animation, it must mean that either (a) the bloom is not parented to the joint node properly by the attach() method, or (b) the joint node is not showing the animation properly.

You can use actor.ls() to visually check the scene graph hierarchy and make sure that it’s parented properly, to test (a).

To test (b), try loading a normal, single-part actor and parenting any old node (like a cube.egg) to the joint node in question. Does it animate? If not, are you sure that particular joint actually does have animation? Presumably you’ve already exposed the joint in question (or there wouldn’t even be a joint node to attach to), right?

David

I haven’t had a chance to try out you suggestion yet, but thanks.