Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure we save on exit! + Small Glossary Layer cleanup #2186

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -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).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions addons/dialogic/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading