From 3511400d4d5d4ea12c62c7ec73ec77ed17227eeb Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Wed, 17 Apr 2024 12:26:31 +0200 Subject: [PATCH] Make sure we save on exit! + Small Glossary Layer cleanup --- .../TimelineEditor/TextEditor/timeline_editor_text.gd | 3 ++- .../TimelineEditor/VisualEditor/timeline_editor_visual.gd | 8 +++----- .../Layer_Glossary/glossary_popup_layer.gd | 7 ------- addons/dialogic/plugin.gd | 6 ++++++ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd b/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd index 583d2d8ea..183b68a2e 100644 --- a/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd +++ b/addons/dialogic/Editor/TimelineEditor/TextEditor/timeline_editor_text.gd @@ -13,6 +13,7 @@ func _ready(): syntax_highlighter = code_completion_helper.syntax_highlighter timeline_editor.editors_manager.sidebar.content_item_activated.connect(_on_content_item_clicked) + func _on_text_editor_text_changed(): timeline_editor.current_resource_state = DialogicEditor.ResourceStates.UNSAVED request_code_completion(true) @@ -40,7 +41,7 @@ func save_timeline(): if !timeline_editor.current_resource: return - var text_array:Array = text_timeline_to_array(text) + var text_array: Array = text_timeline_to_array(text) timeline_editor.current_resource.events = text_array timeline_editor.current_resource.events_processed = false diff --git a/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd b/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd index d2bb98477..79d3637f9 100644 --- a/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd +++ b/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd @@ -486,6 +486,7 @@ func add_events_indexed(indexed_events:Dictionary) -> void: selected_items = events visual_update_selection() indent_events() + something_changed() ## Deletes events based on an indexed dictionary @@ -504,8 +505,8 @@ func delete_events_indexed(indexed_events:Dictionary) -> void: %Timeline.get_child(idx-idx_shift).get_parent().remove_child(%Timeline.get_child(idx-idx_shift)) idx_shift += 1 - something_changed() indent_events() + something_changed() func delete_selected_events() -> void: @@ -530,7 +531,6 @@ func cut_events_indexed(indexed_events:Dictionary) -> void: select_events_indexed(indexed_events) copy_selected_events() delete_events_indexed(indexed_events) - indent_events() func copy_selected_events() -> void: @@ -931,7 +931,6 @@ func _on_event_popup_menu_index_pressed(index:int) -> void: TimelineUndoRedo.add_undo_method(add_events_indexed.bind(events_indexed)) TimelineUndoRedo.commit_action() indent_events() - something_changed() func _on_right_sidebar_resized() -> void: @@ -989,9 +988,7 @@ func duplicate_selected() -> void: var at_index: int = selected_items[-1].get_index()+1 TimelineUndoRedo.create_action("[D] Duplicate "+str(len(events))+" event(s).") TimelineUndoRedo.add_do_method(add_events_at_index.bind(events, at_index)) - TimelineUndoRedo.add_do_method(something_changed) TimelineUndoRedo.add_undo_method(delete_events_at_index.bind(at_index, len(events))) - TimelineUndoRedo.add_undo_method(something_changed) TimelineUndoRedo.commit_action() @@ -1111,6 +1108,7 @@ func _input(event:InputEvent) -> void: TimelineUndoRedo.commit_action() get_viewport().set_input_as_handled() + "Ctrl+X": var events_indexed := get_events_indexed(selected_items) TimelineUndoRedo.create_action("[D] Cut "+str(len(selected_items))+" event(s).") diff --git a/addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/glossary_popup_layer.gd b/addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/glossary_popup_layer.gd index 2511b8788..7b129864a 100644 --- a/addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/glossary_popup_layer.gd +++ b/addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/glossary_popup_layer.gd @@ -74,7 +74,6 @@ func _ready() -> void: _error = text_system.connect(&'animation_textbox_hide', get_pointer().hide) _error = text_system.connect(&'meta_hover_started', _on_dialogic_display_dialog_text_meta_hover_started) _error = text_system.connect(&'meta_hover_ended', _on_dialogic_display_dialog_text_meta_hover_ended) - _error = text_system.connect(&'meta_clicked', _on_dialogic_display_dialog_text_meta_clicked) func _try_translate(tr_base: String, property: StringName, fallback_entry: Dictionary) -> String: @@ -159,8 +158,6 @@ func _on_dialogic_display_dialog_text_meta_hover_started(meta: String) -> void: get_panel().self_modulate = title_color get_panel_point().self_modulate = title_color - DialogicUtil.autoload().Inputs.action_was_consumed = true - ## Method that keeps the bubble at mouse position when visible func _process(_delta: float) -> void: @@ -175,11 +172,7 @@ func _process(_delta: float) -> void: ## Method that hides the bubble func _on_dialogic_display_dialog_text_meta_hover_ended(_meta:String) -> void: get_pointer().hide() - DialogicUtil.autoload().Inputs.action_was_consumed = false - -func _on_dialogic_display_dialog_text_meta_clicked(_meta:String) -> void: - DialogicUtil.autoload().Inputs.action_was_consumed = true func _apply_export_overrides() -> void: diff --git a/addons/dialogic/plugin.gd b/addons/dialogic/plugin.gd index 40de860e2..5e782102e 100644 --- a/addons/dialogic/plugin.gd +++ b/addons/dialogic/plugin.gd @@ -94,6 +94,12 @@ func _save_external_data() -> void: editor_view.editors_manager.save_current_resource() +func _get_unsaved_status(for_scene:String) -> String: + if for_scene.is_empty(): + _save_external_data() + return "" + + func _handles(object) -> bool: if _editor_view_and_manager_exist() and object is Resource: return editor_view.editors_manager.can_edit_resource(object)