Here are the results of calling .ls() on my actor:
PandaNode skeleton
Character __Actor_Fire_Hat
GeomNode (1 geoms: S:(MaterialAttrib))
Character __Actor_Character
GeomNode (2 geoms: S:(MaterialAttrib))
PandaNode head T:m(pos 0.0189913 6.47164 0.00643191 hpr -0.572898 -1.77025e-05 179.431) E:(CharacterJointEffect)
PandaNode head T:m(pos 0.018991 6.47164 0.006432 hpr -0.572967 0 179.431) E:(CharacterJointEffect)
There are my head joint nodes, all exposed as needed, but when I try and attach the hat to the head:
:Actor(warning): head not found!
Here is the code:
self.character.exposeJoint(None,"Character","head")
self.character.exposeJoint(None,"Fire_Hat","head")
self.character.ls()
self.character.attach("Fire_Hat", "Character", "head")
Looking at the Actor source, it looks like the joint only needs to be exposed. I can’t figure out why it isn’t working.
I can do this:
h=self.character.find("**/" + "head")
f=self.character.find("**/" + "__Actor_Fire_Hat")
f.reparentTo(h)
though the result isn’t quite what I’d like and I’m not sure it is the same as attach would do.
How can I use attach?
Edit: This results in what I want:
n=self.character.exposeJoint(None,"Character","head")
self.character.controlJoint(n,"Fire_Hat","head")
I’m sure I can work out an automated way to make all the bones on the subparts controlled by the bones of the same name on their parents in a recursive structure, but this seems like it will have a significant amount of overhead (lots of copies of lots of bones being controlled through lots of added node paths). Is there a better approach (perhaps I can make attach do this?)