I'm writing an exporter for Blender, and I ran into a small problem - when I export the same model multiple time, the mesh that gets exported is always assigned a different name ( a numeral prefix is added ).
This is the code I use to access the mesh I want to export:
for ob in bpy.scene.objects:
# get derived objects
free, derived = create_derived_objects(scene, ob)
if derived is None:
continue
for obDerived, mat in derived:
if ob.type not in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META'}:
continue
try:
derivedBlenderMesh = obDerived.to_mesh( scene, True, 'PREVIEW' )
except:
derivedBlenderMesh = None
if derivedBlenderMesh:
# ... and the export stuff goes here
# once everything's done, I remove the created instance
if free:
free_derived_objects(derivedBlenderMesh)
I took it from the 3ds exporter to be honest.
I notice that it creates a new (derived ) object and then creates a new mesh ( transformed and everything ), so I guess those are potential places where the new name is assigned.
I browsed through the documentation, but I saw no clear relation between an Object and a Mesh instance other than through the to_mesh method, that obviously creates a new mesh instance.
However - I really need to get the original name. Can someone tell me how to access it?
Thanks in advance :) Paksas