From c0dcba6cb0ddaea71aaa4645b09522c8deb89ac3 Mon Sep 17 00:00:00 2001 From: Nobody Really Date: Wed, 17 Aug 2016 12:18:55 +0200 Subject: [PATCH] Fixed empty nodes issue --- io_scene_dae/export_dae.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/io_scene_dae/export_dae.py b/io_scene_dae/export_dae.py index d201639..a3825ce 100644 --- a/io_scene_dae/export_dae.py +++ b/io_scene_dae/export_dae.py @@ -159,6 +159,13 @@ class DaeExporter: line = "{}{}".format(indent * "\t", text) self.sections[section].append(line) + def purge_empty_nodes(self): + sections = {} + for k, v in self.sections.items(): + if not (len(v) == 2 and v[0][1:] == v[1][2:]): + sections[k] = v + self.sections = sections + def export_image(self, image): img_id = self.image_cache.get(image) if img_id: @@ -1706,7 +1713,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)): @@ -1876,6 +1883,8 @@ class DaeExporter: self.writel(S_MATS, 0, '') self.writel(S_FX, 0, '') + self.purge_empty_nodes() + if (self.config["use_anim"]): self.export_animations()