@@ -3,6 +3,7 @@ extends Control
33var current_universe_uuid
44var current_io_uuid
55var current_io_type
6+ var current_io
67
78var input_options = [
89 "Empty" ,
@@ -39,6 +40,7 @@ func delete_request(node):
3940 universes [current_universe_uuid ].outputs .erase (node .get_meta ("output_uuid" ))
4041 current_io_uuid = ""
4142 current_io_type = ""
43+ current_io = ""
4244 reload_io ()
4345
4446 ).bind (node ))
@@ -48,14 +50,15 @@ func edit_request(node):
4850 match node .get_meta ("type" ):
4951 "universe" :
5052 current_universe_uuid = node .get_meta ("universe_uuid" )
51- Globals .nodes .universe_name .text = universes [current_universe_uuid ].name
53+ Globals .nodes .universe_name .text = universes [current_universe_uuid ].get_name ()
5254
5355 set_universe_controls_enabled (true )
5456 reload_io ()
5557 "output" :
5658 current_io_uuid = node .get_meta ("output_uuid" )
5759 current_io_type = "output"
58- set_io_controls_enabled (true , universes [current_universe_uuid ].outputs [current_io_uuid ].type )
60+ current_io = universes [current_universe_uuid ].get_output (current_io_uuid )
61+ set_io_controls_enabled (true , universes [current_universe_uuid ].get_output (current_io_uuid ).get_type ())
5962 reload_io ()
6063
6164func on_edit_mode_changed (edit_mode ):
@@ -110,45 +113,50 @@ func new_input():
110113 Globals .nodes .universe_inputs .add_child (node_to_add )
111114
112115func new_output ():
113- var output_uuid = Globals .new_uuid ()
114-
115- universes [current_universe_uuid ].outputs [output_uuid ] = {
116- "type" :"Empty" ,
117- "name" :"Empty Output" ,
118- "settings" :{
119-
120- }
121- }
116+ universes [current_universe_uuid ].new_output ("Empty" )
117+ # var output_uuid = Globals.new_uuid()
118+ #
119+ # universes[current_universe_uuid].outputs[output_uuid] = {
120+ # "type":"Empty",
121+ # "name":"Empty Output",
122+ # "settings":{
123+ #
124+ # }
125+ # }
122126 reload_io ()
123127
124128func reload_io ():
125129 if not current_universe_uuid :return
130+
126131 for node in Globals .nodes .universe_outputs .get_children ():
127132 node .queue_free ()
128- for uuid in universes [current_universe_uuid ].outputs :
129- var output = universes [current_universe_uuid ].outputs [uuid ]
133+
134+ for uuid in universes [current_universe_uuid ].get_all_outputs ().keys ():
135+ var output = universes [current_universe_uuid ].get_output (uuid )
130136 var node_to_add = Globals .components .list_item .instantiate ()
131- node_to_add .set_item_name (output .name )
137+ print (output )
138+ node_to_add .set_item_name (output ._get_name ())
132139 node_to_add .control_node = self
133140 node_to_add .set_meta ("output_uuid" , uuid )
134141 node_to_add .set_meta ("type" , "output" )
135142 node_to_add .name = uuid
136143 node_to_add .set_highlighted (false )
137144
138145 if current_io_uuid == uuid :
139- if output .type :
140- Globals .nodes .universe_io_type .selected = output_options .find (output .type )
141- node_to_add . set_highlighted ( true )
142- if output .type != "Empty" :
146+ if output .get_type () :
147+ Globals .nodes .universe_io_type .selected = output_options .find (output .get_type () )
148+
149+ if output .get_type () != "Empty" :
143150 for node in Globals .nodes .universe_io_controls .get_children ():
144- if node .name == output .type :
151+ if node .name == output .get_type () :
145152 node .visible = true
146153 else :
154+
147155 node .visible = false
156+ node_to_add .set_highlighted (true )
148157
149158 Globals .nodes .universe_outputs .add_child (node_to_add )
150159
151-
152160func set_universe_controls_enabled (enabled ):
153161 for node in Globals .nodes .universe_controls .get_children ():
154162 if node is LineEdit :
@@ -167,7 +175,6 @@ func set_io_controls_enabled(enabled, type):
167175 node .visible = false
168176
169177
170-
171178# Button Callbacks
172179
173180func _on_io_type_item_selected (index ):
@@ -177,27 +184,20 @@ func _on_io_type_item_selected(index):
177184 set_io_controls_enabled (true , input_options [index ])
178185
179186 elif current_io_type == "output" :
180- universes [current_universe_uuid ].outputs [ current_io_uuid ]. type = output_options [index ]
187+ current_io = universes [current_universe_uuid ].change_output_type ( current_io_uuid , output_options [index ])
181188 set_io_controls_enabled (true , output_options [index ])
182- match output_options [index ]:
183- "Art-Net" :
184- universes [current_universe_uuid ].outputs [current_io_uuid ].settings = {
185- "ip" :"172.0.0.1" ,
186- "port" :6454 ,
187- "universe" :0
188- }
189- "Empty" :
190- universes [current_universe_uuid ].outputs [current_io_uuid ].settings = {}
191189 reload_io ()
192190
193- func _on_art_net_port_text_submitted (new_text ):
194- universes [current_universe_uuid ].outputs [current_io_uuid ].settings .ip = new_text
191+ func _on_art_net_ip_text_submitted (new_text ):
192+ current_io .art_net .ip = new_text
193+ current_io .connect_to_host ()
195194
196195func _on_art_net_port_value_changed (value ):
197- universes [current_universe_uuid ].outputs [current_io_uuid ].settings .port = value
196+ current_io .art_net .port = value
197+ current_io .connect_to_host ()
198198
199199func _on_art_net_universe_value_changed (value ):
200- universes [ current_universe_uuid ]. outputs [ current_io_uuid ]. settings . universe = value
200+ current_io . art_net . universe = int ( value )
201201
202202func _on_new_universe_pressed ():
203203 new_universe ()
0 commit comments