Skip to content

Commit

Permalink
fix(material): Update material.py for blender 3.3.0
Browse files Browse the repository at this point in the history
The name of the "Separate RGB" input has changed from `Image` to `Color` in blender 3.3.0.  Also support just using an image named "Glossmap" instead.

Fix #155
  • Loading branch information
jtsage authored Sep 19, 2022
1 parent 279ac32 commit b704d78
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion addon/i3dio/node_classes/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ def _resolve_with_nodes(self):
gloss_node = self.blender_material.node_tree.nodes.get('Glossmap')
if gloss_node is not None:
try:
gloss_image_path = gloss_node.inputs['Image'].links[0].from_node.image.filepath
if bpy.app.version < (3, 3, 0):
gloss_image_path = gloss_node.inputs['Image'].links[0].from_node.image.filepath
else:
if gloss_node.type == "SEPARATE_COLOR":
gloss_image_path = gloss_node.inputs['Color'].links[0].from_node.image.filepath
elif gloss_node.type == "TEX_IMAGE":
gloss_image_path = gloss_node.image.filepath
else:
raise AttributeError(f"Has an improperly setup Glossmap")
except (AttributeError, IndexError, KeyError):
self.logger.exception(f"Has an improperly setup Glossmap")
else:
Expand Down

0 comments on commit b704d78

Please sign in to comment.