1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 09:39:48 +00:00
Pixelorama/src/UI/TopMenuContainer.gd

712 lines
21 KiB
GDScript3
Raw Normal View History

extends Panel
var file_menu: PopupMenu
var view_menu: PopupMenu
var window_menu: PopupMenu
2021-11-23 00:36:22 +00:00
var recent_projects := []
var layouts := [
["Default", preload("res://assets/layouts/default.tres")],
["Tallscreen", preload("res://assets/layouts/tallscreen.tres")],
]
var default_layout_size := layouts.size()
2022-03-01 22:41:22 +00:00
var selected_layout := 0
var zen_mode := false
2021-11-23 00:36:22 +00:00
onready var ui_elements: Array = Global.control.find_node("DockableContainer").get_children()
onready var file_menu_button: MenuButton = find_node("FileMenu")
onready var edit_menu_button: MenuButton = find_node("EditMenu")
onready var view_menu_button: MenuButton = find_node("ViewMenu")
onready var window_menu_button: MenuButton = find_node("WindowMenu")
onready var image_menu_button: MenuButton = find_node("ImageMenu")
onready var select_menu_button: MenuButton = find_node("SelectMenu")
onready var help_menu_button: MenuButton = find_node("HelpMenu")
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
onready var ui: Container = Global.control.find_node("DockableContainer")
onready var greyscale_vision: ColorRect = ui.find_node("GreyscaleVision")
onready var new_image_dialog: ConfirmationDialog = Global.control.find_node("CreateNewImage")
onready var window_opacity_dialog: AcceptDialog = Global.control.find_node("WindowOpacityDialog")
2021-11-23 00:36:22 +00:00
onready var tile_mode_submenu := PopupMenu.new()
onready var panels_submenu := PopupMenu.new()
onready var layouts_submenu := PopupMenu.new()
2021-11-23 00:36:22 +00:00
onready var recent_projects_submenu := PopupMenu.new()
func _ready() -> void:
var dir := Directory.new()
dir.make_dir("user://layouts")
_setup_file_menu()
_setup_edit_menu()
_setup_view_menu()
_setup_window_menu()
_setup_image_menu()
_setup_select_menu()
_setup_help_menu()
func _setup_file_menu() -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Order as in FileMenu enum
var file_menu_items := [
"New...",
"Open...",
"Open last project...",
"Recent projects",
"Save...",
"Save as...",
"Export...",
"Export as...",
"Quit",
]
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
file_menu = file_menu_button.get_popup()
var i := 0
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
for item in file_menu_items:
if item == "Recent projects":
_setup_recent_projects_submenu(item)
else:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
file_menu.add_item(item, i)
i += 1
file_menu.connect("id_pressed", self, "file_menu_id_pressed")
if OS.get_name() == "HTML5":
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
file_menu.set_item_disabled(Global.FileMenu.OPEN_LAST_PROJECT, true)
file_menu.set_item_disabled(Global.FileMenu.SAVE, true)
func _setup_recent_projects_submenu(item: String) -> void:
recent_projects = Global.config_cache.get_value("data", "recent_projects", [])
recent_projects_submenu.connect("id_pressed", self, "_on_recent_projects_submenu_id_pressed")
update_recent_projects_submenu()
2021-11-23 00:36:22 +00:00
file_menu.add_child(recent_projects_submenu)
file_menu.add_submenu_item(item, recent_projects_submenu.get_name())
func update_recent_projects_submenu() -> void:
for project in recent_projects:
2021-11-23 00:36:22 +00:00
recent_projects_submenu.add_item(project.get_file())
func _setup_edit_menu() -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Order as in Global.EditMenu enum
var edit_menu_items := [
"Undo",
"Redo",
"Copy",
"Cut",
"Paste",
"Paste in Place",
"Delete",
"New Brush",
"Preferences"
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
]
var edit_menu: PopupMenu = edit_menu_button.get_popup()
var i := 0
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
for item in edit_menu_items:
edit_menu.add_item(item, i)
i += 1
edit_menu.set_item_disabled(Global.EditMenu.NEW_BRUSH, true)
edit_menu.connect("id_pressed", self, "edit_menu_id_pressed")
func _setup_view_menu() -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Order as in Global.ViewMenu enum
var view_menu_items := [
"Tile Mode",
"Tile Mode Offsets",
"Grayscale View",
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
"Mirror View",
"Show Grid",
"Show Pixel Grid",
"Show Rulers",
"Show Guides",
]
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
view_menu = view_menu_button.get_popup()
var i := 0
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
for item in view_menu_items:
if item == "Tile Mode":
_setup_tile_mode_submenu(item)
elif item == "Tile Mode Offsets":
view_menu.add_item(item, i)
else:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.add_check_item(item, i)
i += 1
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.set_item_checked(Global.ViewMenu.SHOW_RULERS, true)
view_menu.set_item_checked(Global.ViewMenu.SHOW_GUIDES, true)
view_menu.hide_on_checkable_item_selection = false
view_menu.connect("id_pressed", self, "view_menu_id_pressed")
var draw_grid: bool = Global.config_cache.get_value("view_menu", "draw_grid", Global.draw_grid)
if draw_grid != Global.draw_grid:
_toggle_show_grid()
var draw_pixel_grid: bool = Global.config_cache.get_value(
"view_menu", "draw_pixel_grid", Global.draw_pixel_grid
)
if draw_pixel_grid != Global.draw_pixel_grid:
_toggle_show_pixel_grid()
var show_rulers: bool = Global.config_cache.get_value(
"view_menu", "show_rulers", Global.show_rulers
)
if show_rulers != Global.show_rulers:
_toggle_show_rulers()
var show_guides: bool = Global.config_cache.get_value(
"view_menu", "show_guides", Global.show_guides
)
if show_guides != Global.show_guides:
_toggle_show_guides()
func _setup_tile_mode_submenu(item: String) -> void:
tile_mode_submenu.set_name("tile_mode_submenu")
tile_mode_submenu.add_radio_check_item("None", Tiles.MODE.NONE)
tile_mode_submenu.set_item_checked(Tiles.MODE.NONE, true)
tile_mode_submenu.add_radio_check_item("Tiled In Both Axis", Tiles.MODE.BOTH)
tile_mode_submenu.add_radio_check_item("Tiled In X Axis", Tiles.MODE.X_AXIS)
tile_mode_submenu.add_radio_check_item("Tiled In Y Axis", Tiles.MODE.Y_AXIS)
tile_mode_submenu.hide_on_checkable_item_selection = false
tile_mode_submenu.connect("id_pressed", self, "_tile_mode_submenu_id_pressed")
view_menu.add_child(tile_mode_submenu)
view_menu.add_submenu_item(item, tile_mode_submenu.get_name())
func _setup_window_menu() -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Order as in Global.WindowMenu enum
var window_menu_items := [
"Window Opacity",
"Panels",
"Layouts",
2022-05-18 18:46:48 +00:00
"Moveable Panels",
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
"Zen Mode",
"Fullscreen Mode",
]
window_menu = window_menu_button.get_popup()
var i := 0
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
for item in window_menu_items:
if item == "Panels":
_setup_panels_submenu(item)
elif item == "Layouts":
_setup_layouts_submenu(item)
elif item == "Window Opacity":
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
window_menu.add_item(item, i)
else:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
window_menu.add_check_item(item, i)
i += 1
window_menu.hide_on_checkable_item_selection = false
window_menu.connect("id_pressed", self, "window_menu_id_pressed")
# Disable window opacity item if per pixel transparency is not allowed
window_menu.set_item_disabled(
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.WindowMenu.WINDOW_OPACITY,
!ProjectSettings.get_setting("display/window/per_pixel_transparency/allowed")
)
func _setup_panels_submenu(item: String) -> void:
panels_submenu.set_name("panels_submenu")
panels_submenu.hide_on_checkable_item_selection = false
for element in ui_elements:
panels_submenu.add_check_item(element.name)
var is_hidden: bool = ui.is_control_hidden(element)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
panels_submenu.set_item_checked(ui_elements.find(element), !is_hidden)
panels_submenu.connect("id_pressed", self, "_panels_submenu_id_pressed")
window_menu.add_child(panels_submenu)
window_menu.add_submenu_item(item, panels_submenu.get_name())
func _setup_layouts_submenu(item: String) -> void:
var dir := Directory.new()
var path := "user://layouts"
if dir.open(path) == OK:
dir.list_dir_begin()
var file_name = dir.get_next()
while file_name != "":
if !dir.current_is_dir():
var file_name_no_tres: String = file_name.get_basename()
layouts.append([file_name_no_tres, ResourceLoader.load(path.plus_file(file_name))])
file_name = dir.get_next()
layouts_submenu.set_name("layouts_submenu")
layouts_submenu.hide_on_checkable_item_selection = false
populate_layouts_submenu()
layouts_submenu.connect("id_pressed", self, "_layouts_submenu_id_pressed")
window_menu.add_child(layouts_submenu)
window_menu.add_submenu_item(item, layouts_submenu.get_name())
2022-03-01 22:41:22 +00:00
var saved_layout = Global.config_cache.get_value("window", "layout", 0)
set_layout(saved_layout)
func populate_layouts_submenu() -> void:
layouts_submenu.clear() # Does not do anything if it's called for the first time
layouts_submenu.add_item("Manage Layouts", 0)
for layout in layouts:
layouts_submenu.add_radio_check_item(layout[0])
func _setup_image_menu() -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Order as in Global.ImageMenu enum
var image_menu_items := [
"Scale Image",
"Centralize Image",
"Crop Image",
"Resize Canvas",
"Mirror Image",
"Rotate Image",
"Invert Colors",
"Desaturation",
"Outline",
"Drop Shadow",
"Adjust Hue/Saturation/Value",
"Gradient",
"Gradient Map",
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# "Shader"
]
var image_menu: PopupMenu = image_menu_button.get_popup()
var i := 0
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
for item in image_menu_items:
image_menu.add_item(item, i)
if i == Global.ImageMenu.RESIZE_CANVAS:
image_menu.add_separator()
i += 1
image_menu.connect("id_pressed", self, "image_menu_id_pressed")
func _setup_select_menu() -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Order as in Global.SelectMenu enum
var select_menu_items := ["All", "Clear", "Invert"]
var select_menu: PopupMenu = select_menu_button.get_popup()
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
var i := 0
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
for item in select_menu_items:
select_menu.add_item(item, i)
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
i += 1
select_menu.connect("id_pressed", self, "select_menu_id_pressed")
func _setup_help_menu() -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Order as in Global.HelpMenu enum
var help_menu_items := [
"View Splash Screen",
"Online Docs",
"Issue Tracker",
"Open Logs Folder",
"Changelog",
"About Pixelorama",
]
var help_menu: PopupMenu = help_menu_button.get_popup()
var i := 0
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
for item in help_menu_items:
help_menu.add_item(item, i)
i += 1
help_menu.connect("id_pressed", self, "help_menu_id_pressed")
func _handle_metadata(id: int, menu_button: MenuButton) -> void:
# Used for extensions that want to add extra menu items
var metadata = menu_button.get_popup().get_item_metadata(id)
if metadata:
if metadata is Object:
if metadata.has_method("menu_item_clicked"):
metadata.call("menu_item_clicked")
func file_menu_id_pressed(id: int) -> void:
match id:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.NEW:
_on_new_project_file_menu_option_pressed()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.OPEN:
_open_project_file()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.OPEN_LAST_PROJECT:
_on_open_last_project_file_menu_option_pressed()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.SAVE:
_save_project_file()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.SAVE_AS:
_save_project_file_as()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.EXPORT:
_export_file()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.EXPORT_AS:
Global.export_dialog.popup_centered()
Global.dialog_open(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.FileMenu.QUIT:
Global.control.show_quit_dialog()
_:
_handle_metadata(id, file_menu_button)
func _on_new_project_file_menu_option_pressed() -> void:
2021-11-23 00:36:22 +00:00
new_image_dialog.popup_centered()
Global.dialog_open(true)
func _open_project_file() -> void:
if OS.get_name() == "HTML5":
Html5FileExchange.load_image()
else:
Global.open_sprites_dialog.popup_centered()
Global.dialog_open(true)
Global.control.opensprite_file_selected = false
func _on_open_last_project_file_menu_option_pressed() -> void:
if Global.config_cache.has_section_key("preferences", "last_project_path"):
Global.control.load_last_project()
else:
Global.error_dialog.set_text("You haven't saved or opened any project in Pixelorama yet!")
Global.error_dialog.popup_centered()
Global.dialog_open(true)
func _save_project_file() -> void:
var path: String = OpenSave.current_save_paths[Global.current_project_index]
if path == "":
_save_project_file_as()
else:
Global.control.save_project(path)
func _save_project_file_as() -> void:
Global.dialog_open(true)
if OS.get_name() == "HTML5":
var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog
var save_filename = save_dialog.get_node("FileNameContainer/FileNameLineEdit")
save_dialog.popup_centered()
save_filename.text = Global.current_project.name
else:
Global.save_sprites_dialog.popup_centered()
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
Global.save_sprites_dialog.get_line_edit().text = Global.current_project.name
func _export_file() -> void:
if Export.was_exported == false:
Global.export_dialog.popup_centered()
Global.dialog_open(true)
else:
Export.external_export()
func _on_recent_projects_submenu_id_pressed(id: int) -> void:
Global.control.load_recent_project_file(recent_projects[id])
func edit_menu_id_pressed(id: int) -> void:
match id:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.UNDO:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.current_project.commit_undo()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.REDO:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.current_project.commit_redo()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.COPY:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.canvas.selection.copy()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.CUT:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.canvas.selection.cut()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.PASTE:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.canvas.selection.paste()
Global.EditMenu.PASTE_IN_PLACE:
Global.canvas.selection.paste(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.DELETE:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.canvas.selection.delete()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.NEW_BRUSH:
Global.canvas.selection.new_brush()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.EditMenu.PREFERENCES:
Global.preferences_dialog.popup_centered(Vector2(600, 400))
Global.dialog_open(true)
_:
_handle_metadata(id, edit_menu_button)
func view_menu_id_pressed(id: int) -> void:
match id:
Global.ViewMenu.TILE_MODE_OFFSETS:
_show_tile_mode_offsets_popup()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ViewMenu.GREYSCALE_VIEW:
_toggle_greyscale_view()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ViewMenu.MIRROR_VIEW:
_toggle_mirror_view()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ViewMenu.SHOW_GRID:
_toggle_show_grid()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ViewMenu.SHOW_PIXEL_GRID:
_toggle_show_pixel_grid()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ViewMenu.SHOW_RULERS:
_toggle_show_rulers()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ViewMenu.SHOW_GUIDES:
_toggle_show_guides()
_:
_handle_metadata(id, view_menu_button)
Global.canvas.update()
func _show_tile_mode_offsets_popup() -> void:
Global.control.get_node("Dialogs/TileModeOffsetsDialog").popup_centered()
Global.dialog_open(true)
func _tile_mode_submenu_id_pressed(id: int) -> void:
Global.current_project.tiles.mode = id
Global.transparent_checker.fit_rect(Global.current_project.tiles.get_bounding_rect())
for i in Tiles.MODE.values():
tile_mode_submenu.set_item_checked(i, i == id)
Global.canvas.tile_mode.update()
Global.canvas.pixel_grid.update()
Global.canvas.grid.update()
func window_menu_id_pressed(id: int) -> void:
match id:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.WindowMenu.WINDOW_OPACITY:
window_opacity_dialog.popup_centered()
Global.dialog_open(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.WindowMenu.MOVABLE_PANELS:
ui.tabs_visible = !ui.tabs_visible
window_menu.set_item_checked(id, ui.tabs_visible)
Global.WindowMenu.ZEN_MODE:
_toggle_zen_mode()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.WindowMenu.FULLSCREEN_MODE:
_toggle_fullscreen()
_:
_handle_metadata(id, window_menu_button)
func _panels_submenu_id_pressed(id: int) -> void:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
if zen_mode:
return
var element_visible = panels_submenu.is_item_checked(id)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
ui.set_control_hidden(ui_elements[id], element_visible)
panels_submenu.set_item_checked(id, !element_visible)
func _layouts_submenu_id_pressed(id: int) -> void:
if id == 0:
Global.control.get_node("Dialogs/ManageLayouts").popup_centered()
Global.dialog_open(true)
else:
set_layout(id - 1)
func set_layout(id: int) -> void:
2022-03-01 22:41:22 +00:00
if id >= layouts.size():
id = 0
selected_layout = id
ui.layout = layouts[id][1].clone() # Clone is needed to avoid modifying premade layouts
for i in layouts.size():
var offset: int = i + 1
layouts_submenu.set_item_checked(offset, offset == (id + 1))
for i in ui_elements.size():
var is_hidden: bool = ui.is_control_hidden(ui_elements[i])
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
panels_submenu.set_item_checked(i, !is_hidden)
if zen_mode: # Turn zen mode off
2022-03-01 22:41:22 +00:00
Global.control.find_node("TabsContainer").visible = true
zen_mode = false
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
window_menu.set_item_checked(Global.WindowMenu.ZEN_MODE, false)
# Hacky but without 2 idle frames it doesn't work properly. Should be replaced eventually
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
# Call set_tabs_visible to keep tabs visible if there are 2 or more in the same panel
ui.tabs_visible = ui.tabs_visible
func _toggle_greyscale_view() -> void:
Global.greyscale_view = !Global.greyscale_view
greyscale_vision.visible = Global.greyscale_view
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.set_item_checked(Global.ViewMenu.GREYSCALE_VIEW, Global.greyscale_view)
func _toggle_mirror_view() -> void:
Global.mirror_view = !Global.mirror_view
var marching_ants_outline: Sprite = Global.canvas.selection.marching_ants_outline
marching_ants_outline.scale.x = -marching_ants_outline.scale.x
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
if Global.mirror_view:
marching_ants_outline.position.x = (
marching_ants_outline.position.x
+ Global.current_project.size.x
)
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
else:
Global.canvas.selection.marching_ants_outline.position.x = 0
Global.canvas.selection.update()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.set_item_checked(Global.ViewMenu.MIRROR_VIEW, Global.mirror_view)
func _toggle_show_grid() -> void:
Global.draw_grid = !Global.draw_grid
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.set_item_checked(Global.ViewMenu.SHOW_GRID, Global.draw_grid)
if Global.canvas.grid:
Global.canvas.grid.update()
func _toggle_show_pixel_grid() -> void:
Global.draw_pixel_grid = !Global.draw_pixel_grid
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.set_item_checked(Global.ViewMenu.SHOW_PIXEL_GRID, Global.draw_pixel_grid)
if Global.canvas.pixel_grid:
Global.canvas.pixel_grid.update()
func _toggle_show_rulers() -> void:
Global.show_rulers = !Global.show_rulers
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.set_item_checked(Global.ViewMenu.SHOW_RULERS, Global.show_rulers)
Global.horizontal_ruler.visible = Global.show_rulers
Global.vertical_ruler.visible = Global.show_rulers
func _toggle_show_guides() -> void:
Global.show_guides = !Global.show_guides
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
view_menu.set_item_checked(Global.ViewMenu.SHOW_GUIDES, Global.show_guides)
for guide in Global.canvas.get_children():
if guide is Guide and guide in Global.current_project.guides:
guide.visible = Global.show_guides
if guide is SymmetryGuide:
if guide.type == Guide.Types.HORIZONTAL:
guide.visible = Global.show_x_symmetry_axis and Global.show_guides
else:
guide.visible = Global.show_y_symmetry_axis and Global.show_guides
func _toggle_zen_mode() -> void:
for i in ui_elements.size():
if ui_elements[i].name == "Main Canvas":
continue
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
if !panels_submenu.is_item_checked(i):
continue
ui.set_control_hidden(ui_elements[i], !zen_mode)
2021-11-23 00:36:22 +00:00
Global.control.find_node("TabsContainer").visible = zen_mode
zen_mode = !zen_mode
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
window_menu.set_item_checked(Global.WindowMenu.ZEN_MODE, zen_mode)
func _toggle_fullscreen() -> void:
OS.window_fullscreen = !OS.window_fullscreen
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
window_menu.set_item_checked(Global.WindowMenu.FULLSCREEN_MODE, OS.window_fullscreen)
if OS.window_fullscreen: # If window is fullscreen then reset transparency
window_opacity_dialog.set_window_opacity(100.0)
func image_menu_id_pressed(id: int) -> void:
match id:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.SCALE_IMAGE:
_show_scale_image_popup()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.CENTRALIZE_IMAGE:
DrawingAlgos.centralize()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.CROP_IMAGE:
DrawingAlgos.crop_image()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.RESIZE_CANVAS:
_show_resize_canvas_popup()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.FLIP:
Global.control.get_node("Dialogs/ImageEffects/FlipImageDialog").popup_centered()
Global.dialog_open(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.ROTATE:
_show_rotate_image_popup()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.INVERT_COLORS:
Global.control.get_node("Dialogs/ImageEffects/InvertColorsDialog").popup_centered()
Global.dialog_open(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.DESATURATION:
Global.control.get_node("Dialogs/ImageEffects/DesaturateDialog").popup_centered()
Global.dialog_open(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.OUTLINE:
_show_add_outline_popup()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.DROP_SHADOW:
2022-04-27 11:48:31 +00:00
_show_drop_shadow_popup()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.HSV:
_show_hsv_configuration_popup()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.ImageMenu.GRADIENT:
Global.control.get_node("Dialogs/ImageEffects/GradientDialog").popup_centered()
Global.dialog_open(true)
Global.ImageMenu.GRADIENT_MAP:
Global.control.get_node("Dialogs/ImageEffects/GradientMapDialog").popup_centered()
Global.dialog_open(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
# Global.ImageMenu.SHADER:
# Global.control.get_node("Dialogs/ImageEffects/ShaderEffect").popup_centered()
# Global.dialog_open(true)
_:
_handle_metadata(id, image_menu_button)
func _show_scale_image_popup() -> void:
Global.control.get_node("Dialogs/ImageEffects/ScaleImage").popup_centered()
Global.dialog_open(true)
func _show_resize_canvas_popup() -> void:
Global.control.get_node("Dialogs/ImageEffects/ResizeCanvas").popup_centered()
Global.dialog_open(true)
func _show_rotate_image_popup() -> void:
Global.control.get_node("Dialogs/ImageEffects/RotateImage").popup_centered()
Global.dialog_open(true)
func _show_add_outline_popup() -> void:
Global.control.get_node("Dialogs/ImageEffects/OutlineDialog").popup_centered()
Global.dialog_open(true)
2022-04-27 11:48:31 +00:00
func _show_drop_shadow_popup() -> void:
Global.control.get_node("Dialogs/ImageEffects/DropShadowDialog").popup_centered()
Global.dialog_open(true)
func _show_hsv_configuration_popup() -> void:
Global.control.get_node("Dialogs/ImageEffects/HSVDialog").popup_centered()
Global.dialog_open(true)
func select_menu_id_pressed(id: int) -> void:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
match id:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.SelectMenu.SELECT_ALL:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.canvas.selection.select_all()
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.SelectMenu.CLEAR_SELECTION:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.canvas.selection.clear_selection(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.SelectMenu.INVERT:
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
Global.canvas.selection.invert()
_:
_handle_metadata(id, select_menu_button)
New selection system (#474) * Basic move tool * Added marching ants effect on the selection borders * Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist - Create multiple selection rectangles - Merge them together if they intersect - Move the selections (without contents as of right now) - Gizmos are being drawn but they are not functional yet Code is very ugly. * Sort vectors counter-clockwise to be used as polygon borders I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere * More experiments I may or may not need Trying to generate a polygon from the individual selected pixels * Change default rectangle select behavior and ability to clip polygons using Control * Fix rectangle selection clipping * Split polygon into two with selection subtracting * Move selection with contents with the move tool Code is still a mess, don't bother looking. * Move some methods from SelectionShape.gd to Selection.gd The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow. * UndoRedo for border moving Nothing else in the selections system works properly in UndoRedo right now. Needs: - UR support for creating selections - UR support for modifying selections (merging and cutting selections together) - UR support for removing selection - UR support for moving content & for all the rest of the remaining features * Moving all of the selection shape logic to Selection.gd Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up. * Move tool works again Buggy and messy, of course. * Remove unneeded code and restore selection move undoredo logic * Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon. * UndoRedo support for creating, deleting, merging and clipping selections UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class. * Confirm & cancel selection movement, should support undoredo properly too Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too. * Mirror View affects selection * Restore Cut, Copy, Paste and Clear Selection Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too. * Created a new Select menu, which has Select All and Clear Selection as options Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons. * Draw gizmos as rectangles No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events. * Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts Still no functionality yet. * Restore label text * Minor optimization when clipping selections This will execute the for loop less times * Made a Gizmo class, cursor change on hover, has_focus = false on mouse click Now I should actually make them resize when dragged, aye? * Very basic gizmo resizing, still a WIP, does not work properly yet * Start replacing the array of selected pixels with a BitMap This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader Still commit is still a WIP, image effects and brushes may not work properly yet. Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation. * Selection works with mirror view * Draw a black rectangle when the user is making a rectangular selection After they release the mouse, the black rectangle becomes the selection * Make Selection.gd update when undoing/redoing * Fix brushes not working properly with non-rectangular selections * Added invert selection * Cache has_selection as a variable for a speedup * Fix conflict issues with the shape tools * Made the bitmap image squared so the marching ants effect will be the same on both dimensions There may be a better way to fix the issue, perhaps inside the shader itself. * Some optimizations to call selection_bitmap_changed() less times * Restored almost all of the image effects Left to do: - Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection. - Restore rotation - Resize bitmap on image resize - Remove the `pixels` array from the ImageEffect * Fix Selection.gd not updating when changing project * Resize the selection bitmap along with image resize * Restored rotation's old behavior and finally got rid of the selected_pixels array The rotation does not yet work properly with selections, but at least it now "works". * Resize selection too when using gizmos Left to do for gizmos: - Proper cancel transformation - Begin transformation (currently named move_content_start but it should be renamed to something more general) when resizing gizmos - Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss. - Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user. * Image and bitmap resizing now uses the original data and begin transformation on gizmo click No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel. * Cancel transformation now works properly when the selection has been resized * Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool * Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds Resizing currently does not work properly with negative (left & up) canvas boundaries * Flip image when resizing and the bounding rectangle gets flipped * Call move_content_confirm() when inverting selection * Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet) * Flip selection when resizing to negative bounding rectangle sizes And fix preview_image vertical flipping * Fix rotation so that it works (almost) properly with selections Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter * Experimental gizmo rotation - does not work properly yet Transforming the selection outside of the canvas is still broken. * Fix some issues with moving selection out of canvas bounds * Fix more issues with selection getting resized outside of canvas bounds * Update marching ants effect properly when switching between projects And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes * Made the rotation gizmo part of the gizmos array and resize them based on camera zoom * Remove unneeded parameter from move_bitmap_values() * Remove more unneeded parameters * Move the selection only if the cursor is above it and neither shift nor control are currently pressed * Gradient generation now works on non-rectangular selections Although this behavior might not be the intended one * Copy/paste marching ants effect offset Useful for when the selection is in negative coords * Fix issue with clear selection & UndoRedo * Restore the ability to move selection when it's in negative coords * Made the marching ants offset a Project variable This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords. * Made the "from current selection" palette preset work with the new selection system * Fix out of bounds error when using the rectangular select tool on negative coords * Some code cleanup * Comment out the rotation gizmo for now, since it does not work properly * Update marching ants shader params and gizmo sizes when the bitmap changes * Move some methods around in Selection.gd
2021-04-17 18:30:12 +00:00
func help_menu_id_pressed(id: int) -> void:
match id:
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.HelpMenu.VIEW_SPLASH_SCREEN:
Global.control.get_node("Dialogs/SplashDialog").popup_centered()
Global.dialog_open(true)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.HelpMenu.ONLINE_DOCS:
2022-06-06 12:41:05 +00:00
OS.shell_open("https://www.oramainteractive.com/Pixelorama-Docs/")
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.HelpMenu.ISSUE_TRACKER:
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/issues")
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.HelpMenu.OPEN_LOGS_FOLDER:
var dir = Directory.new()
dir.make_dir_recursive("user://logs") # In case someone deleted it
OS.shell_open(ProjectSettings.globalize_path("user://logs"))
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.HelpMenu.CHANGELOG:
OS.shell_open(
"https://github.com/Orama-Interactive/Pixelorama/blob/master/CHANGELOG.md#v0102---2022-08-18"
)
Implement the Keychain Plugin (#700) * Start implementing the godot_better_input plugin * Update ShortcutEdit.gd * Load & save preset option * Add some groups and fix action events not being deleted on load * Add MenuInputAction class for multiple menu accelerators * Create a proper plugin and a BetterInput autoload * Update menu accelerators * Move settings to BetterInput * Move menu enums to Global, make more MenuInputActions * Add more menu events * Add new groups * Optimize BetterInput _input() method * Remove a lot of lines of code * Change some previous events, add ignore actions and a View menu group * Change update_item_accelerator to update_ui * Move MenuInputAction initialization to BetterInput.gd * Update hint tooltips when a shortcut changes Temporarily comment out some code regarding the configurable modifiers * Some MenuInputAction variable name changes * Add handle_input() to InputAction * Update the shortcuts of buttons * Fix shortcut selector menu position * Change plugin name into Keychain * Fix keyboard input dialog exiting when Enter or Space is being pressed * Add two more groups * Make groups folded by default * Temporarily make tool modifier shortcuts not configurable A temporary change, they will be made configurable again, with different actions that are currently mapped to the same events, local/independent from each other. * Add license for Keychain * Fix issue where a key event would be added in other input types * Fix bug where the assigned state was not updated when the dialog appeared again * Update Main.tscn * Add a disabled line edit in keyboard shortcut selector to grab focus * Load presets in the Keychain autoload This way, the input actions get updated from the start, instead of only at the ShortcutEdit scene. WARNING, this currently causes crashes if the menu items have no shortcut binded to them. * Move custom settings away from Keychain.gd To keep it the same as the upstream plugin * Change menu enum names * Made action_get_first_key() more general * Use arrays for menu items instead of dictionaries, fixes crash * Move moveable panels to Window menu * Format * Optimize hint tooltip updating * Add support for translations in Keychain * Translation changes * Made tool modifiers configurable Needs more testing. * Made camera arrow key movement configurable & joypad axis support This commit removes the ability to press Shift and Control+Shift to adjust the camera arrow key movement speed. Instead, the speed depends on the zoom level. The right joypad analog stick is configured to move the camera by default. * Rename presets into shortcut profiles, use Resources and let users create their own * [skip ci] Update addons README * Update Global.gd
2022-05-16 12:07:51 +00:00
Global.HelpMenu.ABOUT_PIXELORAMA:
Global.control.get_node("Dialogs/AboutDialog").popup_centered()
Global.dialog_open(true)
_:
_handle_metadata(id, help_menu_button)