mirror of
https://github.com/godotengine/collada-exporter.git
synced 2026-01-01 01:48:22 +03:00
Remove temporary mesh data created on every export
This commit is contained in:
@@ -428,6 +428,7 @@ class DaeExporter:
|
||||
"""
|
||||
p = node.data
|
||||
v = node.to_mesh(bpy.context.scene, True, "RENDER")
|
||||
self.temp_meshes.add(v)
|
||||
node.data = v
|
||||
# self.export_node(node, il, shape.name)
|
||||
node.data.update()
|
||||
@@ -539,6 +540,7 @@ class DaeExporter:
|
||||
|
||||
mesh = node.to_mesh(self.scene, apply_modifiers,
|
||||
"RENDER") # is this allright?
|
||||
self.temp_meshes.add(mesh)
|
||||
|
||||
triangulate = self.config["use_triangles"]
|
||||
if (triangulate):
|
||||
@@ -1706,7 +1708,7 @@ class DaeExporter:
|
||||
for bone in node.data.bones:
|
||||
if((bone.name.startswith("ctrl") and self.config["use_exclude_ctrl_bones"])):
|
||||
continue
|
||||
|
||||
|
||||
bone_name = self.skeleton_info[node]["bone_ids"][bone]
|
||||
|
||||
if (not (bone_name in xform_cache)):
|
||||
@@ -1907,7 +1909,8 @@ class DaeExporter:
|
||||
__slots__ = ("operator", "scene", "last_id", "scene_name", "sections",
|
||||
"path", "mesh_cache", "curve_cache", "material_cache",
|
||||
"image_cache", "skeleton_info", "config", "valid_nodes",
|
||||
"armature_for_morph", "used_bones", "wrongvtx_report")
|
||||
"armature_for_morph", "used_bones", "wrongvtx_report",
|
||||
"temp_meshes")
|
||||
|
||||
def __init__(self, path, kwargs, operator):
|
||||
self.operator = operator
|
||||
@@ -1917,6 +1920,7 @@ class DaeExporter:
|
||||
self.sections = {}
|
||||
self.path = path
|
||||
self.mesh_cache = {}
|
||||
self.temp_meshes = set()
|
||||
self.curve_cache = {}
|
||||
self.material_cache = {}
|
||||
self.image_cache = {}
|
||||
@@ -1927,9 +1931,16 @@ class DaeExporter:
|
||||
self.used_bones = []
|
||||
self.wrongvtx_report = False
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
for mesh in self.temp_meshes:
|
||||
bpy.data.meshes.remove(mesh)
|
||||
|
||||
|
||||
def save(operator, context, filepath="", use_selection=False, **kwargs):
|
||||
exp = DaeExporter(filepath, kwargs, operator)
|
||||
exp.export()
|
||||
with DaeExporter(filepath, kwargs, operator) as exp:
|
||||
exp.export()
|
||||
|
||||
return {"FINISHED"} # so the script wont run after we have batch exported.
|
||||
|
||||
Reference in New Issue
Block a user