Skip to content

Commit

Permalink
Fix a bug with dangling nodes in the node_tree of materials. Deleted …
Browse files Browse the repository at this point in the history
…nodes got exported as well. The bug has surfaced because of fixes implemented in relation to #56, which in terms stem from issues in blender described in #57. This is hopefully a temporary fix until blender fixes their api
  • Loading branch information
StjerneIdioten committed Aug 23, 2020
1 parent f09db74 commit 208d80f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/i3dio/node_classes/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,13 @@ def populate_from_evaluated_mesh(self):

for triangle in mesh.loop_triangles:
triangle_material = mesh.materials[triangle.material_index]

if triangle_material.name not in self.subsets:
self.logger.info(f"Has material {triangle_material.name!r}")
material_id = self.i3d.add_material(triangle_material)
# TODO: Figure out why we have to supply the original material instead of the one on the evaluated
# object. The evaluated one still contains references to deleted nodes from the node_tree
# of the material. Although I thought it would be updated?
material_id = self.i3d.add_material(triangle_material.original)
self.subsets[triangle_material.name] = SubSet(material_id)

# Add triangle to subset
Expand Down

0 comments on commit 208d80f

Please sign in to comment.