Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Fix: Glossy Translucent material issues and "Normal map" option issue #951

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions nodes/materials/glossytranslucent.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,35 @@ class LuxCoreNodeMatGlossyTranslucent(LuxCoreNodeMaterial, bpy.types.Node):
bl_width_default = 160

def update_use_ior(self, context):
self.inputs["IOR"].enabled = self.use_ior
self.inputs["Specular Color"].enabled = not self.use_ior
id = self.inputs.find("IOR")
self.inputs[id].enabled = self.use_ior

id = self.inputs.find("Specular Color")
self.inputs[id].enabled = not self.use_ior
utils_node.force_viewport_update(self, context)

def update_use_ior_bf(self, context):
self.inputs["BF IOR"].enabled = self.use_ior_bf
self.inputs["BF Specular Color"].enabled = not self.use_ior_bf
id = self.inputs.find("BF IOR")
self.inputs[id].enabled = self.use_ior_bf

id = self.inputs.find("BF Specular Color")
self.inputs[id].enabled = not self.use_ior_bf
utils_node.force_viewport_update(self, context)

def update_use_backface(self, context):
# Note: these are the names (strings), not references to the sockets
sockets = [socket for socket in self.inputs.keys() if socket.startswith("BF ")]

for socket in sockets:
id = self.inputs.find(socket)
if socket == "BF V-Roughness":
self.inputs[socket].enabled = self.use_backface and self.use_anisotropy
self.inputs[id].enabled = self.use_backface and self.use_anisotropy
elif socket == "BF IOR":
self.inputs[socket].enabled = self.use_backface and self.use_ior_bf
self.inputs[id].enabled = self.use_backface and self.use_ior_bf
elif socket == "BF Specular Color":
self.inputs[socket].enabled = self.use_backface and not self.use_ior_bf
self.inputs[id].enabled = self.use_backface and not self.use_ior_bf
else:
self.inputs[socket].enabled = self.use_backface
self.inputs[id].enabled = self.use_backface

if context:
utils_node.force_viewport_update(self, context)
Expand Down
10 changes: 6 additions & 4 deletions nodes/textures/imagemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ def update_image(self, context):
description="Brightness multiplier")

def update_is_normal_map(self, context):
color_output = self.outputs["Color"]
bump_output = self.outputs["Bump"]
alpha_output = self.outputs["Alpha"]
id = self.outputs.find("Color")
color_output = self.outputs[id]
id = self.outputs.find("Bump")
bump_output = self.outputs[id]
id = self.outputs.find("Alpha")
alpha_output = self.outputs[id]
was_color_enabled = color_output.enabled

color_output.enabled = not self.is_normal_map
alpha_output.enabled = not self.is_normal_map
bump_output.enabled = self.is_normal_map
Expand Down
Loading