mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
parent
90dd325b08
commit
a5151bf739
|
@ -94,7 +94,7 @@ class GeneralAPI:
|
||||||
func get_drawing_algos() -> DrawingAlgos:
|
func get_drawing_algos() -> DrawingAlgos:
|
||||||
return DrawingAlgos
|
return DrawingAlgos
|
||||||
|
|
||||||
func get_shader_image_effect() -> ShaderImageEffect:
|
func get_new_shader_image_effect() -> ShaderImageEffect:
|
||||||
return ShaderImageEffect.new()
|
return ShaderImageEffect.new()
|
||||||
|
|
||||||
func get_extensions_node() -> Node:
|
func get_extensions_node() -> Node:
|
||||||
|
@ -549,37 +549,77 @@ class SignalsAPI:
|
||||||
func _on_texture_changed():
|
func _on_texture_changed():
|
||||||
texture_changed.emit()
|
texture_changed.emit()
|
||||||
|
|
||||||
# Global signals
|
# GLOBAL SIGNALS
|
||||||
func connect_project_changed(target: Object, method: String):
|
# pixelorama_opened
|
||||||
Global.project_changed.connect(Callable(target, method))
|
func connect_pixelorama_opened(callable: Callable):
|
||||||
|
Global.pixelorama_opened.connect(callable)
|
||||||
|
ExtensionsApi.add_action("pixelorama_opened")
|
||||||
|
|
||||||
|
func disconnect_pixelorama_opened(callable: Callable):
|
||||||
|
Global.pixelorama_opened.disconnect(callable)
|
||||||
|
ExtensionsApi.remove_action("pixelorama_opened")
|
||||||
|
|
||||||
|
# pixelorama_about_to_close
|
||||||
|
func connect_pixelorama_about_to_close(callable: Callable):
|
||||||
|
Global.pixelorama_about_to_close.connect(callable)
|
||||||
|
ExtensionsApi.add_action("pixelorama_about_to_close")
|
||||||
|
|
||||||
|
func disconnect_pixelorama_about_to_close(callable: Callable):
|
||||||
|
Global.pixelorama_about_to_close.disconnect(callable)
|
||||||
|
ExtensionsApi.remove_action("pixelorama_about_to_close")
|
||||||
|
|
||||||
|
# project_created -> signal has argument of type "Project"
|
||||||
|
func connect_project_created(callable: Callable):
|
||||||
|
Global.project_created.connect(callable)
|
||||||
|
ExtensionsApi.add_action("project_created")
|
||||||
|
|
||||||
|
func disconnect_project_created(callable: Callable):
|
||||||
|
Global.project_created.disconnect(callable)
|
||||||
|
ExtensionsApi.remove_action("project_created")
|
||||||
|
|
||||||
|
# project_saved
|
||||||
|
func connect_project_about_to_save(callable: Callable):
|
||||||
|
Global.project_saved.connect(callable)
|
||||||
|
ExtensionsApi.add_action("project_saved")
|
||||||
|
|
||||||
|
func disconnect_project_saved(callable: Callable):
|
||||||
|
Global.project_saved.disconnect(callable)
|
||||||
|
ExtensionsApi.remove_action("project_saved")
|
||||||
|
|
||||||
|
# project_changed
|
||||||
|
func connect_project_changed(callable: Callable):
|
||||||
|
Global.project_changed.connect(callable)
|
||||||
ExtensionsApi.add_action("project_changed")
|
ExtensionsApi.add_action("project_changed")
|
||||||
|
|
||||||
func disconnect_project_changed(target: Object, method: String):
|
func disconnect_project_changed(callable: Callable):
|
||||||
Global.project_changed.disconnect(Callable(target, method))
|
Global.project_changed.disconnect(callable)
|
||||||
ExtensionsApi.remove_action("project_changed")
|
ExtensionsApi.remove_action("project_changed")
|
||||||
|
|
||||||
func connect_cel_changed(target: Object, method: String):
|
# cel_changed
|
||||||
Global.cel_changed.connect(Callable(target, method))
|
func connect_cel_changed(callable: Callable):
|
||||||
|
Global.cel_changed.connect(callable)
|
||||||
ExtensionsApi.add_action("cel_changed")
|
ExtensionsApi.add_action("cel_changed")
|
||||||
|
|
||||||
func disconnect_cel_changed(target: Object, method: String):
|
func disconnect_cel_changed(callable: Callable):
|
||||||
Global.cel_changed.disconnect(Callable(target, method))
|
Global.cel_changed.disconnect(callable)
|
||||||
ExtensionsApi.remove_action("cel_changed")
|
ExtensionsApi.remove_action("cel_changed")
|
||||||
|
|
||||||
# Tool Signal
|
# TOOL SIGNALs
|
||||||
func connect_tool_color_changed(target: Object, method: String):
|
# cel_changed
|
||||||
Tools.color_changed.connect(Callable(target, method))
|
func connect_tool_color_changed(callable: Callable):
|
||||||
|
Tools.color_changed.connect(callable)
|
||||||
ExtensionsApi.add_action("color_changed")
|
ExtensionsApi.add_action("color_changed")
|
||||||
|
|
||||||
func disconnect_tool_color_changed(target: Object, method: String):
|
func disconnect_tool_color_changed(callable: Callable):
|
||||||
Tools.color_changed.disconnect(Callable(target, method))
|
Tools.color_changed.disconnect(callable)
|
||||||
ExtensionsApi.remove_action("color_changed")
|
ExtensionsApi.remove_action("color_changed")
|
||||||
|
|
||||||
# updater signals
|
# UPDATER SIGNALS
|
||||||
func connect_current_cel_texture_changed(target: Object, method: String):
|
# current_cel_texture_changed
|
||||||
texture_changed.connect(Callable(target, method))
|
func connect_current_cel_texture_changed(callable: Callable):
|
||||||
|
texture_changed.connect(callable)
|
||||||
ExtensionsApi.add_action("texture_changed")
|
ExtensionsApi.add_action("texture_changed")
|
||||||
|
|
||||||
func disconnect_current_cel_texture_changed(target: Object, method: String):
|
func disconnect_current_cel_texture_changed(callable: Callable):
|
||||||
texture_changed.disconnect(Callable(target, method))
|
texture_changed.disconnect(callable)
|
||||||
ExtensionsApi.remove_action("texture_changed")
|
ExtensionsApi.remove_action("texture_changed")
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
signal pixelorama_opened
|
||||||
|
signal pixelorama_about_to_close
|
||||||
|
signal project_created(Project)
|
||||||
signal project_changed
|
signal project_changed
|
||||||
signal cel_changed
|
signal cel_changed
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# gdlint: ignore=max-public-methods
|
# gdlint: ignore=max-public-methods
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
signal project_saved
|
||||||
|
|
||||||
var current_save_paths: PackedStringArray = []
|
var current_save_paths: PackedStringArray = []
|
||||||
## Stores a filename of a backup file in user:// until user saves manually
|
## Stores a filename of a backup file in user:// until user saves manually
|
||||||
var backup_save_paths: PackedStringArray = []
|
var backup_save_paths: PackedStringArray = []
|
||||||
|
@ -301,6 +303,7 @@ func save_pxo_file(
|
||||||
Global.top_menu_container.file_menu.set_item_text(
|
Global.top_menu_container.file_menu.set_item_text(
|
||||||
Global.FileMenu.SAVE, tr("Save") + " %s" % path.get_file()
|
Global.FileMenu.SAVE, tr("Save") + " %s" % path.get_file()
|
||||||
)
|
)
|
||||||
|
project_saved.emit()
|
||||||
|
|
||||||
save_project_to_recent_list(path)
|
save_project_to_recent_list(path)
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -3,6 +3,9 @@ class_name Project
|
||||||
extends RefCounted
|
extends RefCounted
|
||||||
## A class for project properties.
|
## A class for project properties.
|
||||||
|
|
||||||
|
signal serialized(Dictionary)
|
||||||
|
signal about_to_deserialize(Dictionary)
|
||||||
|
|
||||||
var name := "":
|
var name := "":
|
||||||
set(value):
|
set(value):
|
||||||
name = value
|
name = value
|
||||||
|
@ -102,6 +105,7 @@ func _init(_frames: Array[Frame] = [], _name := tr("untitled"), _size := Vector2
|
||||||
directory_path = Global.config_cache.get_value(
|
directory_path = Global.config_cache.get_value(
|
||||||
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
|
"data", "current_dir", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP)
|
||||||
)
|
)
|
||||||
|
Global.project_created.emit(self)
|
||||||
|
|
||||||
|
|
||||||
func remove() -> void:
|
func remove() -> void:
|
||||||
|
@ -332,10 +336,12 @@ func serialize() -> Dictionary:
|
||||||
"metadata": metadata
|
"metadata": metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serialized.emit(project_data)
|
||||||
return project_data
|
return project_data
|
||||||
|
|
||||||
|
|
||||||
func deserialize(dict: Dictionary) -> void:
|
func deserialize(dict: Dictionary) -> void:
|
||||||
|
about_to_deserialize.emit(dict)
|
||||||
if dict.has("size_x") and dict.has("size_y"):
|
if dict.has("size_x") and dict.has("size_y"):
|
||||||
size.x = dict.size_x
|
size.x = dict.size_x
|
||||||
size.y = dict.size_y
|
size.y = dict.size_y
|
||||||
|
|
|
@ -67,6 +67,7 @@ func _ready() -> void:
|
||||||
OS.request_permissions()
|
OS.request_permissions()
|
||||||
|
|
||||||
_show_splash_screen()
|
_show_splash_screen()
|
||||||
|
Global.pixelorama_opened.emit()
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
@ -348,6 +349,7 @@ func _on_QuitAndSaveDialog_confirmed() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _quit() -> void:
|
func _quit() -> void:
|
||||||
|
Global.pixelorama_about_to_close.emit()
|
||||||
# Darken the UI to denote that the application is currently exiting
|
# Darken the UI to denote that the application is currently exiting
|
||||||
# (it won't respond to user input in this state).
|
# (it won't respond to user input in this state).
|
||||||
modulate = Color(0.5, 0.5, 0.5)
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
Loading…
Reference in a new issue