Skip to content

Commit 188c32a

Browse files
Component List
1 parent 7d375f7 commit 188c32a

File tree

8 files changed

+70
-5
lines changed

8 files changed

+70
-5
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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright (c) 2024 Liam Sherwin, All rights reserved.
2+
# This file is part of the Spectrum Lighting Engine, licensed under the GPL v3.
3+
4+
class_name ComponentList extends PanelContainer
5+
## Allow for choosing method on object to call by buttons sliders
6+
7+
8+
## The tree node for components
9+
@export var _component_tree: Tree
10+
11+
## Classname filter for components to display
12+
@export var component_filter: String
13+
14+
15+
## RefMap for class parent nodes in the tree
16+
var _class_parents: RefMap = RefMap.new()
17+
18+
## Root tree item
19+
var _tree_root: TreeItem
20+
21+
22+
func _ready() -> void:
23+
ComponentDB.request_class_callback(component_filter, _component_callback)
24+
25+
_tree_root = _component_tree.create_item()
26+
_component_callback(ComponentDB.get_components_by_classname(component_filter), [])
27+
28+
29+
## Class callback for ComponentDB
30+
func _component_callback(added: Array, removed: Array):
31+
for component: EngineComponent in added:
32+
var parent: TreeItem = _tree_root
33+
34+
for classname: String in component.class_tree:
35+
if classname not in _class_parents.get_left():
36+
parent = parent.create_child()
37+
parent.set_text(0, classname)
38+
_class_parents.map(classname, parent)
39+
40+
else:
41+
parent = _class_parents.left(classname)
42+
43+
var component_item: TreeItem = parent.create_child()
44+
component_item.set_text(0, component.get_name())
45+
component.name_changed.connect(func (new_name: String): component_item.set_text(0, new_name))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://bwm0lbx6y1ofv
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[gd_scene load_steps=2 format=3 uid="uid://c4vlxpk3ywg42"]
2+
3+
[ext_resource type="Script" uid="uid://bwm0lbx6y1ofv" path="res://components/ComponentList/ComponentList.gd" id="1_ml5v5"]
4+
5+
[node name="ComponentList" type="PanelContainer" node_paths=PackedStringArray("_component_tree")]
6+
anchors_preset = 15
7+
anchor_right = 1.0
8+
anchor_bottom = 1.0
9+
grow_horizontal = 2
10+
grow_vertical = 2
11+
script = ExtResource("1_ml5v5")
12+
_component_tree = NodePath("ComponentTree")
13+
component_filter = "DMX Fixture"
14+
15+
[node name="ComponentTree" type="Tree" parent="."]
16+
layout_mode = 2
17+
hide_root = true

components/ItemListView/ItemListView.tscn

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

2524
[node name="ToolBarContainer" type="PanelContainer" parent="."]
2625
layout_mode = 2

core/components/fixtures/DMXFixture.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ func has_overrides() -> bool:
111111

112112
## Checks if this fixture has a parameter
113113
func has_parameter(p_zone: String, p_parameter: String, p_function: String = "") -> bool:
114+
if not _manifest:
115+
return false
116+
114117
if p_function:
115118
return _manifest.has_function(_mode, p_zone, p_parameter, p_function)
116119
else:

panels/Functions/Functions.tscn

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

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

project.godot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ clear_programmer={
138138
store_mode={
139139
"deadzone": 0.2,
140140
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194311,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
141+
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":true,"pressed":false,"keycode":0,"physical_keycode":73,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
141142
]
142143
}
143144

0 commit comments

Comments
 (0)