Skip to content

Commit b4ba237

Browse files
author
Stanislas Dolcini
committed
Fix broken dae edit
1 parent 65ffbe1 commit b4ba237

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

io_scene_pyrogenesis/__init__.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,13 +663,29 @@ def execute(self):
663663
if child.tag == self.collada_prefix + 'library_materials':
664664
root.remove(child)
665665

666-
element = ET.Element(self.collada_prefix + 'library_materials')
667-
new_elements.append(element)
666+
# If there is no material no need to append it.
668667
continue
669668

670669
if child.tag == self.collada_prefix + 'library_effects':
671670
root.remove(child)
672671

672+
element = ET.Element(self.collada_prefix + 'library_effects')
673+
new_elements.append(element)
674+
continue
675+
676+
if child.tag == self.collada_prefix + 'library_visual_scenes':
677+
for visual_scene in child:
678+
for node in visual_scene:
679+
for subchild in node:
680+
if subchild.tag == self.collada_prefix + 'instance_geometry':
681+
for binding in subchild:
682+
if binding.tag == self.collada_prefix + 'bind_material':
683+
subchild.remove(binding)
684+
685+
686+
687+
688+
673689
element = ET.Element(self.collada_prefix + 'library_effects')
674690
new_elements.append(element)
675691
continue
@@ -683,10 +699,11 @@ def execute(self):
683699
for element in new_elements:
684700
root.append(element)
685701

686-
self.indent(root)
702+
687703
self.sortchildrenby(root)
688704
for child in root:
689705
self.sortchildrenby(child)
706+
self.indent(root)
690707
tree.write(open(self.file_path, 'wb'), encoding='utf-8')
691708
tree.write(open(self.file_path, 'wb'),encoding='utf-8')
692709

0 commit comments

Comments
 (0)