Skip to content

Commit

Permalink
Merge pull request #951 from odil24/for_blender_4.2_wheels
Browse files Browse the repository at this point in the history
- Fix: Glossy Translucent material issues and "Normal map" option issue
howetuft authored Jan 5, 2025

Verified

This commit was signed with the committer’s verified signature.
myk002 Myk
2 parents af57e51 + f96fcfc commit 0744a99
Showing 2 changed files with 21 additions and 12 deletions.
23 changes: 15 additions & 8 deletions nodes/materials/glossytranslucent.py
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 6 additions & 4 deletions nodes/textures/imagemap.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0744a99

Please sign in to comment.