Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
Switched math power node for a gamma node to preserve RGB values of Stain color, rather than turning it into a float value
  • Loading branch information
kajupe authored Oct 8, 2024
1 parent 350016e commit 660984d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions MeddleTools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,10 @@ def mixColor(self, mat):
break

if power_node is None:
power_node = mat.node_tree.nodes.new('ShaderNodeMath')
power_node.operation = 'POWER'
power_node = mat.node_tree.nodes.new('ShaderNodeGamma')
power_node.label = "POWER"

mat.node_tree.links.new(rgb_node.outputs['Color'], power_node.inputs['Value'])
mat.node_tree.links.new(rgb_node.outputs['Color'], power_node.inputs['Color'])
power_node.inputs[1].default_value = 2.0

# mix the color with "BASE COLOR" node
Expand Down Expand Up @@ -299,7 +298,7 @@ def mixColor(self, mat):
mix_color.inputs['Fac'].default_value = 1.0
mat.node_tree.links.new(mix_color.outputs['Color'], principled_bsdf.inputs['Base Color'])
mat.node_tree.links.new(base_color.outputs['Color'], mix_color.inputs['Color1'])
mat.node_tree.links.new(power_node.outputs['Value'], mix_color.inputs['Color2'])
mat.node_tree.links.new(power_node.outputs['Color'], mix_color.inputs['Color2'])
mat.node_tree.links.new(base_color.outputs['Alpha'], mix_color.inputs['Fac'])

# organize nodes
Expand Down

0 comments on commit 660984d

Please sign in to comment.