# Blender 2.8 Exporter Error

**URL:** <https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071>\
**Category:** Questions\
**Created:** [May 8, 2019, 3:47pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071 "2019-05-08T15:47:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 8, 2019, 3:47pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/1 "2019-05-08T15:47:35Z")

</div>

So I ended up with a situation where I needed to add a few more bones to my rig in blender.

I subdivided the armatures that were needed deleted the old modifiers and vertex groups then re-skinned the mesh weights.

I have done this in the past no problem, but now its acting up on export. I have verified that the bone exists…

```auto
========= An error was encountered =========
  File "C:\Users\pryme\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\json_exporter.py", line 94, in execute
    self.skeletons.append(Skeleton(object, context, skeletonId, self.settings.ignoreIKBones))
  File "C:\Users\pryme\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\armature.py", line 84, in __init__
    self.bones.append(Bone(bone, bpySkeleton, self.bones))
  File "C:\Users\pryme\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\armature.py", line 23, in __init__
    self.parentBoneIndex = Skeleton.get_bone(bpyBone.parent.name, bonesSoFar).index if bpyBone.parent else -1
  File "C:\Users\pryme\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\babylon_js\armature.py", line 162, in get_bone
    raise Exception('bone name "' + boneName + '" not found in skeleton')
ERROR: bone name "Lower.Thigh.L" not found in skeleton
========= end of processing =========

```

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 8, 2019, 4:14pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/2 "2019-05-08T16:14:25Z")

</div>

**UPDATE**  
so I have narrowed it down to the fact that I subdivided the bone… let me see if I can recreate!

**UPDATE2**  
maybe I spoke too soon… hmmm… I was not able to recreate in a simple setup.  
In the exporter I see

```auto
# should not happen, but if it does clearly a bug, so terminate

```

o\_O…

**UPDATE3**

So I added to the line right before the Error Drop:

```auto
for bone in bones:
            Logger.log("Bone:"+bone.name)

```

Which made the log output be:

```auto
Python World class constructor completed
	processing begun of skeleton: Root, id: 0
		processing begun of bone: Crotch, index: 0
		processing begun of bone: Upper.Thigh.L, index: 1
		processing begun of bone: Upper.Calf.L, index: 2
	Bone:Crotch
	Bone:Upper.Thigh.L
========= An error was encountered =========
...

```

I think its interesting that it says its trying to process the calf at index 2. Is there a way to verify the index of the each of the bones? I would imagine that is just done through hierarchy.

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 8, 2019, 7:13pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/3 "2019-05-08T19:13:57Z")

</div>

For something like this, a Blend file is definitely going to be required. It could be an un-forseen bug, but if I put a comment that says this should not happen, probably better to address the skeleton than screw with the program. There could then be other assumptions you run a foul of. I would not be able to look at it for maybe a week. Do not know if @gryff is interested, or could look at it earlier than that.

FYI, the index thing has nothing to do with Blender. It is for the export. This is the values which get placed in the matrix indices for each vertex of each mesh. means nothing to Blender. Bones are processed however Blender gives them to me. Program does not care.

---

<div class="post-metadata">

**Author:** ![gryff](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gryff/32/1855_2.png) [@gryff](https://forum.babylonjs.com/u/gryff)\
**Post date:** [May 9, 2019, 6:06am UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/4 "2019-05-09T06:06:31Z")

</div>

@JCPalmer : if @Pryme8 wants to post the .blend file, I will take a look at it Jeff. But if it is a code issue, then I might not find anything as I can’t compete with you guys in that area 🙃

cheers, gryff 🙂

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 9, 2019, 12:33pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/5 "2019-05-09T12:33:08Z")

</div>

Thanks, but maybe his surgery resulted in some odd thing like multiple root bones. Though that should still work, any triage you can do would be helpful.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 9, 2019, 3:48pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/6 "2019-05-09T15:48:26Z")

</div>

Ill send it over Gryff thanks! I have a suspicion I found a bug.

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 9, 2019, 6:05pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/7 "2019-05-09T18:05:02Z")

</div>

Looked at code. Processing getting the parent index of bones in a separate Loop. Should probably be ok now.

---

<div class="post-metadata">

**Author:** ![gryff](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gryff/32/1855_2.png) [@gryff](https://forum.babylonjs.com/u/gryff)\
**Post date:** [May 9, 2019, 11:47pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/8 "2019-05-09T23:47:16Z")

</div>

@Pryme8 and @JCPalmer : So has the issue been fixed, as I see no link to a file? You can always PM me the link, if you are worried about ppl stealing your character.

cheers gryff 🙂

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 9, 2019, 11:54pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/9 "2019-05-09T23:54:44Z")

</div>

I will pm you the stuff, taking the day off. Ill get at you tomorrow for sure though.

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 9, 2019, 11:59pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/10 "2019-05-09T23:59:08Z")

</div>

I fixed it without the file. @Pryme8 get latest exporter.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 10, 2019, 5:35am UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/11 "2019-05-10T05:35:26Z")

</div>

So it twas a bug?

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 10, 2019, 12:29pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/12 "2019-05-10T12:29:33Z")

</div>

I have no idea. After looking at the code, I just recoded for the only thing it could possibly be.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 10, 2019, 3:39pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/13 "2019-05-10T15:39:01Z")

</div>

Cool Ill take a look on git to see what code has changed, and then make sure I incorporate my mesh.py changes in.

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 10, 2019, 3:58pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/14 "2019-05-10T15:58:30Z")

</div>

I was really disappointed with what github [did](https://github.com/BabylonJS/Exporters/commit/e8473d0cbdd6cb797e9fb0115184178269ae8d33). It deleted every line and then added them all back. Here are the changes to Bone & Skeleton from Netbeans (old on left). Basically, I pulled finding the index of the parent out of the Bone constructor. This relied on Blender ordering the bones of a parent before children.

 ![bone_diff](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/a/a3574b7f505f7c621a0284b6ad92f5abca2de727.jpeg)

 ![skel_diff](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/1/115935b302c47cfc5c6b2287159054d6cf23578e.jpeg)

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 11, 2019, 4:46am UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/15 "2019-05-11T04:46:17Z")

</div>

That makes total sense. Thank you for the fix!

Also I have noticed git does that a lot, I wish I knew how to not make it do that as well sometimes. About to test it now, but from just reading it seems on point. @JCPalmer Thank you a lot for your help my friend.

**UPDATE**  
Looks like it worked!  
dope, I should push my vertex group changes here at some point too to the exporters. As it is it does not add anything to the file (for file size reason), but if you told told the exporter in a menu item to export specific groups on the mesh it will have them listed in json format in the log, which are useful for lots of reason.

Figured there would be others that might need this.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 13, 2019, 9:54pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/16 "2019-05-13T21:54:54Z")

</div>

**UPDATE**

Everything seems to work, except now if I scale a skeleton from the root bone and let all the “children” be scaled

```auto
bone = scene.getBoneByName('Crotch')					
bone.scale(d,d,d,true)

```

Basically what happens now is all the bones but the ones that were added through subdivision do not get scaled now, I don’t even know where to start debugging this. @JCPalmer I know you are a busy man but any ideas where I can look?

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/9/9975b11950148953e3ddd57a0d015bd3e6f6bf79.png)

I am able to manipulate them with

```auto
bone.scale(weight.x,weight.y,weight.z,false)

```

Directly, but anytime I add the children flag the later added bones freak out.

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 13, 2019, 10:30pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/17 "2019-05-13T22:30:16Z")

</div>

Start with the obvious check that every bone has a parent. What if it is expected in a. Babylon file that parents are listed first?

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 13, 2019, 11:16pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/18 "2019-05-13T23:16:12Z")

</div>

They are coming back with parent as null and \_parent as the correct value, once in the scene.

In the .babylon file all the parent indexes are correct.

I really don’t want to have to do a re-rig but at this point it sounds like I need to, if we cant figure out this hierarchy problem. (at some point it should be figured out though cause Im pretty sure its a bug)

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 14, 2019, 2:53pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/19 "2019-05-14T14:53:15Z")

</div>

I just got what you were saying, so maybe I need to reorder the skeleton list in the .babylon file?

And now looking at the files I think you are 100% right… in a working one the bones are parents are listed before the children on the bones list and in the unworking one I have like bone ID 3 referencing bone ID 43 are its parent.

So I am guessing what I would need to do is a pass where I increment through the bones and order them correctly by referencing their parent?

```auto
	bone.index:0 bone.parentBoneIndex:-1
	bone.index:1 bone.parentBoneIndex:0
	bone.index:2 bone.parentBoneIndex:42
	bone.index:3 bone.parentBoneIndex:44
	bone.index:4 bone.parentBoneIndex:3
	bone.index:5 bone.parentBoneIndex:3
	bone.index:6 bone.parentBoneIndex:44
	bone.index:7 bone.parentBoneIndex:0
	bone.index:8 bone.parentBoneIndex:7
	bone.index:9 bone.parentBoneIndex:8
	bone.index:10 bone.parentBoneIndex:9
	bone.index:11 bone.parentBoneIndex:10
	bone.index:12 bone.parentBoneIndex:11
	bone.index:13 bone.parentBoneIndex:12
	bone.index:14 bone.parentBoneIndex:11
	bone.index:15 bone.parentBoneIndex:14
	bone.index:16 bone.parentBoneIndex:46
	bone.index:17 bone.parentBoneIndex:47
	bone.index:18 bone.parentBoneIndex:17
	bone.index:19 bone.parentBoneIndex:18
	bone.index:20 bone.parentBoneIndex:17
	bone.index:21 bone.parentBoneIndex:20
	bone.index:22 bone.parentBoneIndex:17
	bone.index:23 bone.parentBoneIndex:22
	bone.index:24 bone.parentBoneIndex:11
	bone.index:25 bone.parentBoneIndex:24
	bone.index:26 bone.parentBoneIndex:48
	bone.index:27 bone.parentBoneIndex:49
	bone.index:28 bone.parentBoneIndex:27
	bone.index:29 bone.parentBoneIndex:28
	bone.index:30 bone.parentBoneIndex:27
	bone.index:31 bone.parentBoneIndex:30
	bone.index:32 bone.parentBoneIndex:27
	bone.index:33 bone.parentBoneIndex:32
	bone.index:34 bone.parentBoneIndex:10
	bone.index:35 bone.parentBoneIndex:10
	bone.index:36 bone.parentBoneIndex:0
	bone.index:37 bone.parentBoneIndex:43
	bone.index:38 bone.parentBoneIndex:45
	bone.index:39 bone.parentBoneIndex:38
	bone.index:40 bone.parentBoneIndex:38
	bone.index:41 bone.parentBoneIndex:45
	bone.index:42 bone.parentBoneIndex:1
	bone.index:43 bone.parentBoneIndex:36
	bone.index:44 bone.parentBoneIndex:2
	bone.index:45 bone.parentBoneIndex:37
	bone.index:46 bone.parentBoneIndex:15
	bone.index:47 bone.parentBoneIndex:16
	bone.index:48 bone.parentBoneIndex:25
	bone.index:49 bone.parentBoneIndex:26

```

above is the output of the order and parent indexes as is.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 14, 2019, 4:39pm UTC](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071/20 "2019-05-14T16:39:36Z")

</div>

Actually as I am doing more testing its looking like these last changes broke the skeleton stuff… I mean it works but it does not now when you start working with them.

I did a whole rerig, and am having troubles with some of the same issues but in a different way now.

Ill do one more re-rig, but I’m pretty sure anytime you get into an complex parenting things go haywire.

[Next page](https://forum.babylonjs.com/t/blender-2-8-exporter-error/3071.md?page=2)
