FBX exporter bug [including fix]: missing linked in objects/meshes

i ran into this very annoying error while working with blenders FBX export to deliver assets to the Unity3D game engine:

how to reproduce it:

  • fire up blender 2.49 (or 2.52)
  • create a group containing a mesh in a blend file (file A) and save it.
  • create a file B and link in the group from file A (through blenders library system).
  • create multiple instances (>3) of that group in file B and try to export it to FBX.

what happens:
only some (like two) instances show up if you try to open this FBX file in maya or unity.

if you look at the FBX file (with an ordinary text editor), you’ll see that all objects are present, but have the very same name. therefore importing this FBX file causes trouble.

here’s the diff of a quick hack i did to avoid this problem (for 2.49):

.blender/scripts/export_fbx.py

2d1
< # -*- coding: utf-8 -*-
153,154c152,153
<       if num: return '%s%d' % (name, int(num)+1), int(num)+1
<       else:   return name + '_0', 0
---
>       if num: return '%s%d' % (name, int(num)+1)
>       else:   return name + '_0'
190,191c189
<       inc = None
<       while name in dct.itervalues(): name, inc = increment_string(name)
---
>       while name in dct.itervalues(): name = increment_string(name)
196,199c194
<               if inc is not None:
<                       dct['%s_%d' % (orig_name, inc) ] = name
<               else:
<                       dct[orig_name] = name
---
>               dct[orig_name] = name

clearly not a very nice, nor heavily tested solution, but it worked for me right now. just wanted to share.

maybe someone more experienced blender/python pro takes a look into this and comes up with a better solution that may also work for 2.5 (looking over to ideasman)?

have fun!

Please report these as bugs in the tracker, I try to fix bugs in our format support where possible before release but since there were no open bugs about FBX support I assumed it was working well.

Mango Jambo reported, fixed r2141. extensions repo.
https://projects.blender.org/tracker/index.php?func=detail&aid=28029&group_id=9&atid=498