Browse Source

Fix child font objects.

Font objects were exported as a completely different SceneObject,
causing the parenting relationship to be broken. This ensures that the
drawable is properly attached to the correct SceneObject.
pull/235/head
Adam Johnson 3 years ago
parent
commit
3b999f550d
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 7
      korman/exporter/convert.py
  2. 4
      korman/exporter/mesh.py

7
korman/exporter/convert.py

@ -287,14 +287,17 @@ class Exporter:
def _export_mesh_blobj(self, so, bo): def _export_mesh_blobj(self, so, bo):
self.animation.convert_object_animations(bo, so) self.animation.convert_object_animations(bo, so)
if bo.data.materials: if bo.data.materials:
self.mesh.export_object(bo) self.mesh.export_object(bo, so)
else: else:
self.report.msg("No material(s) on the ObData, so no drawables", indent=1) self.report.msg("No material(s) on the ObData, so no drawables", indent=1)
def _export_font_blobj(self, so, bo): def _export_font_blobj(self, so, bo):
self.animation.convert_object_animations(bo, so) self.animation.convert_object_animations(bo, so)
with utils.temporary_mesh_object(bo) as meshObj: with utils.temporary_mesh_object(bo) as meshObj:
self._export_mesh_blobj(so, meshObj) if bo.data.materials:
self.mesh.export_object(meshObj, so)
else:
self.report.msg("No material(s) on the ObData, so no drawables", indent=1)
def _export_referenced_node_trees(self): def _export_referenced_node_trees(self):
self.report.progress_advance() self.report.progress_advance()

4
korman/exporter/mesh.py

@ -575,7 +575,7 @@ class MeshConverter(_MeshManager):
# Sequence of tuples (material_index, material) # Sequence of tuples (material_index, material)
return sorted(((i, material_source[i]) for i in valid_materials), key=lambda x: x[0]) return sorted(((i, material_source[i]) for i in valid_materials), key=lambda x: x[0])
def export_object(self, bo): def export_object(self, bo, so : plSceneObject):
# If this object has modifiers, then it's a unique mesh, and we don't need to try caching it # If this object has modifiers, then it's a unique mesh, and we don't need to try caching it
# Otherwise, let's *try* to share meshes as best we can... # Otherwise, let's *try* to share meshes as best we can...
if bo.modifiers: if bo.modifiers:
@ -587,7 +587,7 @@ class MeshConverter(_MeshManager):
# Create the DrawInterface # Create the DrawInterface
if drawables: if drawables:
diface = self._mgr.find_create_object(plDrawInterface, bl=bo) diface = self._mgr.find_create_object(plDrawInterface, bl=bo, so=so)
for dspan_key, idx in drawables: for dspan_key, idx in drawables:
diface.addDrawable(dspan_key, idx) diface.addDrawable(dspan_key, idx)

Loading…
Cancel
Save