KeyError: 'modelRoot' - Animation Issues


#1

I’m aware of the other post of the same name, but that post was talking about the chicken exporter, which requires Blender 2.4, which doesn’t export FBX files. So the information there about the “armature-modifier” doesn’t apply to me as far as I know.

I’ve been able to import a 3D model, but now I’m trying to import an animation. I’m very new to 3D modelling and animation in general, so I don’t exactly know how to export properly and I’ve been winging it up until this point.

I used pip install to install a development version of Panda3D, because I wanted to use Python 3. I also have the latest version of Blender (2.79b) for model exporting.

My export process for the model (basic-person.egg):

  • Create model in Asset Forge, export as FBX
  • Asset Forge exports to ASCII FBX, which Blender can’t import, so I need to convert to binary using Autodesk FBX converter
  • Import model in Blender, select everything by pressing A, export as .x file (YABEE will only export the model untextured for me)
  • Convert to .egg using x2egg

Export process for animation (walking.egg):

  • Import binary converted FBX to Mixamo, create animation
  • Export as pure FBX (not the Unity option)
  • Import to Blender, select everything, export to .x, convert to .egg

In code, I’m just trying to create an Actor using this line of code:

self.pandaActor = Actor("models/basic-person.egg", {"walk": "models/walking.egg"})

And then animating the model using:

self.pandaActor.loop("walk")

Both lines are in the same class called MyApp.

Here’s the full output after running main.py:

Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
:Actor(warning): models/basic-person.egg is not a character!
Traceback (most recent call last):
  File "main.py", line 55, in <module>
    app = MyApp()
  File "main.py", line 35, in __init__
    self.pandaActor.loop("walk")
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\direct\actor\Actor.py", line 1567, in loop
    for control in self.getAnimControls(animName, partName):
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\direct\actor\Actor.py", line 1861, in getAnimControls
    allowAsyncBind = allowAsyncBind)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\direct\actor\Actor.py", line 2361, in __bindAnimToPart
    bundle = self.__commonBundleHandles[subpartDef.truePartName].getBundle()
KeyError: 'modelRoot'

(ignore the “not a character” warning, the model appears regardless, though I’d like to know why!)

I’ve just about googled everything I could think of. Any suggestions are appreciated.


#2

This error generally indicates that the model was not a character, and therefore cannot be loaded as Actor. The armature information may have gotten lost somewhere along the conversion line.

It would be better to figure out what issue you were running into with YABEE, since YABEE produces more reliable results than exporting via .x. If you could attach your .blend file, that would be great. Otherwise, can you describe to us how your materials are set up? (Note that Cycles materials are not supported via YABEE). Furthermore, please open the .egg file in a text editor and check whether there are any <Texture> references near the top of the file.


#3

I have .blend files, but I can’t upload them yet since I’m a new user.

All I can say about how the materials is that they are just flat colors painted onto each object. Here’s an image of the model in Blender, if that helps: https://i.imgur.com/UxuxAQd.png

(I can fix the glitchy leg, so don’t worry about that. Just making sure everything works in Panda3D first)

Note that I painted the model in Asset Forge not Blender, I don’t know if that makes a difference.


#4

EDIT: Uploaded my .blend files online. Here’s a link to them both:
Model: https://ufile.io/oeuaq
Animation: https://ufile.io/1j0bx


#5

I see you have assigned the colours as material colours. Have you assigned a light in Panda3D? A material describes how light bounces off the surface of the object, so you need a light in order to be able to see the material.


#6

I have not, I’m just adjusting the hello world project from the manual to load my own models. I didn’t think that lighting mattered though, since the base model is textured anyway: https://i.imgur.com/t8HIDfp.png

To reiterate, the only problem I’m getting at the moment is that I can’t play the “walking.egg” animation. I can load them into the game just fine (or at least, I don’t get any errors), but as soon as self.pandaActor.loop(“walk”) is run, the game crashes.


#7

With YABEE? I just loaded up walking.egg in Blender, and exported it via YABEE to two .egg files, and applied a light to the scene, and both the animation and colour show up for me. For testing, you can specify both files on the ‘pview.exe’ command-line, and press A to see the animation panel and L to enable a light.

Note that when you export walking.egg via YABEE, you get two egg files: one for the base mesh and one for each animation you defined (either as Actions or by defining them with start/end frame in the exporter panel). The base mesh would by default be exported as walking.egg, and the animation as walking-{anim-name}.egg, so if you don’t rename them they would be loaded as:

self.pandaActor = Actor("models/walking.egg", {"walk": "models/walking-Anim0.egg"})

#8

Got it working! I have only myself to blame for leaving all the YABEE export settings as default and expecting everything to fall into place.

In case anyone else finds this, when you export to .egg from Blender make sure that you uncheck “All actions as animations” in the export settings. This will show a little menu where you can add animations and change selected frames to match the animation, as well as how fast the animation plays with the FPS setting. When you hit export, you will see your main .egg file that holds the model, as well as however many animation .egg files you added in the export settings.

Also make sure you check the “Separate animation files” checkbox so that you get the animation files separately.

Thanks @rdb for the help!

EDIT: Forgot to mention that adding a light to the scene indeed gives the model its color, even if it looks untextured without lighting.