find part of model from the Actor.


I generate normal mapping on a man model except his hair.
So I ignore a shader on the man’s hair.
See my code below, = loader.loadModel("man.bam")"**/hair").setShaderOff()

It’s thrown an error."**/hair").setShaderOff()
AssertionError: !is_empty() at line 3590 of panda/src/pgraph/nodePath.cxx

The egg file show as below.

<Group> character {
  <Dart> { 1 }
  <Group> hair {
    <VertexPool> hair.verts {
      <Vertex> 0 { .....

I search for the solution on this forum and see someone remove " { 1 }" to fix it.

<Group> character {
  <Group> hair {
    <VertexPool> hair.verts {
      <Vertex> 0 { .....

Then I remove " { 1 }" and it work. I can refer to the hair model.
But when I load this model as Actor.See the code below. = Actor()"man.bam"){'stand0' : "man_stand1.bam"})'stand0')"**/hair").setShaderOff()

The error appear.

:Actor(warning): man.bam is not a character!'stand0')
  File "C:\Panda3D-1.7.0\direct\actor\", line 1555, in loop
    for control in self.getAnimControls(animName, partName):
  File "C:\Panda3D-1.7.0\direct\actor\", line 1849, in getAnimControls
    allowAsyncBind = allowAsyncBind)
  File "C:\Panda3D-1.7.0\direct\actor\", line 2341, in __bindAnimToPart
    bundle = self.__commonBundleHandles[subpartDef.truePartName].getBundle()
KeyError: 'modelRoot'

But if I insert " { 1 }" as native egg file, it can loop animation without an error.
How can I loop an animation and find the part of model in the same egg(bam) file?
Or I has to modify the path in the “find()”'s parameter.

Please give me an advise.
Thanks in advance.

  • ola -

In my code I use something like this for Actors:


I think I got it from one of the example scripts. Give that a try.

Actually, I think this might just be because of the way I named the objects in my own EGG files, so it is probably not useful.


egg-optchar -o new.egg -flag hair=hair man.egg

to pre-process man.egg into new.egg, and flag the “hair” node for runtime access.


Thanks for your both reply.


The code above not work for me.
But very thank you for your advise.

The egg-optchar is work!

egg-optchar -d ./opt_char -flag hair=hair man.egg man_stand1.egg

Thank you very much!

  • ola -