mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Create a new Effects menu and move all of the cel-specific effects there, away from the Image menu
Also moves Project properties into Image
This commit is contained in:
parent
25a69a99d6
commit
8f395b2be7
|
@ -1878,7 +1878,7 @@ msgstr ""
|
|||
msgid "Properties"
|
||||
msgstr ""
|
||||
|
||||
msgid "Project properties"
|
||||
msgid "Project Properties"
|
||||
msgstr ""
|
||||
|
||||
msgid "Frame properties"
|
||||
|
|
|
@ -164,7 +164,7 @@ class GeneralAPI:
|
|||
|
||||
## Gives ability to add/remove items from menus in the top bar.
|
||||
class MenuAPI:
|
||||
enum { FILE, EDIT, SELECT, IMAGE, VIEW, WINDOW, HELP }
|
||||
enum { FILE, EDIT, SELECT, IMAGE, EFFECTS, VIEW, WINDOW, HELP }
|
||||
|
||||
# Menu methods
|
||||
func _get_popup_menu(menu_type: int) -> PopupMenu:
|
||||
|
@ -177,6 +177,8 @@ class MenuAPI:
|
|||
return Global.top_menu_container.select_menu
|
||||
IMAGE:
|
||||
return Global.top_menu_container.image_menu
|
||||
EFFECTS:
|
||||
return Global.top_menu_container.effects_menu
|
||||
VIEW:
|
||||
return Global.top_menu_container.view_menu
|
||||
WINDOW:
|
||||
|
@ -192,7 +194,7 @@ class MenuAPI:
|
|||
## function inside its script.[br]
|
||||
## Index of the added item is returned (which can be used to remove menu item later on).
|
||||
func add_menu_item(menu_type: int, item_name: String, item_metadata, item_id := -1) -> int:
|
||||
var popup_menu: PopupMenu = _get_popup_menu(menu_type)
|
||||
var popup_menu := _get_popup_menu(menu_type)
|
||||
if not popup_menu:
|
||||
return -1
|
||||
popup_menu.add_item(item_name, item_id)
|
||||
|
@ -206,7 +208,7 @@ class MenuAPI:
|
|||
## Removes a menu item at index [param item_idx] from the [param menu_type] defined by
|
||||
## [enum @unnamed_enums].
|
||||
func remove_menu_item(menu_type: int, item_idx: int) -> void:
|
||||
var popup_menu: PopupMenu = _get_popup_menu(menu_type)
|
||||
var popup_menu := _get_popup_menu(menu_type)
|
||||
if not popup_menu:
|
||||
return
|
||||
popup_menu.remove_item(item_idx)
|
||||
|
|
|
@ -24,9 +24,7 @@ enum MeasurementMode { NONE, MOVE }
|
|||
## Enumeration of items present in the File Menu.
|
||||
enum FileMenu { NEW, OPEN, OPEN_LAST_PROJECT, RECENT, SAVE, SAVE_AS, EXPORT, EXPORT_AS, QUIT }
|
||||
## Enumeration of items present in the Edit Menu.
|
||||
enum EditMenu {
|
||||
UNDO, REDO, COPY, CUT, PASTE, PASTE_IN_PLACE, DELETE, NEW_BRUSH, PROJECT_PROPERTIES, PREFERENCES
|
||||
}
|
||||
enum EditMenu { UNDO, REDO, COPY, CUT, PASTE, PASTE_IN_PLACE, DELETE, NEW_BRUSH, PREFERENCES }
|
||||
## Enumeration of items present in the View Menu.
|
||||
enum ViewMenu {
|
||||
TILE_MODE,
|
||||
|
@ -45,11 +43,15 @@ enum ViewMenu {
|
|||
enum WindowMenu { WINDOW_OPACITY, PANELS, LAYOUTS, MOVABLE_PANELS, ZEN_MODE, FULLSCREEN_MODE }
|
||||
## Enumeration of items present in the Image Menu.
|
||||
enum ImageMenu {
|
||||
PROJECT_PROPERTIES,
|
||||
RESIZE_CANVAS,
|
||||
OFFSET_IMAGE,
|
||||
SCALE_IMAGE,
|
||||
CROP_TO_SELECTION,
|
||||
CROP_TO_CONTENT,
|
||||
}
|
||||
## Enumeration of items present in the Effects menu.
|
||||
enum EffectsMenu {
|
||||
OFFSET_IMAGE,
|
||||
FLIP,
|
||||
ROTATE,
|
||||
OUTLINE,
|
||||
|
@ -721,23 +723,23 @@ func _initialize_keychain() -> void:
|
|||
"paste_in_place": Keychain.InputAction.new("", "Edit menu", true),
|
||||
"delete": Keychain.InputAction.new("", "Edit menu", true),
|
||||
"new_brush": Keychain.InputAction.new("", "Edit menu", true),
|
||||
&"project_properties": Keychain.InputAction.new("", "Edit menu", true),
|
||||
"preferences": Keychain.InputAction.new("", "Edit menu", true),
|
||||
&"project_properties": Keychain.InputAction.new("", "Image menu", true),
|
||||
"scale_image": Keychain.InputAction.new("", "Image menu", true),
|
||||
"crop_to_selection": Keychain.InputAction.new("", "Image menu", true),
|
||||
"crop_to_content": Keychain.InputAction.new("", "Image menu", true),
|
||||
"resize_canvas": Keychain.InputAction.new("", "Image menu", true),
|
||||
"offset_image": Keychain.InputAction.new("", "Image menu", true),
|
||||
"mirror_image": Keychain.InputAction.new("", "Image menu", true),
|
||||
"rotate_image": Keychain.InputAction.new("", "Image menu", true),
|
||||
"invert_colors": Keychain.InputAction.new("", "Image menu", true),
|
||||
"desaturation": Keychain.InputAction.new("", "Image menu", true),
|
||||
"outline": Keychain.InputAction.new("", "Image menu", true),
|
||||
"drop_shadow": Keychain.InputAction.new("", "Image menu", true),
|
||||
"adjust_hsv": Keychain.InputAction.new("", "Image menu", true),
|
||||
"gradient": Keychain.InputAction.new("", "Image menu", true),
|
||||
"gradient_map": Keychain.InputAction.new("", "Image menu", true),
|
||||
"posterize": Keychain.InputAction.new("", "Image menu", true),
|
||||
"offset_image": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"mirror_image": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"rotate_image": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"invert_colors": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"desaturation": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"outline": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"drop_shadow": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"adjust_hsv": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"gradient": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"gradient_map": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"posterize": Keychain.InputAction.new("", "Effects menu", true),
|
||||
"mirror_view": Keychain.InputAction.new("", "View menu", true),
|
||||
"show_grid": Keychain.InputAction.new("", "View menu", true),
|
||||
"show_pixel_grid": Keychain.InputAction.new("", "View menu", true),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[ext_resource type="Script" path="res://src/UI/Dialogs/ProjectProperties.gd" id="1_0n4uc"]
|
||||
|
||||
[node name="ProjectProperties" type="AcceptDialog"]
|
||||
title = "Project properties"
|
||||
title = "Project Properties"
|
||||
size = Vector2i(197, 235)
|
||||
exclusive = false
|
||||
popup_window = true
|
||||
|
|
|
@ -40,11 +40,13 @@ suffix = "x"
|
|||
|
||||
[node name="UserDataLabel" type="Label" parent="GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
text = "User data:"
|
||||
|
||||
[node name="UserDataTextEdit" type="TextEdit" parent="GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
scroll_fit_content_height = true
|
||||
|
||||
[connection signal="about_to_popup" from="." to="." method="_on_FrameProperties_about_to_show"]
|
||||
|
|
|
@ -41,6 +41,7 @@ var about_dialog := Dialog.new("res://src/UI/Dialogs/AboutDialog.tscn")
|
|||
@onready var edit_menu: PopupMenu = $MenuBar/Edit
|
||||
@onready var select_menu: PopupMenu = $MenuBar/Select
|
||||
@onready var image_menu: PopupMenu = $MenuBar/Image
|
||||
@onready var effects_menu: PopupMenu = $MenuBar/Effects
|
||||
@onready var view_menu: PopupMenu = $MenuBar/View
|
||||
@onready var window_menu: PopupMenu = $MenuBar/Window
|
||||
@onready var help_menu: PopupMenu = $MenuBar/Help
|
||||
|
@ -86,6 +87,7 @@ func _ready() -> void:
|
|||
_setup_view_menu()
|
||||
_setup_window_menu()
|
||||
_setup_image_menu()
|
||||
_setup_effects_menu()
|
||||
_setup_select_menu()
|
||||
_setup_help_menu()
|
||||
|
||||
|
@ -172,7 +174,6 @@ func _setup_edit_menu() -> void:
|
|||
"Paste in Place": "paste_in_place",
|
||||
"Delete": "delete",
|
||||
"New Brush": "new_brush",
|
||||
"Project properties": "project_properties",
|
||||
"Preferences": "preferences"
|
||||
}
|
||||
var i := 0
|
||||
|
@ -338,11 +339,24 @@ func populate_layouts_submenu() -> void:
|
|||
func _setup_image_menu() -> void:
|
||||
# Order as in Global.ImageMenu enum
|
||||
var image_menu_items := {
|
||||
"Project Properties": "project_properties",
|
||||
"Resize Canvas": "resize_canvas",
|
||||
"Offset Image": "offset_image",
|
||||
"Scale Image": "scale_image",
|
||||
"Crop to Selection": "crop_to_selection",
|
||||
"Crop to Content": "crop_to_content",
|
||||
}
|
||||
var i := 0
|
||||
for item in image_menu_items:
|
||||
_set_menu_shortcut(image_menu_items[item], image_menu, i, item)
|
||||
i += 1
|
||||
image_menu.set_item_disabled(Global.ImageMenu.CROP_TO_SELECTION, true)
|
||||
image_menu.id_pressed.connect(image_menu_id_pressed)
|
||||
|
||||
|
||||
func _setup_effects_menu() -> void:
|
||||
# Order as in Global.EffectMenu enum
|
||||
var menu_items := {
|
||||
"Offset Image": "offset_image",
|
||||
"Mirror Image": "mirror_image",
|
||||
"Rotate Image": "rotate_image",
|
||||
"Outline": "outline",
|
||||
|
@ -356,11 +370,10 @@ func _setup_image_menu() -> void:
|
|||
# "Shader": ""
|
||||
}
|
||||
var i := 0
|
||||
for item in image_menu_items:
|
||||
_set_menu_shortcut(image_menu_items[item], image_menu, i, item)
|
||||
for item in menu_items:
|
||||
_set_menu_shortcut(menu_items[item], effects_menu, i, item)
|
||||
i += 1
|
||||
image_menu.set_item_disabled(Global.ImageMenu.CROP_TO_SELECTION, true)
|
||||
image_menu.id_pressed.connect(image_menu_id_pressed)
|
||||
effects_menu.id_pressed.connect(effects_menu_id_pressed)
|
||||
|
||||
|
||||
func _setup_select_menu() -> void:
|
||||
|
@ -530,8 +543,6 @@ func edit_menu_id_pressed(id: int) -> void:
|
|||
Global.canvas.selection.delete()
|
||||
Global.EditMenu.NEW_BRUSH:
|
||||
Global.canvas.selection.new_brush()
|
||||
Global.EditMenu.PROJECT_PROPERTIES:
|
||||
project_properties_dialog.popup()
|
||||
Global.EditMenu.PREFERENCES:
|
||||
preferences_dialog.popup()
|
||||
_:
|
||||
|
@ -726,40 +737,46 @@ func _toggle_fullscreen() -> void:
|
|||
|
||||
func image_menu_id_pressed(id: int) -> void:
|
||||
match id:
|
||||
Global.ImageMenu.PROJECT_PROPERTIES:
|
||||
project_properties_dialog.popup()
|
||||
Global.ImageMenu.SCALE_IMAGE:
|
||||
scale_image_dialog.popup()
|
||||
Global.ImageMenu.OFFSET_IMAGE:
|
||||
offset_image_dialog.popup()
|
||||
Global.ImageMenu.CROP_TO_SELECTION:
|
||||
DrawingAlgos.crop_to_selection()
|
||||
Global.ImageMenu.CROP_TO_CONTENT:
|
||||
DrawingAlgos.crop_to_content()
|
||||
Global.ImageMenu.RESIZE_CANVAS:
|
||||
resize_canvas_dialog.popup()
|
||||
Global.ImageMenu.FLIP:
|
||||
|
||||
|
||||
func effects_menu_id_pressed(id: int) -> void:
|
||||
match id:
|
||||
Global.EffectsMenu.OFFSET_IMAGE:
|
||||
offset_image_dialog.popup()
|
||||
Global.EffectsMenu.FLIP:
|
||||
mirror_image_dialog.popup()
|
||||
Global.ImageMenu.ROTATE:
|
||||
Global.EffectsMenu.ROTATE:
|
||||
rotate_image_dialog.popup()
|
||||
Global.ImageMenu.INVERT_COLORS:
|
||||
Global.EffectsMenu.INVERT_COLORS:
|
||||
invert_colors_dialog.popup()
|
||||
Global.ImageMenu.DESATURATION:
|
||||
Global.EffectsMenu.DESATURATION:
|
||||
desaturate_dialog.popup()
|
||||
Global.ImageMenu.OUTLINE:
|
||||
Global.EffectsMenu.OUTLINE:
|
||||
outline_dialog.popup()
|
||||
Global.ImageMenu.DROP_SHADOW:
|
||||
Global.EffectsMenu.DROP_SHADOW:
|
||||
drop_shadow_dialog.popup()
|
||||
Global.ImageMenu.HSV:
|
||||
Global.EffectsMenu.HSV:
|
||||
hsv_dialog.popup()
|
||||
Global.ImageMenu.GRADIENT:
|
||||
Global.EffectsMenu.GRADIENT:
|
||||
gradient_dialog.popup()
|
||||
Global.ImageMenu.GRADIENT_MAP:
|
||||
Global.EffectsMenu.GRADIENT_MAP:
|
||||
gradient_map_dialog.popup()
|
||||
Global.ImageMenu.POSTERIZE:
|
||||
Global.EffectsMenu.POSTERIZE:
|
||||
posterize_dialog.popup()
|
||||
#Global.ImageMenu.SHADER:
|
||||
#Global.EffectsMenu.SHADER:
|
||||
#shader_effect_dialog.popup()
|
||||
_:
|
||||
_handle_metadata(id, image_menu)
|
||||
_handle_metadata(id, effects_menu)
|
||||
|
||||
|
||||
func select_menu_id_pressed(id: int) -> void:
|
||||
|
|
|
@ -24,6 +24,8 @@ flat = true
|
|||
|
||||
[node name="Image" type="PopupMenu" parent="MenuBar"]
|
||||
|
||||
[node name="Effects" type="PopupMenu" parent="MenuBar"]
|
||||
|
||||
[node name="View" type="PopupMenu" parent="MenuBar"]
|
||||
|
||||
[node name="Window" type="PopupMenu" parent="MenuBar"]
|
||||
|
@ -31,12 +33,15 @@ flat = true
|
|||
[node name="Help" type="PopupMenu" parent="MenuBar"]
|
||||
|
||||
[node name="TopLabels" type="HBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
layout_mode = 1
|
||||
anchors_preset = 13
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -65.5
|
||||
offset_right = 65.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="RotationSlider" type="TextureProgressBar" parent="TopLabels"]
|
||||
|
@ -84,7 +89,8 @@ layout_mode = 2
|
|||
text = "[64×64]"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
|
@ -93,7 +99,8 @@ offset_left = -330.0
|
|||
offset_top = -14.0
|
||||
offset_right = 0.00012207
|
||||
offset_bottom = 13.0
|
||||
grow_horizontal = 2
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="CurrentFrame" type="Label" parent="HBoxContainer"]
|
||||
|
|
Loading…
Reference in a new issue