Skip to content

Commit 08dd618

Browse files
Virtual Fixtures Updates
1 parent 1da4a31 commit 08dd618

File tree

16 files changed

+150
-73
lines changed

16 files changed

+150
-73
lines changed

assets/icons/remove.svg.import

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
importer="texture"
44
type="CompressedTexture2D"
55
uid="uid://b2irkd31agi0x"
6-
path="res://.godot/imported/remove.svg-4d209cc049dad917abe1dad4ca8edd56.ctex"
6+
path="res://.godot/imported/Remove.svg-d6b561eec13de9ed9a6b262ecffa42bf.ctex"
77
metadata={
88
"vram_texture": false
99
}
1010

1111
[deps]
1212

13-
source_file="res://assets/icons/remove.svg"
14-
dest_files=["res://.godot/imported/remove.svg-4d209cc049dad917abe1dad4ca8edd56.ctex"]
13+
source_file="res://assets/icons/Remove.svg"
14+
dest_files=["res://.godot/imported/Remove.svg-d6b561eec13de9ed9a6b262ecffa42bf.ctex"]
1515

1616
[params]
1717

components/AddShortcutButton/AddShortcutButton.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[gd_scene load_steps=3 format=3 uid="uid://daxklqm8l01pf"]
22

3-
[ext_resource type="Script" path="res://components/AddShortcutButton/AddShortcutButton.gd" id="1_5cpok"]
3+
[ext_resource type="Script" uid="uid://cdcf3dc6a5klk" path="res://components/AddShortcutButton/AddShortcutButton.gd" id="1_5cpok"]
44
[ext_resource type="Theme" uid="uid://cyua45ur0ijqo" path="res://assets/Main.theme" id="1_g33n6"]
55

66
[node name="AddShortcutButton" type="PanelContainer"]

components/ComponentNamePopup/ComponentNamePopup.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[gd_scene load_steps=6 format=3 uid="uid://dkdq40xavnqdl"]
22

33
[ext_resource type="Theme" uid="uid://cyua45ur0ijqo" path="res://assets/Main.theme" id="1_h4ca0"]
4-
[ext_resource type="Script" path="res://components/ComponentNamePopup/ComponentNamePopup.gd" id="2_mpv4w"]
4+
[ext_resource type="Script" uid="uid://cy1nvptvhmqon" path="res://components/ComponentNamePopup/ComponentNamePopup.gd" id="2_mpv4w"]
55
[ext_resource type="StyleBox" uid="uid://drpfuhk8y61xk" path="res://assets/styles/SolidPanelPopup.tres" id="2_r6gip"]
66
[ext_resource type="Texture2D" uid="uid://bi4ttx5uklwl7" path="res://assets/icons/Check.svg" id="3_vj7rn"]
77
[ext_resource type="Texture2D" uid="uid://b3hmh5jlggqxa" path="res://assets/icons/cross.svg" id="4_rspsp"]

components/ItemListView/ItemListView.gd

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ signal selection_changed(items: Array)
3030
@export var allow_multi_select: bool = true ## If the user should be able to select mutiple items at once
3131
@export var sort_alphabetically: bool = true
3232

33+
## Parameter to use when sorting
34+
@export var sort_parameter: String = "name"
35+
3336
@onready var item_container: VBoxContainer = self.get_node("PanelContainer2/ScrollContainer/ItemContainer")
3437

3538
## All the currently selected items
@@ -108,12 +111,18 @@ func add_item(item: Variant, chips: Array = [], name_method: String = "", name_c
108111

109112

110113
## Sorts all the items in this list by alphabetical order
111-
func sort() -> void:
114+
func sort(parameter: String = sort_parameter) -> void:
112115
var sorted_list_item_nodes: Array = object_refs.keys()
113116
sorted_list_item_nodes.sort_custom(func(a, b):
114-
var a_name = object_refs[a].name if _is_valid_object(object_refs[a]) else str(object_refs[a])
115-
var b_name = object_refs[b].name if _is_valid_object(object_refs[b]) else str(object_refs[b])
116-
return a_name.naturalnocasecmp_to(b_name) < 0
117+
var a_param = object_refs[a].get(parameter) if _is_valid_object(object_refs[a]) else str(object_refs[a])
118+
var b_param = object_refs[b].get(parameter) if _is_valid_object(object_refs[b]) else str(object_refs[b])
119+
120+
if typeof(a_param) == typeof(b_param):
121+
match typeof(a_param):
122+
TYPE_INT, TYPE_FLOAT:
123+
return a_param < b_param
124+
125+
return a_param.naturalnocasecmp_to(b_param) < 0
117126
)
118127

119128
for list_item: ListItem in sorted_list_item_nodes:

components/ItemListView/ItemListView.tscn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ size_flags_horizontal = 3
2020
size_flags_vertical = 3
2121
theme = ExtResource("1_fqr1x")
2222
script = ExtResource("2_xkuya")
23+
sort_parameter = null
2324

2425
[node name="ToolBarContainer" type="PanelContainer" parent="."]
2526
layout_mode = 2

components/ListItem/ListItem.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[gd_scene load_steps=5 format=3 uid="uid://d0wg6bo67u7cr"]
22

3-
[ext_resource type="Script" path="res://components/ListItem/ListItem.gd" id="1_plvbh"]
3+
[ext_resource type="Script" uid="uid://dqogyxir6fypd" path="res://components/ListItem/ListItem.gd" id="1_plvbh"]
44

55
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_564t2"]
66
content_margin_left = 13.0

core/components/fixtures/DMXFixture.gd

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ var _channel: int = 0
1515
## The mode of this fixture
1616
var _mode: String = ""
1717

18+
## All the input value layers as raw values
19+
## { "zone": { "parameter": { "value": float, "function": String } } }
20+
var _raw_layers: Dictionary[String, Dictionary] = {}
21+
1822
## All the input value overrides as raw values
1923
## { "zone": { "parameter": { "value": float, "function": String } } }
2024
var _raw_override_layers: Dictionary[String, Dictionary] = {}
@@ -30,10 +34,22 @@ func _component_ready() -> void:
3034
register_setting("DMXFixture", "channel", set_channel, get_channel, channel_changed, Utils.TYPE_INT, 0, "Channel", 1, 512)
3135

3236

37+
## Internal: Sets a parameter to a float value
38+
func _set_parameter(p_parameter: String, p_function: String, p_value: Variant, p_zone: String) -> void:
39+
_raw_layers.get_or_add(p_zone, {})[p_parameter] = {"value": p_value, "function": p_function}
40+
41+
42+
## Internal: Erases the parameter on the given layer
43+
func _erase_parameter(p_parameter: String, p_zone: String) -> void:
44+
_raw_layers.get_or_add(p_zone, {}).erace(p_parameter)
45+
46+
3347
## Internal: Sets a parameter override to a float value
3448
func _set_override(p_parameter: String, p_function: String, p_value: float, p_zone: String = "root") -> void:
3549
_raw_override_layers.get_or_add(p_zone, {})[p_parameter] = {"value": p_value, "function": p_function}
3650
override_changed.emit(p_parameter, p_function, p_value, p_zone)
51+
52+
print(p_function, ": ", p_value)
3753

3854

3955
## Internal: Erases the parameter override
@@ -82,11 +98,24 @@ func get_all_override_values() -> Dictionary:
8298
return _raw_override_layers.duplicate(true)
8399

84100

101+
## Gets all the override values
102+
func get_all_parameter_values() -> Dictionary:
103+
return _raw_layers.duplicate(true)
104+
105+
85106
## Checks if this DMXFixture has any overrides
86107
func has_overrides() -> bool:
87108
return _raw_override_layers != {}
88109

89110

111+
## Checks if this fixture has a parameter
112+
func has_parameter(p_zone: String, p_parameter: String, p_function: String = "") -> bool:
113+
if p_function:
114+
return _manifest.has_function(_mode, p_zone, p_parameter, p_function)
115+
else:
116+
return _manifest.has_parameter(_mode, p_zone, p_parameter)
117+
118+
90119
## Gets all the zones
91120
func get_zones() -> Array[String]:
92121
return _manifest.get_zones(_mode)

core/components/fixtures/Fixture.gd

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func set_parameter(p_parameter: String, p_function: String, p_value: float, p_la
4040

4141

4242
## Internal: Sets a parameter to a float value
43-
func _set_parameter(p_parameter: String, p_value: float, p_layer_id: String, p_zone: String = "root") -> void:
43+
func _set_parameter(p_parameter: String, p_function: String, p_value: Variant, p_zone: String) -> void:
4444
return
4545

4646

@@ -50,7 +50,7 @@ func erase_parameter(p_parameter: String, p_layer_id: String, p_zone: String = "
5050

5151

5252
## Internal: Erases the parameter on the given layer
53-
func _erase_parameter(p_parameter: String, p_layer_id: String, p_zone: String = "root") -> void:
53+
func _erase_parameter(p_parameter: String, p_zone: String) -> void:
5454
return
5555

5656

@@ -89,11 +89,21 @@ func get_all_override_values() -> Dictionary:
8989
return {}
9090

9191

92+
## Gets all the override values
93+
func get_all_parameter_values() -> Dictionary:
94+
return {}
95+
96+
9297
## Checks if this Fixture has any overrides
9398
func has_overrides() -> bool:
9499
return false
95100

96101

102+
## Checks if this fixture has a parameter
103+
func has_parameter(p_zone: String, p_parameter: String, p_function: String = "") -> bool:
104+
return false
105+
106+
97107
## Gets all the zones
98108
func get_zones() -> Array[String]:
99109
return []

panels/CuePlayback/CuePlayback.tscn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[gd_scene load_steps=28 format=3 uid="uid://duww8qljyqvxk"]
22

33
[ext_resource type="Theme" uid="uid://cyua45ur0ijqo" path="res://assets/Main.theme" id="1_kkl7c"]
4-
[ext_resource type="Script" path="res://panels/CuePlayback/CuePlayback.gd" id="2_0mtdo"]
4+
[ext_resource type="Script" uid="uid://cn6m5i63dvch6" path="res://panels/CuePlayback/CuePlayback.gd" id="2_0mtdo"]
55
[ext_resource type="Texture2D" uid="uid://c1cl6qetwg8st" path="res://assets/icons/Arrow_back.svg" id="2_bvwur"]
66
[ext_resource type="Texture2D" uid="uid://kkblmodueva1" path="res://assets/icons/Arrow_foward.svg" id="3_07mes"]
77
[ext_resource type="Texture2D" uid="uid://dfrrs2dnvlvsu" path="res://assets/icons/Delete.svg" id="3_ifhov"]
@@ -17,7 +17,7 @@
1717
[ext_resource type="Texture2D" uid="uid://bw77ixp24syp2" path="res://assets/icons/Timecode.svg" id="9_jkvxf"]
1818
[ext_resource type="FontFile" uid="uid://crlak6jhg5jy2" path="res://assets/font/RubikMonoOne-Regular.ttf" id="9_qen5l"]
1919
[ext_resource type="Texture2D" uid="uid://c7irg7odho4pk" path="res://assets/icons/Target.svg" id="10_to1ac"]
20-
[ext_resource type="Script" path="res://panels/CuePlayback/Triggers.gd" id="11_8p1rl"]
20+
[ext_resource type="Script" uid="uid://b0fn5cq4ldoji" path="res://panels/CuePlayback/Triggers.gd" id="11_8p1rl"]
2121
[ext_resource type="PackedScene" uid="uid://daxklqm8l01pf" path="res://components/AddShortcutButton/AddShortcutButton.tscn" id="12_6gcgo"]
2222
[ext_resource type="Texture2D" uid="uid://dghhvu27mcp3u" path="res://assets/icons/PlayPause.svg" id="15_3dwbb"]
2323
[ext_resource type="Texture2D" uid="uid://rqf8w11gk6ud" path="res://assets/icons/Edit.svg" id="20_mrsrb"]

panels/Debug/Debug.tscn

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[gd_scene load_steps=11 format=3 uid="uid://dqatkkghk5b2q"]
22

33
[ext_resource type="Theme" uid="uid://cyua45ur0ijqo" path="res://assets/Main.theme" id="1_804im"]
4-
[ext_resource type="Script" path="res://panels/Debug/Debug.gd" id="2_f46o2"]
4+
[ext_resource type="Script" uid="uid://cysfum4oxr3mj" path="res://panels/Debug/Debug.gd" id="2_f46o2"]
55
[ext_resource type="StyleBox" uid="uid://daxhx5qr5qdeu" path="res://assets/styles/SolidPanel.tres" id="2_hysiy"]
66
[ext_resource type="Texture2D" uid="uid://chva73v2q1246" path="res://assets/icons/Bug.svg" id="3_2fxag"]
77
[ext_resource type="StyleBox" uid="uid://csle20exwqtti" path="res://assets/styles/PanelMenuBar.tres" id="4_lse07"]
@@ -77,15 +77,15 @@ tooltip_text = "CRASH THE SERVER"
7777
theme_override_colors/font_disabled_color = Color(0.713726, 0, 0, 1)
7878
theme_override_colors/font_hover_pressed_color = Color(1, 0, 0, 1)
7979
theme_override_colors/font_hover_color = Color(1, 0, 0, 1)
80-
theme_override_colors/font_pressed_color = Color(1, 0, 0, 1)
81-
theme_override_colors/font_focus_color = Color(1, 0, 0, 1)
82-
theme_override_colors/font_color = Color(1, 0, 0, 1)
83-
theme_override_colors/icon_normal_color = Color(1, 0, 0, 1)
84-
theme_override_colors/icon_focus_color = Color(1, 0, 0, 1)
85-
theme_override_colors/icon_pressed_color = Color(1, 0, 0, 1)
86-
theme_override_colors/icon_hover_color = Color(1, 0, 0, 1)
87-
theme_override_colors/icon_hover_pressed_color = Color(1, 0, 0, 1)
8880
theme_override_colors/icon_disabled_color = Color(0.713726, 0, 0, 1)
81+
theme_override_colors/icon_hover_pressed_color = Color(1, 0, 0, 1)
82+
theme_override_colors/icon_hover_color = Color(1, 0, 0, 1)
83+
theme_override_colors/icon_pressed_color = Color(1, 0, 0, 1)
84+
theme_override_colors/icon_focus_color = Color(1, 0, 0, 1)
85+
theme_override_colors/icon_normal_color = Color(1, 0, 0, 1)
86+
theme_override_colors/font_color = Color(1, 0, 0, 1)
87+
theme_override_colors/font_focus_color = Color(1, 0, 0, 1)
88+
theme_override_colors/font_pressed_color = Color(1, 0, 0, 1)
8989
theme_override_fonts/font = SubResource("SystemFont_fhcgp")
9090
text = "CRASH SERVER"
9191
icon = ExtResource("6_hgh5s")

panels/Fixtures/Fixtures.tscn

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[gd_scene load_steps=4 format=3 uid="uid://d12eb0smjpwuk"]
22

33
[ext_resource type="StyleBox" uid="uid://daxhx5qr5qdeu" path="res://assets/styles/SolidPanel.tres" id="1_8onam"]
4-
[ext_resource type="Script" path="res://panels/Fixtures/Fixtures.gd" id="1_xjo7n"]
4+
[ext_resource type="Script" uid="uid://c6mhb54lpvl37" path="res://panels/Fixtures/Fixtures.gd" id="1_xjo7n"]
55
[ext_resource type="PackedScene" uid="uid://c6smssfk7gn2w" path="res://components/ItemListView/ItemListView.tscn" id="2_o0s47"]
66

77
[node name="Fixtures" type="PanelContainer"]
@@ -16,9 +16,8 @@ script = ExtResource("1_xjo7n")
1616
[node name="ItemListView" parent="." instance=ExtResource("2_o0s47")]
1717
layout_mode = 2
1818
show_new = false
19-
show_take = false
2019
show_edit = false
21-
sort_alphabetically = false
20+
sort_parameter = "_channel"
2221

2322
[connection signal="add_requested" from="ItemListView" to="." method="_on_item_list_view_add_requested"]
2423
[connection signal="delete_requested" from="ItemListView" to="." method="_on_item_list_view_delete_requested"]

panels/Functions/Functions.tscn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ edit_controls = NodePath("ItemListView/ToolBarContainer/HBoxContainer/EditContro
3939
layout_mode = 2
4040
show_select = false
4141
show_invert = false
42+
sort_parameter = null
4243

4344
[node name="ToolBarContainer" parent="ItemListView" index="0"]
4445
theme_override_styles/panel = ExtResource("4_vxby2")

panels/Universes/Universes.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[ext_resource type="PackedScene" uid="uid://dfu5s8fjy0ex4" path="res://components/UIPanel/EditControls.tscn" id="4_5nceh"]
99
[ext_resource type="StyleBox" uid="uid://csle20exwqtti" path="res://assets/styles/PanelMenuBar.tres" id="4_k0mnb"]
1010
[ext_resource type="Script" uid="uid://rcg26r86qsdg" path="res://scripts/ui/Tabs.gd" id="6_u05u1"]
11-
[ext_resource type="Script" uid="uid://wy5b8gcb8nat" path="res://scripts/ui/TabBarFix.gd" id="7_6his8"]
11+
[ext_resource type="Script" uid="uid://cd8jj6h3jj0ah" path="res://scripts/ui/TabBarFix.gd" id="7_6his8"]
1212
[ext_resource type="Texture2D" uid="uid://bbennjke0ioen" path="res://assets/icons/Add.svg" id="9_b76bq"]
1313
[ext_resource type="Texture2D" uid="uid://dfrrs2dnvlvsu" path="res://assets/icons/Delete.svg" id="10_5cuqi"]
1414
[ext_resource type="PackedScene" uid="uid://dwtaoj1uy0dok" path="res://components/ComponentSettings/ComponentSettings.tscn" id="13_fvfxy"]

panels/VirtualFixtures/FixtureContainer.gd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ func _handle_mouse_up() -> void:
326326

327327
## Sets the selected state on a fixture's virtual fixtures
328328
func _set_fixture_selected(fixture: Fixture, state: bool) -> void:
329-
_virtual_fixtures[fixture].set_fixture_selected(state)
329+
if _virtual_fixtures.has(fixture):
330+
_virtual_fixtures[fixture].set_fixture_selected(state)
330331

331332

332333
## Sets all Virtual Fixture's self selected state to false

0 commit comments

Comments
 (0)