@@ -30,7 +30,7 @@ var _timeline_changed_while_loading := false
3030var selected_items : Array = []
3131
3232
33- ## ################### CREATE/SAVE/LOAD #########################################
33+ #region CREATE/SAVE/LOAD
3434## ##############################################################################
3535
3636func something_changed ():
@@ -143,9 +143,10 @@ func clear_timeline_nodes():
143143 deselect_all_items ()
144144 for event in % Timeline .get_children ():
145145 event .free ()
146+ #endregion
146147
147148
148- ## ################### SETUP ####################################################
149+ #region SETUP
149150## ##############################################################################
150151
151152func _ready ():
@@ -241,17 +242,19 @@ func load_event_buttons() -> void:
241242
242243 $ View .split_offset = - 200 * _scale
243244 _on_right_sidebar_resized ()
245+ #endregion
244246
245247
246- ## ################## CLEANUP ###################################################
248+ #region CLEANUP
247249## ##############################################################################
248250
249251func _exit_tree () -> void :
250252 # Explicitly free any open cache resources on close, so we don't get leaked resource errors on shutdown
251253 clear_timeline_nodes ()
254+ #endregion
252255
253256
254- ## ################### CONTENT LIST #############################################
257+ #region CONTENT LIST
255258## ##############################################################################
256259
257260func _on_content_item_clicked (label :String ) -> void :
@@ -272,9 +275,10 @@ func update_content_list():
272275 if 'event_name' in event .resource and event .resource is DialogicLabelEvent :
273276 labels .append (event .resource .name )
274277 timeline_editor .editors_manager .sidebar .update_content_list (labels )
278+ #endregion
275279
276280
277- ## ############### DRAG & DROP + DRAGGING EVENTS ################################
281+ #region DRAG & DROP + DRAGGING EVENTS
278282## ###############################################################################
279283
280284# SIGNAL handles input on the events mainly for selection and moving events
@@ -318,9 +322,10 @@ func _on_timeline_area_drag_completed(type:int, index:int, data:Variant) -> void
318322 something_changed ()
319323 scroll_to_piece (index )
320324 indent_events ()
325+ #endregion
321326
322327
323- ## ############### CREATING THE TIMELINE ########################################
328+ #region CREATING THE TIMELINE
324329## ##############################################################################
325330
326331# Adding an event to the timeline
@@ -381,9 +386,10 @@ func add_event_with_end_branch(resource, at_index:int=-1, auto_select:bool = fal
381386 var event := add_event_node (resource , at_index , auto_select , indent )
382387 create_end_branch_event (at_index + 1 , event )
383388
389+ #endregion
384390
385391
386- ## ################## DELETING, COPY, PASTE #####################################
392+ #region DELETING, COPY, PASTE
387393## ##############################################################################
388394
389395## Lists the given events (as text) based on their indexes.
@@ -554,8 +560,10 @@ func delete_events_at_index(at_index:int, amount:int = 1)-> void:
554560 delete_events_indexed (new_indexed_events )
555561 indent_events ()
556562
563+ #endregion
557564
558- ## ################## BLOCK SELECTION ###########################################
565+
566+ #region BLOCK SELECTION
559567## ##############################################################################
560568
561569func _is_item_selected (item : Node ) -> bool :
@@ -631,8 +639,10 @@ func select_all_items() -> void:
631639func deselect_all_items () -> void :
632640 selected_items = []
633641 visual_update_selection ()
642+ #endregion
643+
634644
635- ## ########## CREATING NEW EVENTS USING THE BUTTONS #############################
645+ #region CREATING NEW EVENTS USING THE BUTTONS
636646## ##############################################################################
637647
638648# Event Creation signal for buttons
@@ -670,9 +680,10 @@ func _add_event_button_pressed(event_resource:DialogicEvent, force_resource := f
670680 something_changed ()
671681 scroll_to_piece (at_index )
672682 indent_events ()
683+ #endregion
673684
674685
675- ## ################### BLOCK GETTERS ############################################
686+ #region BLOCK GETTERS
676687## ##############################################################################
677688
678689func get_block_above (block :Node ) -> Node :
@@ -685,9 +696,10 @@ func get_block_below(block:Node) -> Node:
685696 if block .get_index () < % Timeline .get_child_count () - 1 :
686697 return % Timeline .get_child (block .get_index () + 1 )
687698 return null
699+ #endregion
688700
689701
690- ## ################### BLOCK MOVEMENT ###########################################
702+ #region BLOCK MOVEMENT
691703## ##############################################################################
692704
693705
@@ -801,10 +813,10 @@ func offset_blocks_by_index(blocks:Array, offset:int):
801813 TimelineUndoRedo .add_undo_method (move_events_by_indexes .bind (undo_indexes ))
802814
803815 TimelineUndoRedo .commit_action ()
816+ #endregion
804817
805818
806-
807- ## ################# VISIBILITY/VISUALS #########################################
819+ #region VISIBILITY/VISUALS
808820## ##############################################################################
809821
810822func scroll_to_piece (piece_index :int ) -> void :
@@ -879,10 +891,10 @@ func indent_events() -> void:
879891 indent += delayed_indent
880892
881893 % TimelineArea .queue_redraw ()
894+ #endregion
882895
883896
884-
885- ## ############## SPECIAL BLOCK OPERATIONS ######################################
897+ #region SPECIAL BLOCK OPERATIONS
886898## ##############################################################################
887899
888900func _on_event_popup_menu_index_pressed (index :int ) -> void :
@@ -942,9 +954,10 @@ func _on_right_sidebar_resized():
942954 elif con .get_child (0 ) is Button :
943955 for button in con .get_children ():
944956 button .toggle_name (true )
957+ #endregion
945958
946959
947- ## ################## SHORTCUTS #################################################
960+ #region SHORTCUTS
948961## ##############################################################################
949962
950963func duplicate_selected () -> void :
@@ -953,10 +966,13 @@ func duplicate_selected() -> void:
953966 var at_index : int = selected_items [- 1 ].get_index ()+ 1
954967 TimelineUndoRedo .create_action ("[D] Duplicate " + str (len (events ))+ " event(s)." )
955968 TimelineUndoRedo .add_do_method (add_events_at_index .bind (events , at_index ))
969+ TimelineUndoRedo .add_do_method (something_changed )
956970 TimelineUndoRedo .add_undo_method (delete_events_at_index .bind (at_index , len (events )))
971+ TimelineUndoRedo .add_undo_method (something_changed )
957972 TimelineUndoRedo .commit_action ()
958973
959974
975+
960976func _input (event :InputEvent ) -> void :
961977 # we protect this with is_visible_in_tree to not
962978 # invoke a shortcut by accident
@@ -1126,3 +1142,5 @@ func get_previous_character(double_previous := false) -> DialogicCharacter:
11261142 character = % Timeline .get_child (idx ).resource .character
11271143 break
11281144 return character
1145+
1146+ #endregion
0 commit comments