From b704d78e1e66de3ff00307f8b527c4fd1c0af243 Mon Sep 17 00:00:00 2001 From: "J.T. Sage" Date: Mon, 19 Sep 2022 11:41:14 -0400 Subject: [PATCH] fix(material): Update material.py for blender 3.3.0 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 --- addon/i3dio/node_classes/material.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addon/i3dio/node_classes/material.py b/addon/i3dio/node_classes/material.py index 839bb42..7ebe530 100644 --- a/addon/i3dio/node_classes/material.py +++ b/addon/i3dio/node_classes/material.py @@ -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: