i wrote a code that do this job…
it was really difficult to make it stable…
the solution is simple.
- it delete all objects with #mesh# prefix in object name
- it create for every text object new duplicate, converted to mesh and move this to last layer
so… in my app, i need only to hide all real text objects (without #mesh#)
import bpy
def game_start_pre(context):
#delete all text meshs
bpy.context.scene.objects.active = None
obj = bpy.context.scene.objects[:]
for o in obj:
o.select = False
if o.name.startswith("#mesh#"):
o.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
o.hide = False
o.hide_select = False
o.select = True
bpy.ops.object.delete()
#create new text meshs
obj = bpy.context.scene.objects[:]
for o in obj:
if o.type=="FONT":
l = o.layers[:]
h = o.hide
s = o.hide_select
o.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
o.hide = False
o.hide_select = False
o.select = True
bpy.context.scene.objects.active = o
bpy.ops.object.convert(target='MESH', keep_original=True)
a = bpy.context.active_object
bpy.context.scene.objects.active = None
o.layers = l[:]
o.hide = h
o.hide_select = s
o.select = False
if a != None and o.name != a.name:
a.layers = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,True]
a.hide = h
a.hide_select = s
a.select = False
a.name = "#mesh#" + o.name
#bpy.ops.object.select_all(action='DESELECT')
#bpy.app.handlers.game_pre.append(game_start_pre)
game_start_pre(0)