Skip to content

Commit

Permalink
Fix broken dae edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislas Dolcini committed Oct 9, 2019
1 parent 65ffbe1 commit b4ba237
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions io_scene_pyrogenesis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,13 +663,29 @@ def execute(self):
if child.tag == self.collada_prefix + 'library_materials':
root.remove(child)

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

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

element = ET.Element(self.collada_prefix + 'library_effects')
new_elements.append(element)
continue

if child.tag == self.collada_prefix + 'library_visual_scenes':
for visual_scene in child:
for node in visual_scene:
for subchild in node:
if subchild.tag == self.collada_prefix + 'instance_geometry':
for binding in subchild:
if binding.tag == self.collada_prefix + 'bind_material':
subchild.remove(binding)





element = ET.Element(self.collada_prefix + 'library_effects')
new_elements.append(element)
continue
Expand All @@ -683,10 +699,11 @@ def execute(self):
for element in new_elements:
root.append(element)

self.indent(root)

self.sortchildrenby(root)
for child in root:
self.sortchildrenby(child)
self.indent(root)
tree.write(open(self.file_path, 'wb'), encoding='utf-8')
tree.write(open(self.file_path, 'wb'),encoding='utf-8')

Expand Down

0 comments on commit b4ba237

Please sign in to comment.