Skip to content

Commit

Permalink
fix: "Emission" input of BSDF shader is called "Emission Color" from …
Browse files Browse the repository at this point in the history
…Blender 4
  • Loading branch information
ntamas committed Nov 20, 2023
1 parent fe1b9b0 commit 85c3a96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/sbstudio/plugin/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"set_specular_reflection_intensity_of_material",
)

is_blender_4 = bpy.app.version >= (4, 0, 0)


def _create_material(name: str):
"""Creates a new, general purpose material with the given name."""
Expand Down Expand Up @@ -274,7 +276,7 @@ def get_shader_node_and_input_for_diffuse_color_of_material(material):
node = _find_shader_node_by_name_and_type(
material, "Principled BSDF", "BSDF_PRINCIPLED"
)
input = node.inputs["Emission"]
input = node.inputs["Emission Color" if is_blender_4 else "Emission"]
return node, input
except KeyError:
raise SkybrushStudioAddonError(
Expand Down

0 comments on commit 85c3a96

Please sign in to comment.