KeyError: 'modelRoot'

I’m testing my models from Blender (models having been constructed and exported with/without animation). They’ve been exported to egg, bam and x.

I used the Roaming Ralph sample code and trimmed it down to the environment and actor loading codes and an animation loop.

Loading just the model, everything looks fine. Once I add the animation directory and the animation loop, I get this KeyError: ‘modelRoot’

self.sg = Actor("Models/ActorSG-fire.bam", {"walk":"Models/ActorSG-fire.bam"})
	self.sg.setScale(0.5,0.5,0.5)
	self.sg.setPos(0,5,0)
	self.sg.reparentTo(render)
	self.sg.loop("walk")

Without the last line, it loads and shows the model, but no animation. With the last line, I get the error.

Just some background on the models: It’s a LEGO figurine, made up of multiple parts. A armature is included with some parts attached to the bones of the armature. Animations have been done with the armature and exported.

I don’t know what’s causing this problem. I even tried exporting the models into egg, bam and x to see if it’s a format problem.

My thinking is either there’s a problem with Blender and Chicken R66 or there’s something wrong with my code.

Again, I copied the Roaming-Ralph code and just trimmed it down to the load model codes. I didn’t touch the import section.

Any help would be appreciate.

how exactly did you apply the mesh to your armature?
cause the only way that works is using the armature-modifier (when using the chicken exporter). parenting and or copy-position/rotations constraints on your lego block will not work.

export once more with chicken, see if there are any warnings from chicken.

I think the problem is that you loaded an animation file as model file.

Did you export model and animation into the same file? Or did you export them into separate files?

From start to finish: I imported the model, constructed an armature, set the constraints on the individual bones of the armature, then attach the meshes to its associated bone by selecting both mesh and the specific bone, press spacebar to pull up the menu, then click on Make Parent…->Bone.

No constraints were added to the meshes themselves.

I’ll try again. I don’t recall seeing a Armature-modifier in the Chicken exporter. I’m using R66 if that makes any difference.

I exported them together. I should make a correction here, must have copied the wrong code. I loaded ActorSG.bam as the actor and ActorSG-fire.bam as the animaton. In both models, mesh and armature were selected and exported together.

Perhaps I’m not fully understanding how that part works.

And both of those files really exist? If you mean you exported both into one file, you should omit the anim dictionary.

Let me clarify: I exported ActorSG.bam with mesh and armature. The bones of the armature had no animation. ActorSG-fire.bam was exported the same way but with animation in it.

So from what you’re saying, I should not export the armature? Or, I should not have animation exported (i.e. have no keyframes)?

doesnt make any difference. parented armatures simply wont work. the armature-modifier is the way to go :slight_smile:
btw. the armature-modifier is a modifier which works on the mesh and can be found in the editing panel(F9), tab “modifiers”.
constraints on bones should work,thought.

EDIT:fixed broken quotation tags

IMO you should change:

Actor.Actor("Models/ActorSG-fire.bam", {"walk":"Models/ActorSG-fire.bam"})

to:

Actor.Actor("Models/ActorSG.bam", {"walk":"Models/ActorSG-fire.bam"})

You include the same files as model without animation and animation file.

BTW I have the same problem, but IMO my file with animation is wrong exported. On the bottom i have:

<Table> animations {
}

Strange, all I see are Link and Materials, Armature, and Armature bones in Edit Mode . No modifier tab.

So if I understand you correctly, each bone should not have a parent? If so, that won’t work because my character’s hands are attach to it’s arm and if the hands don’t have a parent it won’t rotate with the arm.

Essentially, without this modifier tab that you speak of, it is unclear what I should do to resolve this issue.

Yeah, I pointed out that I posted the wrong code and I did write as you have posted.

So did you append this bottom code to your egg file? How did you solve your problem?

Double post (sorry):
I see the modifier now. I had the armature selected :blush: . I’ve seen this modifier before but was afraid to use it because with other animation software I used, if I attach a mesh to a armature, the armature deforms the mesh, which is not what I want to do with my rigid figurine.

So before I dive into this, should I clear all the parenting of mesh with bone, then use Armature as the modifier?

Yes. You can also find that information in the Chicken manual.

Well, using modifier solves the animation exporting problem, but I now return back to my original problem: I’m using multiple meshes, all of which must be rigid and not be deformed by the armature’s movement. Is there a way to solve this within Chicken R66’s restriction?

how about exporting your solid objects seperately. loading the armature into panda. and reparent the single pieces to the bones? a bit more initial effort but maybe worth to think it over. see the look and gripping example sample for how to attach objects to bones.

You can do it by weighting the vertices of each static object to be solely controlled by a single bone. (With no extra coding!)