Browse Source

Merge pull request #196 from julyfortoday/fontconversion

Font Export
pull/197/merge
Adam Johnson 4 years ago committed by GitHub
parent
commit
8f20586876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      korman/exporter/convert.py
  2. 17
      korman/exporter/utils.py

5
korman/exporter/convert.py

@ -272,6 +272,11 @@ class Exporter:
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)
def _export_referenced_node_trees(self):
self.report.progress_advance()
self.report.progress_range = len(self.want_node_trees)

17
korman/exporter/utils.py

@ -92,3 +92,20 @@ def bmesh_object(name : str):
bm.to_mesh(mesh)
finally:
bm.free()
@contextmanager
def temporary_mesh_object(source : bpy.types.Object) -> bpy.types.Object:
"""Creates a temporary mesh object from a nonmesh object that will only exist for the duration
of the context."""
assert source.type != "MESH"
obj = bpy.data.objects.new(source.name, source.to_mesh(bpy.context.scene, True, "RENDER"))
obj.draw_type = "WIRE"
obj.matrix_basis, obj.matrix_world = source.matrix_basis, source.matrix_world
obj.parent = source.parent
bpy.context.scene.objects.link(obj)
try:
yield obj
finally:
bpy.data.objects.remove(obj)

Loading…
Cancel
Save