X Tutup
Skip to content

Commit eb059f0

Browse files
committed
add lightgroup support for volumes
1 parent 1de7203 commit eb059f0

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

nodes/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,14 @@ class LuxCoreNodeVolume(LuxCoreNode):
131131
# priority (IntProperty)
132132
# emission_id (IntProperty) (or maybe PointerProperty to light group later)
133133
# color_depth (FloatProperty) - for implicit colordepth texture
134+
# lightgroup (StringProperty)
134135

135136
def draw_common_buttons(self, context, layout):
136137
layout.prop(self, "priority")
137-
# layout.prop(self, "emission_id") # TODO correct lightgroup dropdown
138+
lightgroups = context.scene.luxcore.lightgroups
139+
layout.prop_search(self, "lightgroup",
140+
lightgroups, "custom",
141+
icon="OUTLINER_OB_LAMP", text="")
138142
layout.prop(self, "color_depth")
139143

140144
def add_common_inputs(self):
@@ -171,6 +175,13 @@ def export_common_inputs(self, exporter, props, definitions):
171175
definitions["absorption"] = abs_col
172176
definitions["emission"] = self.inputs["Emission"].export(exporter, props)
173177

178+
lightgroups = exporter.scene.luxcore.lightgroups
179+
lightgroup_id = lightgroups.get_id_by_name(self.lightgroup)
180+
definitions["emission.id"] = lightgroup_id
181+
exporter.lightgroup_cache.add(lightgroup_id)
182+
183+
print(definitions)
184+
174185
def export_scattering(self, exporter, props):
175186
scattering_col_socket = self.inputs["Scattering"]
176187
scattering_scale_socket = self.inputs["Scattering Scale"]

nodes/volumes/clear.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from bpy.props import IntProperty, FloatProperty
1+
from bpy.props import IntProperty, FloatProperty, StringProperty
22
from .. import LuxCoreNodeVolume, COLORDEPTH_DESC
3+
from ...properties.light import LIGHTGROUP_DESC
34

45

56
class LuxCoreNodeVolClear(LuxCoreNodeVolume):
@@ -12,6 +13,7 @@ class LuxCoreNodeVolClear(LuxCoreNodeVolume):
1213
color_depth = FloatProperty(name="Absorption Depth", default=1.0, min=0,
1314
subtype="DISTANCE", unit="LENGTH",
1415
description=COLORDEPTH_DESC)
16+
lightgroup = StringProperty(name="Light Group", description=LIGHTGROUP_DESC)
1517

1618
def init(self, context):
1719
self.add_common_inputs()

nodes/volumes/heterogeneous.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import math
22
import bpy
3-
from bpy.props import IntProperty, BoolProperty, FloatProperty, PointerProperty
3+
from bpy.props import IntProperty, BoolProperty, FloatProperty, PointerProperty, StringProperty
44
from ... import utils
55
from .. import LuxCoreNodeVolume, COLORDEPTH_DESC
6+
from ...properties.light import LIGHTGROUP_DESC
67

78

89
STEP_SIZE_DESCRIPTION = (
@@ -28,6 +29,8 @@ class LuxCoreNodeVolHeterogeneous(LuxCoreNodeVolume):
2829
color_depth = FloatProperty(name="Absorption Depth", default=1.0, min=0,
2930
subtype="DISTANCE", unit="LENGTH",
3031
description=COLORDEPTH_DESC)
32+
lightgroup = StringProperty(name="Light Group", description=LIGHTGROUP_DESC)
33+
3134
step_size = FloatProperty(name="Step Size", default=0.1, min=0.0001,
3235
soft_min=0.01, soft_max=1,
3336
subtype="DISTANCE", unit="LENGTH",

nodes/volumes/homogeneous.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from bpy.props import IntProperty, BoolProperty, FloatProperty
1+
from bpy.props import IntProperty, BoolProperty, FloatProperty, StringProperty
22
from .. import LuxCoreNodeVolume, COLORDEPTH_DESC
3+
from ...properties.light import LIGHTGROUP_DESC
34

45

56
class LuxCoreNodeVolHomogeneous(LuxCoreNodeVolume):
@@ -12,6 +13,7 @@ class LuxCoreNodeVolHomogeneous(LuxCoreNodeVolume):
1213
color_depth = FloatProperty(name="Absorption Depth", default=1.0, min=0,
1314
subtype="DISTANCE", unit="LENGTH",
1415
description=COLORDEPTH_DESC)
16+
lightgroup = StringProperty(name="Light Group", description=LIGHTGROUP_DESC)
1517

1618
multiscattering = BoolProperty(name="Multiscattering", default=False)
1719

0 commit comments

Comments
 (0)
X Tutup