1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Add a resized signal to Project, remove the Global.tile_mode_offset_dialog variable

Continue to slowly remove nodes from `Global`.
This commit is contained in:
Emmanouil Papadeas 2024-08-10 22:47:06 +03:00
parent 1678738d75
commit 19e4c94fe3
5 changed files with 23 additions and 12 deletions

View file

@ -21,11 +21,11 @@ enum ColorFrom { THEME, CUSTOM }
enum ButtonSize { SMALL, BIG } enum ButtonSize { SMALL, BIG }
enum MeasurementMode { NONE, MOVE } enum MeasurementMode { NONE, MOVE }
## Enumeration of items present in the File Menu. ## Enumeration of items present in the File Menu.
enum FileMenu { NEW, OPEN, OPEN_LAST_PROJECT, RECENT, SAVE, SAVE_AS, EXPORT, EXPORT_AS, QUIT } enum FileMenu { NEW, OPEN, OPEN_LAST_PROJECT, RECENT, SAVE, SAVE_AS, EXPORT, EXPORT_AS, QUIT }
## Enumeration of items present in the Edit Menu. ## Enumeration of items present in the Edit Menu.
enum EditMenu { UNDO, REDO, COPY, CUT, PASTE, PASTE_IN_PLACE, DELETE, NEW_BRUSH, PREFERENCES } enum EditMenu { UNDO, REDO, COPY, CUT, PASTE, PASTE_IN_PLACE, DELETE, NEW_BRUSH, PREFERENCES }
## Enumeration of items present in the View Menu. ## Enumeration of items present in the View Menu.
enum ViewMenu { enum ViewMenu {
TILE_MODE, TILE_MODE,
TILE_MODE_OFFSETS, TILE_MODE_OFFSETS,
@ -39,9 +39,9 @@ enum ViewMenu {
DISPLAY_LAYER_EFFECTS, DISPLAY_LAYER_EFFECTS,
SNAP_TO, SNAP_TO,
} }
## Enumeration of items present in the Window Menu. ## Enumeration of items present in the Window Menu.
enum WindowMenu { WINDOW_OPACITY, PANELS, LAYOUTS, MOVABLE_PANELS, ZEN_MODE, FULLSCREEN_MODE } enum WindowMenu { WINDOW_OPACITY, PANELS, LAYOUTS, MOVABLE_PANELS, ZEN_MODE, FULLSCREEN_MODE }
## Enumeration of items present in the Image Menu. ## Enumeration of items present in the Image Menu.
enum ImageMenu { enum ImageMenu {
PROJECT_PROPERTIES, PROJECT_PROPERTIES,
RESIZE_CANVAS, RESIZE_CANVAS,
@ -67,9 +67,9 @@ enum EffectsMenu {
GRADIENT_MAP, GRADIENT_MAP,
SHADER SHADER
} }
## Enumeration of items present in the Select Menu. ## Enumeration of items present in the Select Menu.
enum SelectMenu { SELECT_ALL, CLEAR_SELECTION, INVERT, TILE_MODE } enum SelectMenu { SELECT_ALL, CLEAR_SELECTION, INVERT, TILE_MODE }
## Enumeration of items present in the Help Menu. ## Enumeration of items present in the Help Menu.
enum HelpMenu { enum HelpMenu {
VIEW_SPLASH_SCREEN, VIEW_SPLASH_SCREEN,
ONLINE_DOCS, ONLINE_DOCS,
@ -642,7 +642,6 @@ var cel_button_scene: PackedScene = load("res://src/UI/Timeline/CelButton.tscn")
## The patterns popup dialog used to display patterns ## The patterns popup dialog used to display patterns
## It has the [param PatternsPopup.gd] script attached. ## It has the [param PatternsPopup.gd] script attached.
@onready var patterns_popup: Popup = control.find_child("PatternsPopup") @onready var patterns_popup: Popup = control.find_child("PatternsPopup")
@onready var tile_mode_offset_dialog: AcceptDialog = control.find_child("TileModeOffsetsDialog")
## Dialog used to navigate and open images and projects. ## Dialog used to navigate and open images and projects.
@onready var open_sprites_dialog: FileDialog = control.find_child("OpenSprite") @onready var open_sprites_dialog: FileDialog = control.find_child("OpenSprite")
## Dialog used to save (.pxo) projects. ## Dialog used to save (.pxo) projects.

View file

@ -5,6 +5,7 @@ extends RefCounted
signal serialized(dict: Dictionary) signal serialized(dict: Dictionary)
signal about_to_deserialize(dict: Dictionary) signal about_to_deserialize(dict: Dictionary)
signal resized
signal timeline_updated signal timeline_updated
var name := "": var name := "":
@ -422,9 +423,9 @@ func _size_changed(value: Vector2i) -> void:
else: else:
tiles.y_basis = Vector2i(0, value.y) tiles.y_basis = Vector2i(0, value.y)
tiles.tile_size = value tiles.tile_size = value
Global.tile_mode_offset_dialog.change_mask()
size = value size = value
Global.canvas.crop_rect.reset() Global.canvas.crop_rect.reset()
resized.emit()
func change_cel(new_frame: int, new_layer := -1) -> void: func change_cel(new_frame: int, new_layer := -1) -> void:

View file

@ -20,6 +20,7 @@ var splash_dialog: AcceptDialog:
@onready var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation @onready var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation
@onready var save_sprite_dialog := $Dialogs/SaveSprite as FileDialog @onready var save_sprite_dialog := $Dialogs/SaveSprite as FileDialog
@onready var save_sprite_html5: ConfirmationDialog = $Dialogs/SaveSpriteHTML5 @onready var save_sprite_html5: ConfirmationDialog = $Dialogs/SaveSpriteHTML5
@onready var tile_mode_offsets_dialog: ConfirmationDialog = $Dialogs/TileModeOffsetsDialog
@onready var quit_dialog: ConfirmationDialog = $Dialogs/QuitDialog @onready var quit_dialog: ConfirmationDialog = $Dialogs/QuitDialog
@onready var quit_and_save_dialog: ConfirmationDialog = $Dialogs/QuitAndSaveDialog @onready var quit_and_save_dialog: ConfirmationDialog = $Dialogs/QuitAndSaveDialog
@onready var download_confirmation := $Dialogs/DownloadImageConfirmationDialog as ConfirmationDialog @onready var download_confirmation := $Dialogs/DownloadImageConfirmationDialog as ConfirmationDialog

View file

@ -9,12 +9,22 @@ extends ConfirmationDialog
func _ready() -> void: func _ready() -> void:
Global.project_about_to_switch.connect(_project_about_to_switch)
Global.project_switched.connect(_project_switched)
Global.project_switched.connect(change_mask) Global.project_switched.connect(change_mask)
Global.cel_switched.connect(change_mask) Global.cel_switched.connect(change_mask)
await get_tree().process_frame await get_tree().process_frame
change_mask() change_mask()
func _project_about_to_switch() -> void:
Global.current_project.resized.disconnect(change_mask)
func _project_switched() -> void:
Global.current_project.resized.connect(change_mask)
func _on_TileModeOffsetsDialog_about_to_show() -> void: func _on_TileModeOffsetsDialog_about_to_show() -> void:
tile_mode.draw_center = true tile_mode.draw_center = true
tile_mode.tiles = Tiles.new(Global.current_project.size) tile_mode.tiles = Tiles.new(Global.current_project.size)

View file

@ -592,7 +592,7 @@ func edit_menu_id_pressed(id: int) -> void:
func view_menu_id_pressed(id: int) -> void: func view_menu_id_pressed(id: int) -> void:
match id: match id:
Global.ViewMenu.TILE_MODE_OFFSETS: Global.ViewMenu.TILE_MODE_OFFSETS:
_popup_dialog(Global.tile_mode_offset_dialog) _popup_dialog(get_tree().current_scene.tile_mode_offsets_dialog)
Global.ViewMenu.GREYSCALE_VIEW: Global.ViewMenu.GREYSCALE_VIEW:
_toggle_greyscale_view() _toggle_greyscale_view()
Global.ViewMenu.MIRROR_VIEW: Global.ViewMenu.MIRROR_VIEW:
@ -638,7 +638,7 @@ func _tile_mode_submenu_id_pressed(id: Tiles.MODE) -> void:
Global.canvas.tile_mode.queue_redraw() Global.canvas.tile_mode.queue_redraw()
Global.canvas.pixel_grid.queue_redraw() Global.canvas.pixel_grid.queue_redraw()
Global.canvas.grid.queue_redraw() Global.canvas.grid.queue_redraw()
Global.tile_mode_offset_dialog.change_mask() get_tree().current_scene.tile_mode_offsets_dialog.change_mask()
func _snap_to_submenu_id_pressed(id: int) -> void: func _snap_to_submenu_id_pressed(id: int) -> void:
@ -846,7 +846,7 @@ func select_menu_id_pressed(id: int) -> void:
func help_menu_id_pressed(id: int) -> void: func help_menu_id_pressed(id: int) -> void:
match id: match id:
Global.HelpMenu.VIEW_SPLASH_SCREEN: Global.HelpMenu.VIEW_SPLASH_SCREEN:
_popup_dialog(Global.control.splash_dialog) _popup_dialog(get_tree().current_scene.splash_dialog)
Global.HelpMenu.ONLINE_DOCS: Global.HelpMenu.ONLINE_DOCS:
OS.shell_open(DOCS_URL) OS.shell_open(DOCS_URL)
SteamManager.set_achievement("ACH_ONLINE_DOCS") SteamManager.set_achievement("ACH_ONLINE_DOCS")