Skip to content

Commit

Permalink
- Fixed Glass material
Browse files Browse the repository at this point in the history
  • Loading branch information
odil24 authored and howetuft committed Dec 29, 2024
1 parent 142146b commit 9dfed4f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions nodes/materials/glass.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ def init(self, context):
self.add_input("LuxCoreSocketIOR", "IOR", 1.5)
self.add_input("LuxCoreSocketCauchyC", "Dispersion", 0)
ThinFilmCoating.init(self)

Roughness.init(self, default=0.05, init_enabled=False)
Roughness.update_anisotropy(self, context)

self.add_common_inputs()

self.outputs.new("LuxCoreSocketMaterial", "Material")


def draw_buttons(self, context, layout):
column = layout.row()
Expand All @@ -94,6 +97,7 @@ def draw_buttons(self, context, layout):
row.enabled = not self.rough
row.prop(self, "architectural")


layout.prop(self, "use_thinfilmcoating")

if self.get_interior_volume():
Expand Down Expand Up @@ -126,10 +130,19 @@ def sub_export(self, exporter, depsgraph, props, luxcore_name=None, output_socke

if self.rough:
Roughness.export(self, exporter, depsgraph, props, definitions)
self.export_common_inputs(exporter, depsgraph, props, definitions)

# Error handling for missing "Emission" input during common input export
try:
self.export_common_inputs(exporter, depsgraph, props, definitions)
except KeyError as e:
if str(e) == "'bpy_prop_collection[key]: key \"Emission\" not found'":
print(f"Warning: 'Emission' input not found for material '{luxcore_name}'. Skipping emission export.")
else:
raise # Re-raise other KeyErrors

return self.create_props(props, definitions, luxcore_name)


def get_interior_volume(self):
node_tree = self.id_data
active_output = get_active_output(node_tree)
Expand Down

0 comments on commit 9dfed4f

Please sign in to comment.