From d3db8f5be743cc25645748673c168ee12cb50c38 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Thu, 22 Feb 2024 17:43:47 +0200 Subject: [PATCH] Rename `project_changed` to `project_data_changed` signal, add a new method for this signal in ExtensionsAPI --- src/Autoload/ExtensionsApi.gd | 27 ++++++++++++++++----------- src/Autoload/Global.gd | 2 +- src/Classes/Project.gd | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Autoload/ExtensionsApi.gd b/src/Autoload/ExtensionsApi.gd index a6156e8b3bc..c49ce97dca0 100644 --- a/src/Autoload/ExtensionsApi.gd +++ b/src/Autoload/ExtensionsApi.gd @@ -742,40 +742,45 @@ class SignalsAPI: ExtensionsApi.remove_action("SignalsAPI", signal_class.get_name()) # APP RELATED SIGNALS - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## when pixelorama is just opened. func signal_pixelorama_opened(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(Global.pixelorama_opened, callable, is_disconnecting) - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## when pixelorama is about to close. func signal_pixelorama_about_to_close(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(Global.pixelorama_about_to_close, callable, is_disconnecting) # PROJECT RELATED SIGNALS - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever a new project is created.[br] ## [b]Binds: [/b]It has one bind of type [code]Project[/code] which is the newly created project func signal_project_created(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(Global.project_created, callable, is_disconnecting) - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## after a project is saved. func signal_project_saved(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(OpenSave.project_saved, callable, is_disconnecting) - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever you switch to some other project. func signal_project_switched(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(Global.project_switched, callable, is_disconnecting) - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever you select a different cel. func signal_cel_switched(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(Global.cel_switched, callable, is_disconnecting) + ## Connects/disconnects a signal to [param callable], that emits + ## whenever the project data are being modified. + func signal_project_data_changed(callable: Callable, is_disconnecting := false) -> void: + _connect_disconnect(Global.project_data_changed, callable, is_disconnecting) + # TOOL RELATED SIGNALS - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever a tool changes color.[br] ## [b]Binds: [/b] It has two bind of type [Color] (indicating new color) ## and [int] (Indicating button that tool is assigned to, see [enum @GlobalScope.MouseButton]) @@ -783,14 +788,14 @@ class SignalsAPI: _connect_disconnect(Tools.color_changed, callable, is_disconnecting) # TIMELINE RELATED SIGNALS - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever timeline animation starts.[br] ## [b]Binds: [/b] It has one bind of type [bool] which indicated if animation is in ## forward direction ([code]true[/code]) or backward direction ([code]false[/code]) func signal_timeline_animation_started(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(Global.animation_timeline.animation_started, callable, is_disconnecting) - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever timeline animation stops. func signal_timeline_animation_finished(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect( @@ -798,12 +803,12 @@ class SignalsAPI: ) # UPDATER SIGNALS - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever texture of the currently focused cel changes. func signal_current_cel_texture_changed(callable: Callable, is_disconnecting := false) -> void: _connect_disconnect(texture_changed, callable, is_disconnecting) - ## connects/disconnects a signal to [param callable], that emits + ## Connects/disconnects a signal to [param callable], that emits ## whenever preview is about to be drawn.[br] ## [b]Binds: [/b]It has one bind of type [Dictionary] with keys: [code]exporter_id[/code], ## [code]export_tab[/code], [code]preview_images[/code], [code]durations[/code] diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 8aaab3ba9c8..9c16ce45de6 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -11,7 +11,7 @@ signal project_created(project: Project) ## Emitted when a new project class is signal project_about_to_switch ## Emitted before a project is about to be switched signal project_switched ## Emitted whenever you switch to some other project tab. signal cel_switched ## Emitted whenever you select a different cel. -signal project_changed(project: Project) ## Emitted when project data is modified. +signal project_data_changed(project: Project) ## Emitted when project data is modified. enum LayerTypes { PIXEL, GROUP, THREE_D } enum GridTypes { CARTESIAN, ISOMETRIC, ALL } diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 887fa70d3c4..9d294fcfca4 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -23,7 +23,7 @@ var has_changed := false: set(value): has_changed = value if value: - Global.project_changed.emit(self) + Global.project_data_changed.emit(self) Global.tabs.set_tab_title(Global.tabs.current_tab, name + "(*)") else: Global.tabs.set_tab_title(Global.tabs.current_tab, name)