Skip to content

Commit 65a1633

Browse files
Multiple fixes (#2056)
* Fix regex for 4.3 (#2049) * Clean visual timeline editor regions. Mark as changed on duplication * Fix #1910
1 parent 1cf2582 commit 65a1633

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed

addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var _timeline_changed_while_loading := false
3030
var selected_items : Array = []
3131

3232

33-
##################### CREATE/SAVE/LOAD #########################################
33+
#region CREATE/SAVE/LOAD
3434
################################################################################
3535

3636
func 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

151152
func _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

249251
func _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

257260
func _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

561569
func _is_item_selected(item: Node) -> bool:
@@ -631,8 +639,10 @@ func select_all_items() -> void:
631639
func 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

678689
func 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

810822
func 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

888900
func _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

950963
func 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+
960976
func _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

addons/dialogic/Modules/Text/event_text.gd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ var character_identifier: String:
3535

3636
# Reference regex without Godot escapes: ((")?(?<name>(?(2)[^"\n]*|[^(: \n]*))(?(2)"|)(\W*\((?<portrait>.*)\))?\s*(?<!\\):)?(?<text>(.|\n)*)
3737
var regex := RegEx.create_from_string("((\")?(?<name>(?(2)[^\"\\n]*|[^(: \\n]*))(?(2)\"|)(\\W*(?<portrait>\\(.*\\)))?\\s*(?<!\\\\):)?(?<text>(.|\\n)*)")
38-
# Reference regex without godot escapes: ((\[n\]|\[n\+\])?((?!(\[n\]|\[n\+\]))(.|\n))*)
39-
var split_regex := RegEx.create_from_string("((\\[n\\]|\\[n\\+\\])?((?!(\\[n\\]|\\[n\\+\\]))(.|\\n))*)")
38+
var split_regex := RegEx.create_from_string(r"((\[n\]|\[n\+\])?((?!(\[n\]|\[n\+\]))(.|\n))+)")
4039

4140
enum States {REVEALING, IDLE, DONE}
4241
var state := States.IDLE

addons/dialogic/Modules/Text/node_dialog_text.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func reveal_text(_text: String, keep_previous:=false) -> void:
7171

7272
else:
7373
base_visible_characters = len(text)
74-
visible_characters = len(text)
74+
visible_characters = len(get_parsed_text())
7575
text = text + _text
7676

7777
# If Auto-Skip is enabled and we append the text (keep_previous),

addons/dialogic/Modules/Variable/variables_editor/variable_tree.gd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,10 @@ func _on_item_edited() -> void:
154154

155155
else:
156156
if item.get_text(0) != item.get_metadata(0):
157-
print("Variable renamed from '", item.get_metadata(0), "' to '", item.get_text(0),"'")
158157
item.set_metadata(0, item.get_text(0))
159158
report_name_changes(item)
160159

161160
2:
162-
print("Variable default changed.")
163161
item.set_metadata(2, get_variable_item_default(item))
164162
"FOLDER":
165163
report_name_changes(item)

0 commit comments

Comments
 (0)