@@ -81,7 +81,7 @@ func _component_ready() -> void:
81
81
register_callback ("on_loop_mode_changed" , _set_loop_mode )
82
82
register_callback ("on_cues_added" , _add_cues )
83
83
register_callback ("on_cues_removed" , _remove_cues )
84
- register_callback ("cue_order_changed " , _set_cue_position )
84
+ register_callback ("on_cue_order_changed " , _set_cue_position )
85
85
86
86
register_control_method ("go_previous" , go_previous )
87
87
register_control_method ("go_next" , go_next )
@@ -153,6 +153,11 @@ func get_loop_mode() -> LoopMode:
153
153
return _loop_mode
154
154
155
155
156
+ ## Gets the position of a cue
157
+ func get_cue_position (p_cue : Cue ) -> int :
158
+ return _cues .find (p_cue )
159
+
160
+
156
161
## Gets whether triggered cues can loop back to the start
157
162
func get_allow_triggered_looping () -> bool :
158
163
return _allow_triggered_looping
@@ -178,6 +183,11 @@ func get_global_pre_wait_speed() -> float:
178
183
return _global_pre_wait
179
184
180
185
186
+ ## Gets the active cue, or null
187
+ func get_active_cue () -> Cue :
188
+ return _active_cue
189
+
190
+
181
191
## Server: Seeks to the next cue in the list
182
192
func go_next () -> Promise :
183
193
return rpc ("go_next" , [])
@@ -247,15 +257,15 @@ func _remove_cues(p_cues: Array) -> void:
247
257
248
258
249
259
## Internal: Sets the position of a cue in the list
250
- func _set_cue_position (cue : Cue , position : int ) -> void :
251
- if cue not in _cues :
260
+ func _set_cue_position (p_cue : Cue , p_position : int ) -> void :
261
+ if p_cue not in _cues or p_position > len ( _cues ) :
252
262
return
253
263
254
- var old_index : int = _cues .find (cue )
255
- _cues .insert (position , cue )
264
+ var old_index : int = _cues .find (p_cue )
256
265
_cues .remove_at (old_index )
266
+ _cues .insert (p_position , p_cue )
257
267
258
- cue_order_changed .emit (cue , position )
268
+ cue_order_changed .emit (p_cue , p_position )
259
269
260
270
261
271
## Internal: Sets whether triggered cues can loop back to the start
@@ -339,8 +349,13 @@ func _load_request(serialized_data: Dictionary) -> void:
339
349
_global_pre_wait = type_convert (serialized_data .get ("global_pre_wait" , _global_pre_wait ), TYPE_FLOAT )
340
350
_allow_triggered_looping = type_convert (serialized_data .get ("allow_triggered_looping" , _allow_triggered_looping ), TYPE_BOOL )
341
351
_loop_mode = type_convert (serialized_data .get ("loop_mode" , _loop_mode ), TYPE_INT )
342
-
352
+
343
353
_add_cues (Utils .deseralise_component_array (type_convert (serialized_data .get ("cues" , []), TYPE_ARRAY )))
354
+
355
+ var active_cue : EngineComponent = ComponentDB .get_component (type_convert (serialized_data .get ("active_cue_uuid" , "" ), TYPE_STRING ))
356
+
357
+ if _cues .has (active_cue ):
358
+ _active_cue = active_cue
344
359
345
360
346
361
## Called when this CueList is to be deleted
0 commit comments