diff options
author | Alex Strand <astrand130> | 2020-09-09 12:36:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-09-17 19:54:04 +0300 |
commit | b248ec97769fa654a3ee8bb2a643046b79e7c030 (patch) | |
tree | 57604691dd62e4b19b9df5d4109a8dc3f83bacb8 /release/scripts/modules/bpy_extras | |
parent | 65fd005312848178509b0a0b0f3febf9f777f529 (diff) |
Shaders: add emission strength input to Principled BSDF node
This impacts I/O add-ons. OBJ, FBX and Collada have been updated, glTF not yet.
Differential Revision: https://developer.blender.org/D4971
Diffstat (limited to 'release/scripts/modules/bpy_extras')
-rw-r--r-- | release/scripts/modules/bpy_extras/node_shader_utils.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy_extras/node_shader_utils.py b/release/scripts/modules/bpy_extras/node_shader_utils.py index 81c7fa31379..bcb8adff910 100644 --- a/release/scripts/modules/bpy_extras/node_shader_utils.py +++ b/release/scripts/modules/bpy_extras/node_shader_utils.py @@ -505,7 +505,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): @_set_check def emission_color_set(self, color): if self.use_nodes and self.node_principled_bsdf is not None: - color = values_clamp(color, 0.0, 1.0) + color = values_clamp(color, 0.0, 1000000.0) color = rgb_to_rgba(color) self.node_principled_bsdf.inputs["Emission"].default_value = color @@ -523,6 +523,31 @@ class PrincipledBSDFWrapper(ShaderWrapper): emission_color_texture = property(emission_color_texture_get) + def emission_strength_get(self): + if not self.use_nodes or self.node_principled_bsdf is None: + return 1.0 + return self.node_principled_bsdf.inputs["Emission Strength"].default_value + + @_set_check + def emission_strength_set(self, value): + value = values_clamp(value, 0.0, 1000000.0) + if self.use_nodes and self.node_principled_bsdf is not None: + self.node_principled_bsdf.inputs["Emission Strength"].default_value = value + + emission_strength = property(emission_strength_get, emission_strength_set) + + + def emission_strength_texture_get(self): + if not self.use_nodes or self.node_principled_bsdf is None: + return None + return ShaderImageTextureWrapper( + self, self.node_principled_bsdf, + self.node_principled_bsdf.inputs["Emission Strength"], + grid_row_diff=-1, + colorspace_name='Non-Color', + ) + + emission_strength_texture = property(emission_strength_texture_get) # -------------------------------------------------------------------- # Normal map. |