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

Renamed enums to follow recommended naming convention (#437)

This commit is contained in:
kleonc 2021-01-20 15:59:42 +01:00 committed by GitHub
parent f189cef78d
commit 63838964b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 113 additions and 113 deletions

View file

@ -1,11 +1,11 @@
extends Node extends Node
enum Grid_Types {CARTESIAN, ISOMETRIC, ALL} enum GridTypes {CARTESIAN, ISOMETRIC, ALL}
enum Pressure_Sensitivity {NONE, ALPHA, SIZE, ALPHA_AND_SIZE} enum PressureSensitivity {NONE, ALPHA, SIZE, ALPHA_AND_SIZE}
enum Direction {UP, DOWN, LEFT, RIGHT} enum Direction {UP, DOWN, LEFT, RIGHT}
enum Theme_Types {DARK, BLUE, CARAMEL, LIGHT} enum ThemeTypes {DARK, BLUE, CARAMEL, LIGHT}
enum Tile_Mode {NONE, BOTH, XAXIS, YAXIS} enum TileMode {NONE, BOTH, X_AXIS, Y_AXIS}
# Stuff for arrowkey-based canvas movements nyaa ^.^ # Stuff for arrowkey-based canvas movements nyaa ^.^
const low_speed_move_rate := 150.0 const low_speed_move_rate := 150.0
const medium_speed_move_rate := 750.0 const medium_speed_move_rate := 750.0
@ -43,15 +43,15 @@ var show_y_symmetry_axis := false
var default_clear_color := Color.gray var default_clear_color := Color.gray
# Preferences # Preferences
var pressure_sensitivity_mode = Pressure_Sensitivity.NONE var pressure_sensitivity_mode = PressureSensitivity.NONE
var open_last_project := false var open_last_project := false
var shrink := 1.0 var shrink := 1.0
var smooth_zoom := true var smooth_zoom := true
var theme_type : int = Theme_Types.DARK var theme_type : int = ThemeTypes.DARK
var default_image_width := 64 var default_image_width := 64
var default_image_height := 64 var default_image_height := 64
var default_fill_color := Color(0, 0, 0, 0) var default_fill_color := Color(0, 0, 0, 0)
var grid_type = Grid_Types.CARTESIAN var grid_type = GridTypes.CARTESIAN
var grid_width := 2 var grid_width := 2
var grid_height := 2 var grid_height := 2
var grid_isometric_cell_bounds_width := 16 var grid_isometric_cell_bounds_width := 16
@ -232,11 +232,11 @@ func _ready() -> void:
tile_mode_submenu = PopupMenu.new() tile_mode_submenu = PopupMenu.new()
tile_mode_submenu.set_name("tile_mode_submenu") tile_mode_submenu.set_name("tile_mode_submenu")
tile_mode_submenu.add_radio_check_item("None", Tile_Mode.NONE) tile_mode_submenu.add_radio_check_item("None", TileMode.NONE)
tile_mode_submenu.set_item_checked(Tile_Mode.NONE, true) tile_mode_submenu.set_item_checked(TileMode.NONE, true)
tile_mode_submenu.add_radio_check_item("Tiled In Both Axis", Tile_Mode.BOTH) tile_mode_submenu.add_radio_check_item("Tiled In Both Axis", TileMode.BOTH)
tile_mode_submenu.add_radio_check_item("Tiled In X Axis", Tile_Mode.XAXIS) tile_mode_submenu.add_radio_check_item("Tiled In X Axis", TileMode.X_AXIS)
tile_mode_submenu.add_radio_check_item("Tiled In Y Axis", Tile_Mode.YAXIS) tile_mode_submenu.add_radio_check_item("Tiled In Y Axis", TileMode.Y_AXIS)
tile_mode_submenu.hide_on_checkable_item_selection = false tile_mode_submenu.hide_on_checkable_item_selection = false
new_image_dialog = find_node_by_name(root, "CreateNewImage") new_image_dialog = find_node_by_name(root, "CreateNewImage")
@ -426,8 +426,8 @@ func disable_button(button : BaseButton, disable : bool) -> void:
if button is Button: if button is Button:
var theme := theme_type var theme := theme_type
if theme == Theme_Types.CARAMEL: if theme == ThemeTypes.CARAMEL:
theme = Theme_Types.DARK theme = ThemeTypes.DARK
for c in button.get_children(): for c in button.get_children():
if c is TextureRect: if c is TextureRect:
var normal_file_name = c.texture.resource_path.get_file().trim_suffix(".png").replace("_disabled", "") var normal_file_name = c.texture.resource_path.get_file().trim_suffix(".png").replace("_disabled", "")

View file

@ -186,7 +186,7 @@ func handle_draw(position : Vector2, event : InputEvent) -> void:
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
if Engine.get_version_info().major == 3 && Engine.get_version_info().minor >= 2: if Engine.get_version_info().major == 3 && Engine.get_version_info().minor >= 2:
pen_pressure = event.pressure pen_pressure = event.pressure
if Global.pressure_sensitivity_mode == Global.Pressure_Sensitivity.NONE: if Global.pressure_sensitivity_mode == Global.PressureSensitivity.NONE:
pen_pressure = 1.0 pen_pressure = 1.0
if not position.is_equal_approx(_last_position): if not position.is_equal_approx(_last_position):

View file

@ -5,7 +5,7 @@ class_name Project extends Reference
var name := "" setget name_changed var name := "" setget name_changed
var size : Vector2 setget size_changed var size : Vector2 setget size_changed
var undo_redo : UndoRedo var undo_redo : UndoRedo
var tile_mode : int = Global.Tile_Mode.NONE var tile_mode : int = Global.TileMode.NONE
var undos := 0 # The number of times we added undo properties var undos := 0 # The number of times we added undo properties
var has_changed := false setget has_changed_changed var has_changed := false setget has_changed_changed
var frames := [] setget frames_changed # Array of Frames (that contain Cels) var frames := [] setget frames_changed # Array of Frames (that contain Cels)
@ -205,7 +205,7 @@ func change_project() -> void:
else: else:
Global.file_menu.get_popup().set_item_text(6, tr("Export") + " %s" % (file_name + Export.file_format_string(file_format))) Global.file_menu.get_popup().set_item_text(6, tr("Export") + " %s" % (file_name + Export.file_format_string(file_format)))
for j in Global.Tile_Mode.values(): for j in Global.TileMode.values():
Global.tile_mode_submenu.set_item_checked(j, j == tile_mode) Global.tile_mode_submenu.set_item_checked(j, j == tile_mode)
@ -445,7 +445,7 @@ func frame_changed(value : int) -> void:
for i in frames.size(): for i in frames.size():
var text_color := Color.white var text_color := Color.white
if Global.theme_type == Global.Theme_Types.CARAMEL || Global.theme_type == Global.Theme_Types.LIGHT: if Global.theme_type == Global.ThemeTypes.CARAMEL || Global.theme_type == Global.ThemeTypes.LIGHT:
text_color = Color.black text_color = Color.black
Global.frame_ids.get_child(i).add_color_override("font_color", text_color) Global.frame_ids.get_child(i).add_color_override("font_color", text_color)
for layer in layers: # De-select all the other frames for layer in layers: # De-select all the other frames
@ -569,12 +569,12 @@ func has_changed_changed(value : bool) -> void:
func get_tile_mode_rect() -> Rect2: func get_tile_mode_rect() -> Rect2:
match Global.current_project.tile_mode: match Global.current_project.tile_mode:
Global.Tile_Mode.NONE: Global.TileMode.NONE:
return Rect2(Vector2.ZERO, size) return Rect2(Vector2.ZERO, size)
Global.Tile_Mode.XAXIS: Global.TileMode.X_AXIS:
return Rect2(Vector2(-1, 0) * size, Vector2(3, 1) * size) return Rect2(Vector2(-1, 0) * size, Vector2(3, 1) * size)
Global.Tile_Mode.YAXIS: Global.TileMode.Y_AXIS:
return Rect2(Vector2(0, -1) * size, Vector2(1, 3) * size) return Rect2(Vector2(0, -1) * size, Vector2(1, 3) * size)
Global.Tile_Mode.BOTH: Global.TileMode.BOTH:
return Rect2(Vector2(-1, -1) * size, Vector2(3, 3) * size) return Rect2(Vector2(-1, -1) * size, Vector2(3, 3) * size)
return Rect2() return Rect2()

View file

@ -55,15 +55,15 @@ func change_theme(ID : int) -> void:
var font = Global.control.theme.default_font var font = Global.control.theme.default_font
var main_theme : Theme = themes[ID][0] var main_theme : Theme = themes[ID][0]
if ID == 0 or ID == 1: # Dark or Gray Theme if ID == 0 or ID == 1: # Dark or Gray Theme
Global.theme_type = Global.Theme_Types.DARK Global.theme_type = Global.ThemeTypes.DARK
elif ID == 2: # Godot's Theme elif ID == 2: # Godot's Theme
Global.theme_type = Global.Theme_Types.BLUE Global.theme_type = Global.ThemeTypes.BLUE
elif ID == 3: # Caramel Theme elif ID == 3: # Caramel Theme
Global.theme_type = Global.Theme_Types.CARAMEL Global.theme_type = Global.ThemeTypes.CARAMEL
elif ID == 4: # Light Theme elif ID == 4: # Light Theme
Global.theme_type = Global.Theme_Types.LIGHT Global.theme_type = Global.ThemeTypes.LIGHT
elif ID == 5: # Purple Theme elif ID == 5: # Purple Theme
Global.theme_type = Global.Theme_Types.DARK Global.theme_type = Global.ThemeTypes.DARK
Global.control.theme = main_theme Global.control.theme = main_theme
Global.control.theme.default_font = font Global.control.theme.default_font = font
@ -95,10 +95,10 @@ func change_theme(ID : int) -> void:
var button_category = button.texture_normal.resource_path.get_base_dir().right(last_backslash + 1) var button_category = button.texture_normal.resource_path.get_base_dir().right(last_backslash + 1)
var normal_file_name = button.texture_normal.resource_path.get_file() var normal_file_name = button.texture_normal.resource_path.get_file()
var theme_type := Global.theme_type var theme_type := Global.theme_type
if theme_type == Global.Theme_Types.BLUE: if theme_type == Global.ThemeTypes.BLUE:
theme_type = Global.Theme_Types.DARK theme_type = Global.ThemeTypes.DARK
var theme_type_string : String = Global.Theme_Types.keys()[theme_type].to_lower() var theme_type_string : String = Global.ThemeTypes.keys()[theme_type].to_lower()
button.texture_normal = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name]) button.texture_normal = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name])
if button.texture_pressed: if button.texture_pressed:
var pressed_file_name = button.texture_pressed.resource_path.get_file() var pressed_file_name = button.texture_pressed.resource_path.get_file()
@ -121,10 +121,10 @@ func change_theme(ID : int) -> void:
var button_category = texture.texture.resource_path.get_base_dir().right(last_backslash + 1) var button_category = texture.texture.resource_path.get_base_dir().right(last_backslash + 1)
var normal_file_name = texture.texture.resource_path.get_file() var normal_file_name = texture.texture.resource_path.get_file()
var theme_type := Global.theme_type var theme_type := Global.theme_type
if theme_type == Global.Theme_Types.CARAMEL or (theme_type == Global.Theme_Types.BLUE and button_category != "tools"): if theme_type == Global.ThemeTypes.CARAMEL or (theme_type == Global.ThemeTypes.BLUE and button_category != "tools"):
theme_type = Global.Theme_Types.DARK theme_type = Global.ThemeTypes.DARK
var theme_type_string : String = Global.Theme_Types.keys()[theme_type].to_lower() var theme_type_string : String = Global.ThemeTypes.keys()[theme_type].to_lower()
texture.texture = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name]) texture.texture = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name])
# Make sure the frame text gets updated # Make sure the frame text gets updated

View file

@ -9,9 +9,9 @@ var node : Node
func _ready() -> void: func _ready() -> void:
# Handle themes # Handle themes
if Global.theme_type == Global.Theme_Types.LIGHT: if Global.theme_type == Global.ThemeTypes.LIGHT:
texture_normal = load("res://assets/graphics/light_themes/misc/icon_reload.png") texture_normal = load("res://assets/graphics/light_themes/misc/icon_reload.png")
elif Global.theme_type == Global.Theme_Types.CARAMEL: elif Global.theme_type == Global.ThemeTypes.CARAMEL:
texture_normal = load("res://assets/graphics/caramel_themes/misc/icon_reload.png") texture_normal = load("res://assets/graphics/caramel_themes/misc/icon_reload.png")

View file

@ -180,7 +180,7 @@ func draw_tool(position : Vector2) -> void:
if Global.current_project.layers[Global.current_project.current_layer].locked: if Global.current_project.layers[Global.current_project.current_layer].locked:
return return
var strength := _strength var strength := _strength
if Global.pressure_sensitivity_mode == Global.Pressure_Sensitivity.ALPHA: if Global.pressure_sensitivity_mode == Global.PressureSensitivity.ALPHA:
strength *= Tools.pen_pressure strength *= Tools.pen_pressure
_drawer.pixel_perfect = tool_slot.pixel_perfect if _brush_size == 1 else false _drawer.pixel_perfect = tool_slot.pixel_perfect if _brush_size == 1 else false

View file

@ -14,10 +14,10 @@ func _draw() -> void:
return return
var grid_type : int = Global.grid_type var grid_type : int = Global.grid_type
if grid_type == Global.Grid_Types.CARTESIAN || grid_type == Global.Grid_Types.ALL: if grid_type == Global.GridTypes.CARTESIAN || grid_type == Global.GridTypes.ALL:
_draw_cartesian_grid(target_rect) _draw_cartesian_grid(target_rect)
if grid_type == Global.Grid_Types.ISOMETRIC || grid_type == Global.Grid_Types.ALL: if grid_type == Global.GridTypes.ISOMETRIC || grid_type == Global.GridTypes.ALL:
_draw_isometric_grid(target_rect) _draw_isometric_grid(target_rect)

View file

@ -23,7 +23,7 @@ func _draw() -> void:
func get_tile_positions(size): func get_tile_positions(size):
match Global.current_project.tile_mode: match Global.current_project.tile_mode:
Global.Tile_Mode.BOTH: Global.TileMode.BOTH:
return [ return [
Vector2(0, size.y), # Down Vector2(0, size.y), # Down
Vector2(-size.x, size.y), # Down left Vector2(-size.x, size.y), # Down left
@ -34,12 +34,12 @@ func get_tile_positions(size):
Vector2(size.x, 0), # Right Vector2(size.x, 0), # Right
size # Down right size # Down right
] ]
Global.Tile_Mode.XAXIS: Global.TileMode.X_AXIS:
return [ return [
Vector2(size.x, 0), # Right Vector2(size.x, 0), # Right
Vector2(-size.x, 0), # Left Vector2(-size.x, 0), # Left
] ]
Global.Tile_Mode.YAXIS: Global.TileMode.Y_AXIS:
return [ return [
Vector2(0, size.y), # Down Vector2(0, size.y), # Down
Vector2(0, -size.y), # Up Vector2(0, -size.y), # Up

View file

@ -24,10 +24,10 @@ func _ready() -> void:
var button_category = texture.texture.resource_path.get_base_dir().right(last_backslash + 1) var button_category = texture.texture.resource_path.get_base_dir().right(last_backslash + 1)
var normal_file_name = texture.texture.resource_path.get_file() var normal_file_name = texture.texture.resource_path.get_file()
var theme_type := Global.theme_type var theme_type := Global.theme_type
if theme_type == Global.Theme_Types.CARAMEL or theme_type == Global.Theme_Types.BLUE: if theme_type == Global.ThemeTypes.CARAMEL or theme_type == Global.ThemeTypes.BLUE:
theme_type = Global.Theme_Types.DARK theme_type = Global.ThemeTypes.DARK
var theme_type_string : String = Global.Theme_Types.keys()[theme_type].to_lower() var theme_type_string : String = Global.ThemeTypes.keys()[theme_type].to_lower()
texture.texture = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name]) texture.texture = load("res://assets/graphics/%s_themes/%s/%s" % [theme_type_string, button_category, normal_file_name])
if Global.current_project.layers[i].visible: if Global.current_project.layers[i].visible:

View file

@ -1,11 +1,11 @@
extends Panel extends Panel
enum FILE_MENU_ID {NEW, OPEN, OPEN_LAST_PROJECT, SAVE, SAVE_AS, EXPORT, EXPORT_AS, QUIT} enum FileMenuId {NEW, OPEN, OPEN_LAST_PROJECT, SAVE, SAVE_AS, EXPORT, EXPORT_AS, QUIT}
enum EDIT_MENU_ID {UNDO, REDO, COPY, CUT, PASTE, DELETE, CLEAR_SELECTION, PREFERENCES} enum EditMenuId {UNDO, REDO, COPY, CUT, PASTE, DELETE, CLEAR_SELECTION, PREFERENCES}
enum VIEW_MENU_ID {TILE_MODE, MIRROR_VIEW, SHOW_GRID, SHOW_PIXEL_GRID, SHOW_RULERS, SHOW_GUIDES, SHOW_ANIMATION_TIMELINE, ZEN_MODE, FULLSCREEN_MODE} enum ViewMenuId {TILE_MODE, MIRROR_VIEW, SHOW_GRID, SHOW_PIXEL_GRID, SHOW_RULERS, SHOW_GUIDES, SHOW_ANIMATION_TIMELINE, ZEN_MODE, FULLSCREEN_MODE}
enum IMAGE_MENU_ID {SCALE_IMAGE, CROP_IMAGE, RESIZE_CANVAS, FLIP, ROTATE, INVERT_COLORS, DESATURATION, OUTLINE, HSV, GRADIENT, SHADER} enum ImageMenuId {SCALE_IMAGE, CROP_IMAGE, RESIZE_CANVAS, FLIP, ROTATE, INVERT_COLORS, DESATURATION, OUTLINE, HSV, GRADIENT, SHADER}
enum HELP_MENU_ID {VIEW_SPLASH_SCREEN, ONLINE_DOCS, ISSUE_TRACKER, CHANGELOG, ABOUT_PIXELORAMA} enum HelpMenuId {VIEW_SPLASH_SCREEN, ONLINE_DOCS, ISSUE_TRACKER, CHANGELOG, ABOUT_PIXELORAMA}
var file_menu : PopupMenu var file_menu : PopupMenu
@ -22,7 +22,7 @@ func _ready() -> void:
func setup_file_menu() -> void: func setup_file_menu() -> void:
var file_menu_items := { # order as in FILE_MENU_ID enum var file_menu_items := { # order as in FileMenuId enum
"New..." : InputMap.get_action_list("new_file")[0].get_scancode_with_modifiers(), "New..." : InputMap.get_action_list("new_file")[0].get_scancode_with_modifiers(),
"Open..." : InputMap.get_action_list("open_file")[0].get_scancode_with_modifiers(), "Open..." : InputMap.get_action_list("open_file")[0].get_scancode_with_modifiers(),
'Open last project...' : 0, 'Open last project...' : 0,
@ -46,8 +46,8 @@ func setup_file_menu() -> void:
file_menu.connect("id_pressed", self, "file_menu_id_pressed") file_menu.connect("id_pressed", self, "file_menu_id_pressed")
if OS.get_name() == "HTML5": if OS.get_name() == "HTML5":
file_menu.set_item_disabled(FILE_MENU_ID.OPEN_LAST_PROJECT, true) file_menu.set_item_disabled(FileMenuId.OPEN_LAST_PROJECT, true)
file_menu.set_item_disabled(FILE_MENU_ID.SAVE, true) file_menu.set_item_disabled(FileMenuId.SAVE, true)
func setup_recent_projects_submenu(item : String) -> void: func setup_recent_projects_submenu(item : String) -> void:
@ -59,7 +59,7 @@ func setup_recent_projects_submenu(item : String) -> void:
func setup_edit_menu() -> void: func setup_edit_menu() -> void:
var edit_menu_items := { # order as in EDIT_MENU_ID enum var edit_menu_items := { # order as in EditMenuId enum
"Undo" : InputMap.get_action_list("undo")[0].get_scancode_with_modifiers(), "Undo" : InputMap.get_action_list("undo")[0].get_scancode_with_modifiers(),
"Redo" : InputMap.get_action_list("redo")[0].get_scancode_with_modifiers(), "Redo" : InputMap.get_action_list("redo")[0].get_scancode_with_modifiers(),
"Copy" : InputMap.get_action_list("copy")[0].get_scancode_with_modifiers(), "Copy" : InputMap.get_action_list("copy")[0].get_scancode_with_modifiers(),
@ -80,7 +80,7 @@ func setup_edit_menu() -> void:
func setup_view_menu() -> void: func setup_view_menu() -> void:
var view_menu_items := { # order as in VIEW_MENU_ID enum var view_menu_items := { # order as in ViewMenuId enum
"Tile Mode" : 0, "Tile Mode" : 0,
"Mirror View" : InputMap.get_action_list("mirror_view")[0].get_scancode_with_modifiers(), "Mirror View" : InputMap.get_action_list("mirror_view")[0].get_scancode_with_modifiers(),
"Show Grid" : InputMap.get_action_list("show_grid")[0].get_scancode_with_modifiers(), "Show Grid" : InputMap.get_action_list("show_grid")[0].get_scancode_with_modifiers(),
@ -100,9 +100,9 @@ func setup_view_menu() -> void:
else: else:
view_menu.add_check_item(item, i, view_menu_items[item]) view_menu.add_check_item(item, i, view_menu_items[item])
i += 1 i += 1
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_RULERS, true) view_menu.set_item_checked(ViewMenuId.SHOW_RULERS, true)
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_GUIDES, true) view_menu.set_item_checked(ViewMenuId.SHOW_GUIDES, true)
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_ANIMATION_TIMELINE, true) view_menu.set_item_checked(ViewMenuId.SHOW_ANIMATION_TIMELINE, true)
view_menu.hide_on_checkable_item_selection = false view_menu.hide_on_checkable_item_selection = false
view_menu.connect("id_pressed", self, "view_menu_id_pressed") view_menu.connect("id_pressed", self, "view_menu_id_pressed")
@ -114,7 +114,7 @@ func setup_tile_mode_submenu(item : String):
func setup_image_menu() -> void: func setup_image_menu() -> void:
var image_menu_items := { # order as in IMAGE_MENU_ID enum var image_menu_items := { # order as in ImageMenuId enum
"Scale Image" : 0, "Scale Image" : 0,
"Crop Image" : 0, "Crop Image" : 0,
"Resize Canvas" : 0, "Resize Canvas" : 0,
@ -132,7 +132,7 @@ func setup_image_menu() -> void:
var i := 0 var i := 0
for item in image_menu_items.keys(): for item in image_menu_items.keys():
image_menu.add_item(item, i, image_menu_items[item]) image_menu.add_item(item, i, image_menu_items[item])
if i == IMAGE_MENU_ID.RESIZE_CANVAS: if i == ImageMenuId.RESIZE_CANVAS:
image_menu.add_separator() image_menu.add_separator()
i += 1 i += 1
@ -140,7 +140,7 @@ func setup_image_menu() -> void:
func setup_help_menu() -> void: func setup_help_menu() -> void:
var help_menu_items := { # order as in HELP_MENU_ID enum var help_menu_items := { # order as in HelpMenuId enum
"View Splash Screen" : 0, "View Splash Screen" : 0,
"Online Docs" : InputMap.get_action_list("open_docs")[0].get_scancode_with_modifiers(), "Online Docs" : InputMap.get_action_list("open_docs")[0].get_scancode_with_modifiers(),
"Issue Tracker" : 0, "Issue Tracker" : 0,
@ -159,22 +159,22 @@ func setup_help_menu() -> void:
func file_menu_id_pressed(id : int) -> void: func file_menu_id_pressed(id : int) -> void:
match id: match id:
FILE_MENU_ID.NEW: FileMenuId.NEW:
on_new_project_file_menu_option_pressed() on_new_project_file_menu_option_pressed()
FILE_MENU_ID.OPEN: FileMenuId.OPEN:
open_project_file() open_project_file()
FILE_MENU_ID.OPEN_LAST_PROJECT: FileMenuId.OPEN_LAST_PROJECT:
on_open_last_project_file_menu_option_pressed() on_open_last_project_file_menu_option_pressed()
FILE_MENU_ID.SAVE: FileMenuId.SAVE:
save_project_file() save_project_file()
FILE_MENU_ID.SAVE_AS: FileMenuId.SAVE_AS:
save_project_file_as() save_project_file_as()
FILE_MENU_ID.EXPORT: FileMenuId.EXPORT:
export_file() export_file()
FILE_MENU_ID.EXPORT_AS: FileMenuId.EXPORT_AS:
Global.export_dialog.popup_centered() Global.export_dialog.popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
FILE_MENU_ID.QUIT: FileMenuId.QUIT:
Global.control.show_quit_dialog() Global.control.show_quit_dialog()
@ -238,45 +238,45 @@ func on_recent_projects_submenu_id_pressed(id : int) -> void:
func edit_menu_id_pressed(id : int) -> void: func edit_menu_id_pressed(id : int) -> void:
match id: match id:
EDIT_MENU_ID.UNDO: EditMenuId.UNDO:
Global.current_project.undo_redo.undo() Global.current_project.undo_redo.undo()
EDIT_MENU_ID.REDO: EditMenuId.REDO:
Global.control.redone = true Global.control.redone = true
Global.current_project.undo_redo.redo() Global.current_project.undo_redo.redo()
Global.control.redone = false Global.control.redone = false
EDIT_MENU_ID.COPY: EditMenuId.COPY:
Global.selection_rectangle.copy() Global.selection_rectangle.copy()
EDIT_MENU_ID.CUT: EditMenuId.CUT:
Global.selection_rectangle.cut() Global.selection_rectangle.cut()
EDIT_MENU_ID.PASTE: EditMenuId.PASTE:
Global.selection_rectangle.paste() Global.selection_rectangle.paste()
EDIT_MENU_ID.DELETE: EditMenuId.DELETE:
Global.selection_rectangle.delete() Global.selection_rectangle.delete()
EDIT_MENU_ID.CLEAR_SELECTION: EditMenuId.CLEAR_SELECTION:
Global.selection_rectangle.set_rect(Rect2(0, 0, 0, 0)) Global.selection_rectangle.set_rect(Rect2(0, 0, 0, 0))
Global.selection_rectangle.select_rect() Global.selection_rectangle.select_rect()
EDIT_MENU_ID.PREFERENCES: EditMenuId.PREFERENCES:
Global.preferences_dialog.popup_centered(Vector2(400, 280)) Global.preferences_dialog.popup_centered(Vector2(400, 280))
Global.dialog_open(true) Global.dialog_open(true)
func view_menu_id_pressed(id : int) -> void: func view_menu_id_pressed(id : int) -> void:
match id: match id:
VIEW_MENU_ID.MIRROR_VIEW: ViewMenuId.MIRROR_VIEW:
toggle_mirror_view() toggle_mirror_view()
VIEW_MENU_ID.SHOW_GRID: ViewMenuId.SHOW_GRID:
toggle_show_grid() toggle_show_grid()
VIEW_MENU_ID.SHOW_PIXEL_GRID: ViewMenuId.SHOW_PIXEL_GRID:
toggle_show_pixel_grid() toggle_show_pixel_grid()
VIEW_MENU_ID.SHOW_RULERS: ViewMenuId.SHOW_RULERS:
toggle_show_rulers() toggle_show_rulers()
VIEW_MENU_ID.SHOW_GUIDES: ViewMenuId.SHOW_GUIDES:
toggle_show_guides() toggle_show_guides()
VIEW_MENU_ID.SHOW_ANIMATION_TIMELINE: ViewMenuId.SHOW_ANIMATION_TIMELINE:
toggle_show_anim_timeline() toggle_show_anim_timeline()
VIEW_MENU_ID.ZEN_MODE: ViewMenuId.ZEN_MODE:
toggle_zen_mode() toggle_zen_mode()
VIEW_MENU_ID.FULLSCREEN_MODE: ViewMenuId.FULLSCREEN_MODE:
toggle_fullscreen() toggle_fullscreen()
Global.canvas.update() Global.canvas.update()
@ -284,7 +284,7 @@ func view_menu_id_pressed(id : int) -> void:
func tile_mode_submenu_id_pressed(id : int) -> void: func tile_mode_submenu_id_pressed(id : int) -> void:
Global.current_project.tile_mode = id Global.current_project.tile_mode = id
Global.transparent_checker._init_position(id) Global.transparent_checker._init_position(id)
for i in Global.Tile_Mode.values(): for i in Global.TileMode.values():
Global.tile_mode_submenu.set_item_checked(i, i == id) Global.tile_mode_submenu.set_item_checked(i, i == id)
Global.canvas.tile_mode.update() Global.canvas.tile_mode.update()
Global.canvas.pixel_grid.update() Global.canvas.pixel_grid.update()
@ -293,31 +293,31 @@ func tile_mode_submenu_id_pressed(id : int) -> void:
func toggle_mirror_view() -> void: func toggle_mirror_view() -> void:
Global.mirror_view = !Global.mirror_view Global.mirror_view = !Global.mirror_view
view_menu.set_item_checked(VIEW_MENU_ID.MIRROR_VIEW, Global.mirror_view) view_menu.set_item_checked(ViewMenuId.MIRROR_VIEW, Global.mirror_view)
func toggle_show_grid() -> void: func toggle_show_grid() -> void:
Global.draw_grid = !Global.draw_grid Global.draw_grid = !Global.draw_grid
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_GRID, Global.draw_grid) view_menu.set_item_checked(ViewMenuId.SHOW_GRID, Global.draw_grid)
Global.canvas.grid.update() Global.canvas.grid.update()
func toggle_show_pixel_grid() -> void: func toggle_show_pixel_grid() -> void:
Global.draw_pixel_grid = !Global.draw_pixel_grid Global.draw_pixel_grid = !Global.draw_pixel_grid
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_PIXEL_GRID, Global.draw_pixel_grid) view_menu.set_item_checked(ViewMenuId.SHOW_PIXEL_GRID, Global.draw_pixel_grid)
Global.canvas.pixel_grid.update() Global.canvas.pixel_grid.update()
func toggle_show_rulers() -> void: func toggle_show_rulers() -> void:
Global.show_rulers = !Global.show_rulers Global.show_rulers = !Global.show_rulers
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_RULERS, Global.show_rulers) view_menu.set_item_checked(ViewMenuId.SHOW_RULERS, Global.show_rulers)
Global.horizontal_ruler.visible = Global.show_rulers Global.horizontal_ruler.visible = Global.show_rulers
Global.vertical_ruler.visible = Global.show_rulers Global.vertical_ruler.visible = Global.show_rulers
func toggle_show_guides() -> void: func toggle_show_guides() -> void:
Global.show_guides = !Global.show_guides Global.show_guides = !Global.show_guides
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_GUIDES, Global.show_guides) view_menu.set_item_checked(ViewMenuId.SHOW_GUIDES, Global.show_guides)
for guide in Global.canvas.get_children(): for guide in Global.canvas.get_children():
if guide is Guide and guide in Global.current_project.guides: if guide is Guide and guide in Global.current_project.guides:
guide.visible = Global.show_guides guide.visible = Global.show_guides
@ -332,7 +332,7 @@ func toggle_show_anim_timeline() -> void:
if zen_mode: if zen_mode:
return return
Global.show_animation_timeline = !Global.show_animation_timeline Global.show_animation_timeline = !Global.show_animation_timeline
view_menu.set_item_checked(VIEW_MENU_ID.SHOW_ANIMATION_TIMELINE, Global.show_animation_timeline) view_menu.set_item_checked(ViewMenuId.SHOW_ANIMATION_TIMELINE, Global.show_animation_timeline)
Global.animation_timeline.visible = Global.show_animation_timeline Global.animation_timeline.visible = Global.show_animation_timeline
@ -343,12 +343,12 @@ func toggle_zen_mode() -> void:
Global.control.get_node("MenuAndUI/UI/RightPanel").visible = zen_mode Global.control.get_node("MenuAndUI/UI/RightPanel").visible = zen_mode
Global.control.get_node("MenuAndUI/UI/CanvasAndTimeline/ViewportAndRulers/TabsContainer").visible = zen_mode Global.control.get_node("MenuAndUI/UI/CanvasAndTimeline/ViewportAndRulers/TabsContainer").visible = zen_mode
zen_mode = !zen_mode zen_mode = !zen_mode
view_menu.set_item_checked(VIEW_MENU_ID.ZEN_MODE, zen_mode) view_menu.set_item_checked(ViewMenuId.ZEN_MODE, zen_mode)
func toggle_fullscreen() -> void: func toggle_fullscreen() -> void:
OS.window_fullscreen = !OS.window_fullscreen OS.window_fullscreen = !OS.window_fullscreen
view_menu.set_item_checked(VIEW_MENU_ID.FULLSCREEN_MODE, OS.window_fullscreen) view_menu.set_item_checked(ViewMenuId.FULLSCREEN_MODE, OS.window_fullscreen)
func image_menu_id_pressed(id : int) -> void: func image_menu_id_pressed(id : int) -> void:
@ -356,41 +356,41 @@ func image_menu_id_pressed(id : int) -> void:
return return
var image : Image = Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].image var image : Image = Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].image
match id: match id:
IMAGE_MENU_ID.SCALE_IMAGE: ImageMenuId.SCALE_IMAGE:
show_scale_image_popup() show_scale_image_popup()
IMAGE_MENU_ID.CROP_IMAGE: ImageMenuId.CROP_IMAGE:
DrawingAlgos.crop_image(image) DrawingAlgos.crop_image(image)
IMAGE_MENU_ID.RESIZE_CANVAS: ImageMenuId.RESIZE_CANVAS:
show_resize_canvas_popup() show_resize_canvas_popup()
IMAGE_MENU_ID.FLIP: ImageMenuId.FLIP:
Global.control.get_node("Dialogs/ImageEffects/FlipImageDialog").popup_centered() Global.control.get_node("Dialogs/ImageEffects/FlipImageDialog").popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
IMAGE_MENU_ID.ROTATE: ImageMenuId.ROTATE:
show_rotate_image_popup() show_rotate_image_popup()
IMAGE_MENU_ID.INVERT_COLORS: ImageMenuId.INVERT_COLORS:
Global.control.get_node("Dialogs/ImageEffects/InvertColorsDialog").popup_centered() Global.control.get_node("Dialogs/ImageEffects/InvertColorsDialog").popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
IMAGE_MENU_ID.DESATURATION: ImageMenuId.DESATURATION:
Global.control.get_node("Dialogs/ImageEffects/DesaturateDialog").popup_centered() Global.control.get_node("Dialogs/ImageEffects/DesaturateDialog").popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
IMAGE_MENU_ID.OUTLINE: ImageMenuId.OUTLINE:
show_add_outline_popup() show_add_outline_popup()
IMAGE_MENU_ID.HSV: ImageMenuId.HSV:
show_hsv_configuration_popup() show_hsv_configuration_popup()
IMAGE_MENU_ID.GRADIENT: ImageMenuId.GRADIENT:
Global.control.get_node("Dialogs/ImageEffects/GradientDialog").popup_centered() Global.control.get_node("Dialogs/ImageEffects/GradientDialog").popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
IMAGE_MENU_ID.SHADER: ImageMenuId.SHADER:
Global.control.get_node("Dialogs/ImageEffects/ShaderEffect").popup_centered() Global.control.get_node("Dialogs/ImageEffects/ShaderEffect").popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
@ -422,19 +422,19 @@ func show_hsv_configuration_popup() -> void:
func help_menu_id_pressed(id : int) -> void: func help_menu_id_pressed(id : int) -> void:
match id: match id:
HELP_MENU_ID.VIEW_SPLASH_SCREEN: HelpMenuId.VIEW_SPLASH_SCREEN:
Global.control.get_node("Dialogs/SplashDialog").popup_centered() Global.control.get_node("Dialogs/SplashDialog").popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
HELP_MENU_ID.ONLINE_DOCS: HelpMenuId.ONLINE_DOCS:
OS.shell_open("https://orama-interactive.github.io/Pixelorama-Docs/") OS.shell_open("https://orama-interactive.github.io/Pixelorama-Docs/")
HELP_MENU_ID.ISSUE_TRACKER: HelpMenuId.ISSUE_TRACKER:
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/issues") OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/issues")
HELP_MENU_ID.CHANGELOG: HelpMenuId.CHANGELOG:
if OS.get_name() == "OSX": if OS.get_name() == "OSX":
# Issue #275 - remove when macOS builds use Godot 3.2.3 # Issue #275 - remove when macOS builds use Godot 3.2.3
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/blob/master/CHANGELOG.md") OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/blob/master/CHANGELOG.md")
else: else:
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/blob/master/CHANGELOG.md#v082---2020-12-12") OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/blob/master/CHANGELOG.md#v082---2020-12-12")
HELP_MENU_ID.ABOUT_PIXELORAMA: HelpMenuId.ABOUT_PIXELORAMA:
Global.control.get_node("Dialogs/AboutDialog").popup_centered() Global.control.get_node("Dialogs/AboutDialog").popup_centered()
Global.dialog_open(true) Global.dialog_open(true)

View file

@ -25,15 +25,15 @@ func _on_TransparentChecker_resized() -> void:
func _init_position(tile_mode : int) -> void: func _init_position(tile_mode : int) -> void:
match tile_mode: match tile_mode:
Global.Tile_Mode.NONE: Global.TileMode.NONE:
Global.transparent_checker.set_size(Global.current_project.size) Global.transparent_checker.set_size(Global.current_project.size)
Global.transparent_checker.set_position(Vector2.ZERO) Global.transparent_checker.set_position(Vector2.ZERO)
Global.Tile_Mode.BOTH: Global.TileMode.BOTH:
Global.transparent_checker.set_size(Global.current_project.size*3) Global.transparent_checker.set_size(Global.current_project.size*3)
Global.transparent_checker.set_position(-Global.current_project.size) Global.transparent_checker.set_position(-Global.current_project.size)
Global.Tile_Mode.XAXIS: Global.TileMode.X_AXIS:
Global.transparent_checker.set_size(Vector2(Global.current_project.size.x*3, Global.current_project.size.y*1)) Global.transparent_checker.set_size(Vector2(Global.current_project.size.x*3, Global.current_project.size.y*1))
Global.transparent_checker.set_position(Vector2(-Global.current_project.size.x, 0)) Global.transparent_checker.set_position(Vector2(-Global.current_project.size.x, 0))
Global.Tile_Mode.YAXIS: Global.TileMode.Y_AXIS:
Global.transparent_checker.set_size(Vector2(Global.current_project.size.x*1, Global.current_project.size.y*3)) Global.transparent_checker.set_size(Vector2(Global.current_project.size.x*1, Global.current_project.size.y*3))
Global.transparent_checker.set_position(Vector2(0, -Global.current_project.size.y)) Global.transparent_checker.set_position(Vector2(0, -Global.current_project.size.y))