Skip to content

Commit

Permalink
New Fixture UI List
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Dec 27, 2023
1 parent aeb725c commit a1c9074
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 99 deletions.
27 changes: 17 additions & 10 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class DMX(PropertyGroup):
DMX_OT_Fixture_Remove,
DMX_OT_Fixture_Import_GDTF,
DMX_OT_Fixture_Import_MVR,
DMX_PT_Fixtures,
DMX_UL_Group,
DMX_MT_Group,
DMX_OT_Group_Create,
Expand All @@ -161,17 +160,20 @@ class DMX(PropertyGroup):
DMX_PT_Groups,
DMX_OT_Programmer_DeselectAll,
DMX_OT_Programmer_SelectAll,
DMX_OT_Programmer_SelectFiltered,
DMX_OT_Programmer_SelectInvert,
DMX_OT_Programmer_SelectEveryOther,
DMX_OT_Programmer_Clear,
DMX_OT_Programmer_SelectBodies,
DMX_OT_Programmer_SelectTargets,
DMX_OT_Programmer_SelectCamera,
DMX_OT_Programmer_TargetsToZero,
DMX_PT_Fixture_Columns_Setup,
DMX_OT_Programmer_Set_Ignore_Movement,
DMX_OT_Programmer_Unset_Ignore_Movement,
DMX_PT_DMX_OSC,
DMX_PT_Fixtures,
DMX_UL_Fixtures,
DMX_OP_Delete_Fixture,
DMX_PT_DMX_MVR_X,
DMX_UL_MVR_Commit,
DMX_OP_MVR_Refresh,
Expand All @@ -183,6 +185,7 @@ class DMX(PropertyGroup):

linkedToFile = False
_keymaps = []
fixtures_filter = []

def register():
for cls in DMX.classes_setup:
Expand Down Expand Up @@ -232,10 +235,6 @@ def unregister():
name = "DMX Address",
default = True)

column_fixture_remove: BoolProperty(
name = "Remove Fixture",
default = False)

collection: PointerProperty(
name = "DMX Collection",
type = Collection)
Expand Down Expand Up @@ -295,6 +294,12 @@ def prepare_empty_buffer(self, context):
default = 4,
)

selected_fixture_index: IntProperty() # Just a fake value, we need as the Fixture list requires it

fixture_properties_editable: BoolProperty(
name = "Editable",
default = False)

# New DMX Scene
# - Remove any previous DMX objects/collections
# - Create DMX collection
Expand Down Expand Up @@ -1027,9 +1032,9 @@ def syncProgrammer(self):
description= "Fixture sorting order",
default = "ADDRESS",
items= [
("ADDRESS", "DMX Address", "", "", 0),
("NAME", "Name", "", "", 1),
("FIXTURE_ID", "Fixture ID", "", "", 2),
("NAME", "Name", "", "", 0),
("FIXTURE_ID", "Fixture ID", "", "", 1),
("ADDRESS", "DMX Address", "", "", 2),
("UNIT_NUMBER", "Unit Number", "", "", 3),
],
)
Expand Down Expand Up @@ -1095,6 +1100,7 @@ def selectedFixtures(self):


def sortedFixtures(self):

def string_to_pairs(s, pairs=re.compile(r"(\D*)(\d*)").findall):
return [(text.lower(), int(digits or 0)) for (text, digits) in pairs(s)[:-1]]

Expand Down Expand Up @@ -1324,7 +1330,8 @@ def render(self):
for fixture in self.fixtures:
fixture.render()


def set_fixtures_filter(self, fixtures_filter):
DMX.fixtures_filter = fixtures_filter


# Handlers #
Expand Down
8 changes: 8 additions & 0 deletions fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,14 @@ def toggleSelect(self):
if (selected): self.unselect()
else: self.select()

def is_selected(self):
selected = False
for obj in self.objects:
if (obj.object in bpy.context.selected_objects):
selected = True
break
return selected

def clear(self):
for i, ch in enumerate(self.channels):
data = DMX_Data.set(self.universe, self.address+i, ch.default)
Expand Down
Loading

0 comments on commit a1c9074

Please sign in to comment.