Skip to content

Commit e77fde3

Browse files
author
Sightskeye
committed
Feat: Luminance Mask
1 parent e0f60ad commit e77fde3

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

OmniscientImporter/cameraProjection/cameraProjectionMaterial.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ def add_driver_for_multiply(node, collection_index, shot_index, data_path):
124124
value_node.outputs[0].default_value = 1.0
125125
value_node.name = "ValueEmissionNode"
126126

127-
if collection:
128-
add_driver(value_node, 0, bpy.context.scene, 'SCENE', f"Omni_Collections[{collection_index}].emission_value", True)
129-
130127
multiply_emission_node = nodes.new("ShaderNodeMath")
131128
multiply_emission_node.location = (400.0, bsdf_vertical_position - 500)
132129
multiply_emission_node.operation = 'MULTIPLY'
@@ -137,10 +134,14 @@ def add_driver_for_multiply(node, collection_index, shot_index, data_path):
137134
mix_rgb_emission_node.hide = True
138135
mix_rgb_emission_node.name = "MixRGBEmissionNode"
139136

137+
if collection:
138+
add_driver(value_node, 0, bpy.context.scene, 'SCENE', f"Omni_Collections[{collection_index}].emission_value", True)
139+
add_driver(mix_rgb_emission_node, 0, bpy.context.scene, 'SCENE', f"Omni_Collections[{collection_index}].mix_rgb_emission_input")
140+
140141
create_link(material.node_tree, color_ramp_emission_node, 0, multiply_emission_node, 0)
141142
create_link(material.node_tree, value_node, 0, multiply_emission_node, 1)
142-
create_link(material.node_tree, multiply_emission_node, 0, mix_rgb_emission_node, 1)
143-
create_link(material.node_tree, value_node, 0, mix_rgb_emission_node, 2)
143+
create_link(material.node_tree, multiply_emission_node, 0, mix_rgb_emission_node, 2)
144+
create_link(material.node_tree, value_node, 0, mix_rgb_emission_node, 1)
144145
else:
145146
# Update positions if nodes already exist
146147
color_ramp_emission_node = find_node(nodes, 'VALTORGB', 'ColorRampEmissionNode')

OmniscientImporter/ui/omniPanel.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class OmniCollection(PropertyGroup):
4747
expanded: bpy.props.BoolProperty(name="Expanded", default=False)
4848
emission_value: bpy.props.FloatProperty(name="Emission Value", default=0.0, min=0.0, max=1000.0)
4949
color_scan: bpy.props.FloatVectorProperty(name="Color scan", subtype='COLOR', min=0.0, max=1.0, default=(0.18, 0.18, 0.18))
50+
mix_rgb_emission_input: bpy.props.FloatProperty(name="Mix RGB Emission Input", default=0.0, min=0.0, max=1.0)
5051

5152
# -------------------------------------------------------------------
5253
# Handlers
@@ -173,8 +174,12 @@ def draw(self, context):
173174
collection = scene.Omni_Collections[collection_index]
174175
layout.template_list("OMNI_UL_ShotList", "", collection, "shots", scene, "Selected_Shot_Index")
175176

176-
layout.prop(collection, "emission_value", text="Emission")
177-
layout.prop(collection, "color_scan", text="Color Scan")
177+
box = layout.box()
178+
box.label(text="Scan")
179+
box.prop(collection, "emission_value", text="Emission")
180+
if collection.emission_value > 0:
181+
box.prop(collection, "mix_rgb_emission_input", text="Luminance Mask")
182+
box.prop(collection, "color_scan", text="Default Color")
178183
else:
179184
layout.label(text="No shots imported")
180185

0 commit comments

Comments
 (0)