Skip to content

Commit

Permalink
Show also Color and Dimmer only when relevant
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Aug 23, 2024
1 parent b229587 commit 03dfc71
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 19 deletions.
15 changes: 10 additions & 5 deletions fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ def hide_gobo(self, hide = True, current_frame = None):
light_obj.data.keyframe_insert(data_path="shadow_soft_size", frame=current_frame)
mix_factor.keyframe_insert(data_path="default_value", frame=current_frame)

def has_attribute(self, attribute, lower = False):
def has_attributes(self, attributes, lower = False):

temp_data = bpy.context.window_manager.dmx
def low(id):
Expand All @@ -1408,12 +1408,17 @@ def low(id):
else:
return id
if len(temp_data.active_subfixtures) > 0:
real = any([attribute in low(channel.id) for channel in self.channels if any(channel.geometry == g.name for g in temp_data.active_subfixtures)])
virtual = any([attribute in channel.id for channel in self.virtual_channels if any(channel.geometry == g.name for g in temp_data.active_subfixtures)])
in_fixture_real = [low(channel.id) for channel in self.channels if any(channel.geometry == g.name for g in temp_data.active_subfixtures)]
in_fixture_virtual = [low(channel.id) for channel in self.virtual_channels if any(channel.geometry == g.name for g in temp_data.active_subfixtures)]

real = any(any(attribute in item for item in in_fixture_real) for attribute in attributes)
virtual = any(any(attribute in item for item in in_fixture_virtual) for attribute in attributes)
else:
real = any([attribute in low(channel.id) for channel in self.channels])
virtual = any([attribute in channel.id for channel in self.virtual_channels])
in_fixture_real = [low(channel.id) for channel in self.channels]
in_fixture_virtual = [low(channel.id) for channel in self.virtual_channels]

real = any(any(attribute in item for item in in_fixture_real) for attribute in attributes)
virtual = any(any(attribute in item for item in in_fixture_virtual) for attribute in attributes)

return (real or virtual)

Expand Down
43 changes: 30 additions & 13 deletions panels/programmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,7 @@ def draw(self, context):

row=layout.row()
box = layout.column().box()
box.template_color_picker(scene.dmx, "programmer_color", value_slider=True)
row = box.row()
col1 = row.column()
col2 = row.column()
col1.prop(scene.dmx, "programmer_color")
col2.operator("dmx.reset_color", icon="TRASH", text="")
box.prop(scene.dmx, "programmer_dimmer", text=_("Dimmer"), translate=False, slider = True)



if selected_fixture_class is not None:
Expand All @@ -490,8 +484,21 @@ def draw(self, context):
if channel not in temp_data.active_subfixtures:
temp_data.active_subfixtures.add().name = channel

if selected_fixtures[0].has_attributes(["ColorAdd_R", "ColorAdd_G", "ColorAdd_B", "ColorSub_C",
"ColorSub_M", "ColorAdd_Y", "ColorAdd_WW", "ColorAdd_CW",
"ColorAdd_RY", "ColorAdd_GY", "ColorAdd_UV", "ColorRGB_Red",
"ColorRGB_Blue", "ColorRGB_Green"]):
box.template_color_picker(scene.dmx, "programmer_color", value_slider=True)
row = box.row()
col1 = row.column()
col2 = row.column()
col1.prop(scene.dmx, "programmer_color")
col2.operator("dmx.reset_color", icon="TRASH", text="")

if selected_fixtures[0].has_attributes(["Dimmer"]):
box.prop(scene.dmx, "programmer_dimmer", text=_("Dimmer"), translate=False, slider = True)

if selected_fixtures[0].has_attribute("Pan"):
if selected_fixtures[0].has_attributes(["Pan"]):
row = box.row()
col1 = row.column()
col1.prop(scene.dmx, "programmer_pan", text=_("Pan"), translate=False, slider = True)
Expand All @@ -501,24 +508,34 @@ def draw(self, context):
col2 = row.column()
col2.operator("dmx.ignore_movement_false", text="", icon="UNLOCKED")
col1.enabled = False
if selected_fixtures[0].has_attribute("Tilt"):
if selected_fixtures[0].has_attributes(["Tilt"]):
row = box.row()
col1 = row.column()
col1.prop(scene.dmx, "programmer_tilt", text=_("Tilt"), translate=False, slider = True)
if selected_fixtures[0].ignore_movement_dmx == True:
col2 = row.column()
col2.operator("dmx.ignore_movement_false", text="", icon="UNLOCKED")
col1.enabled = False
if selected_fixtures[0].has_attribute("Zoom"):
if selected_fixtures[0].has_attributes(["Zoom"]):
box.prop(scene.dmx, "programmer_zoom", text=_("Zoom"), translate=False, slider = True)
if selected_fixtures[0].has_attribute("Color1") or selected_fixtures[0].has_attribute("Color2") or selected_fixtures[0].has_attribute("ColorMacro1"):
if selected_fixtures[0].has_attributes(["Color1", "Color2", "ColorMacro1"]):
box.prop(scene.dmx, "programmer_color_wheel", text=_("Color Wheel"), translate=False)
if selected_fixtures[0].has_attribute("Gobo"):
if selected_fixtures[0].has_attributes(["Gobo"]):
box.prop(scene.dmx, "programmer_gobo", text=_("Gobo"), translate=False)
box.prop(scene.dmx, "programmer_gobo_index", text=_("Gobo Rotation"), translate=False)
if selected_fixtures[0].has_attribute("shutter", lower=True):
if selected_fixtures[0].has_attributes(["shutter"], lower=True):
box.prop(scene.dmx, "programmer_shutter", text=_("Strobe"), translate=False)
else:

box.template_color_picker(scene.dmx, "programmer_color", value_slider=True)
row = box.row()
col1 = row.column()
col2 = row.column()
col1.prop(scene.dmx, "programmer_color")
col2.operator("dmx.reset_color", icon="TRASH", text="")

box.prop(scene.dmx, "programmer_dimmer", text=_("Dimmer"), translate=False, slider = True)

row = box.row()
col1 = row.column()
col1.prop(scene.dmx, "programmer_pan", text=_("Pan"), translate=False, slider = True)
Expand Down
2 changes: 1 addition & 1 deletion panels/subfixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def draw(self, context):
selected = ",".join([s.name for s in temp_data.active_subfixtures])
row = layout.row()
col1 = row.column()
col1.label(text=f"Selected: {len(selected)} {selected}")
col1.label(text=f"Selected: {len(temp_data.active_subfixtures)} {selected}")
col2 = row.column()
col3 = row.column()
col2.operator("dmx.select_visible_subfixtures", icon="CHECKBOX_HLT", text="")
Expand Down

0 comments on commit 03dfc71

Please sign in to comment.