From 3b999f550d75a32ce53ab8de81377cb915561f46 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 17 Feb 2021 15:09:35 -0500 Subject: [PATCH] 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. --- korman/exporter/convert.py | 7 +++++-- korman/exporter/mesh.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/korman/exporter/convert.py b/korman/exporter/convert.py index 55cb30a..5f2555d 100644 --- a/korman/exporter/convert.py +++ b/korman/exporter/convert.py @@ -287,14 +287,17 @@ class Exporter: def _export_mesh_blobj(self, so, bo): self.animation.convert_object_animations(bo, so) if bo.data.materials: - self.mesh.export_object(bo) + self.mesh.export_object(bo, so) else: self.report.msg("No material(s) on the ObData, so no drawables", indent=1) def _export_font_blobj(self, so, bo): self.animation.convert_object_animations(bo, so) 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): self.report.progress_advance() diff --git a/korman/exporter/mesh.py b/korman/exporter/mesh.py index e629395..e8f1ac7 100644 --- a/korman/exporter/mesh.py +++ b/korman/exporter/mesh.py @@ -575,7 +575,7 @@ class MeshConverter(_MeshManager): # Sequence of tuples (material_index, material) 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 # Otherwise, let's *try* to share meshes as best we can... if bo.modifiers: @@ -587,7 +587,7 @@ class MeshConverter(_MeshManager): # Create the DrawInterface 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: diface.addDrawable(dspan_key, idx)