2019-08-18 09:28:38 +00:00
|
|
|
|
extends Node
|
|
|
|
|
|
2022-03-28 23:35:32 +00:00
|
|
|
|
signal project_changed
|
2023-01-02 22:52:23 +00:00
|
|
|
|
signal cel_changed
|
2022-03-28 23:35:32 +00:00
|
|
|
|
|
2023-03-31 18:58:56 +00:00
|
|
|
|
enum LayerTypes { PIXEL, GROUP, THREE_D }
|
2021-11-25 12:48:30 +00:00
|
|
|
|
enum GridTypes { CARTESIAN, ISOMETRIC, ALL }
|
2022-09-09 23:58:13 +00:00
|
|
|
|
enum ColorFrom { THEME, CUSTOM }
|
2021-11-25 12:48:30 +00:00
|
|
|
|
enum ButtonSize { SMALL, BIG }
|
2021-06-13 23:14:31 +00:00
|
|
|
|
|
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
|
|
|
|
enum FileMenu { NEW, OPEN, OPEN_LAST_PROJECT, RECENT, SAVE, SAVE_AS, EXPORT, EXPORT_AS, QUIT }
|
2022-09-14 21:08:22 +00:00
|
|
|
|
enum EditMenu { 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
|
|
|
|
enum ViewMenu {
|
|
|
|
|
TILE_MODE,
|
2022-06-20 09:07:20 +00:00
|
|
|
|
TILE_MODE_OFFSETS,
|
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
|
|
|
|
GREYSCALE_VIEW,
|
|
|
|
|
MIRROR_VIEW,
|
|
|
|
|
SHOW_GRID,
|
|
|
|
|
SHOW_PIXEL_GRID,
|
|
|
|
|
SHOW_RULERS,
|
|
|
|
|
SHOW_GUIDES,
|
2023-02-12 13:20:53 +00:00
|
|
|
|
SHOW_MOUSE_GUIDES,
|
2023-02-02 01:45:36 +00:00
|
|
|
|
SNAP_TO,
|
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
|
|
|
|
}
|
|
|
|
|
enum WindowMenu { WINDOW_OPACITY, PANELS, LAYOUTS, MOVABLE_PANELS, ZEN_MODE, FULLSCREEN_MODE }
|
|
|
|
|
enum ImageMenu {
|
|
|
|
|
SCALE_IMAGE,
|
|
|
|
|
CENTRALIZE_IMAGE,
|
|
|
|
|
CROP_IMAGE,
|
|
|
|
|
RESIZE_CANVAS,
|
|
|
|
|
FLIP,
|
|
|
|
|
ROTATE,
|
|
|
|
|
INVERT_COLORS,
|
|
|
|
|
DESATURATION,
|
|
|
|
|
OUTLINE,
|
|
|
|
|
DROP_SHADOW,
|
|
|
|
|
HSV,
|
|
|
|
|
GRADIENT,
|
2022-06-11 13:15:34 +00:00
|
|
|
|
GRADIENT_MAP,
|
2023-04-20 13:08:06 +00:00
|
|
|
|
POSTERIZE,
|
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
|
|
|
|
|
}
|
2023-04-28 13:38:14 +00:00
|
|
|
|
enum SelectMenu { SELECT_ALL, CLEAR_SELECTION, INVERT, TILE_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
|
|
|
|
enum HelpMenu {
|
|
|
|
|
VIEW_SPLASH_SCREEN,
|
|
|
|
|
ONLINE_DOCS,
|
|
|
|
|
ISSUE_TRACKER,
|
|
|
|
|
OPEN_LOGS_FOLDER,
|
|
|
|
|
CHANGELOG,
|
|
|
|
|
ABOUT_PIXELORAMA
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-29 17:58:24 +00:00
|
|
|
|
const OVERRIDE_FILE := "override.cfg"
|
|
|
|
|
|
2020-05-31 13:04:33 +00:00
|
|
|
|
var root_directory := "."
|
2021-11-29 15:12:30 +00:00
|
|
|
|
var window_title := "" setget _title_changed # Why doesn't Godot have get_window_title()?
|
2020-05-31 13:04:33 +00:00
|
|
|
|
var config_cache := ConfigFile.new()
|
|
|
|
|
var XDGDataPaths = preload("res://src/XDGDataPaths.gd")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var directory_module: Reference
|
2020-04-13 07:55:01 +00:00
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var projects := [] # Array of Projects
|
|
|
|
|
var current_project: Project
|
2021-11-29 15:12:30 +00:00
|
|
|
|
var current_project_index := 0 setget _project_changed
|
2020-06-04 18:05:36 +00:00
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var ui_tooltips := {}
|
2020-10-26 20:51:55 +00:00
|
|
|
|
|
2019-12-25 19:42:01 +00:00
|
|
|
|
# Canvas related stuff
|
2019-08-18 09:28:38 +00:00
|
|
|
|
var can_draw := false
|
2022-02-11 01:16:33 +00:00
|
|
|
|
var move_guides_on_canvas := false
|
2019-10-03 16:37:31 +00:00
|
|
|
|
var has_focus := false
|
2020-04-24 21:42:02 +00:00
|
|
|
|
|
2020-04-11 17:10:07 +00:00
|
|
|
|
var play_only_tags := true
|
2020-07-16 02:05:40 +00:00
|
|
|
|
var show_x_symmetry_axis := false
|
|
|
|
|
var show_y_symmetry_axis := false
|
2020-02-11 22:38:35 +00:00
|
|
|
|
|
2020-06-04 20:20:20 +00:00
|
|
|
|
# Preferences
|
2020-07-28 22:54:15 +00:00
|
|
|
|
var open_last_project := false
|
2022-01-05 00:34:45 +00:00
|
|
|
|
var quit_confirmation := false
|
2021-06-04 18:44:05 +00:00
|
|
|
|
var smooth_zoom := true
|
|
|
|
|
|
2020-11-07 01:57:35 +00:00
|
|
|
|
var shrink := 1.0
|
2021-03-17 17:28:01 +00:00
|
|
|
|
var dim_on_popup := true
|
2021-06-04 18:44:05 +00:00
|
|
|
|
var modulate_icon_color := Color.gray
|
2022-09-09 23:58:13 +00:00
|
|
|
|
var icon_color_from: int = ColorFrom.THEME
|
|
|
|
|
var modulate_clear_color := Color.gray
|
|
|
|
|
var clear_color_from: int = ColorFrom.THEME
|
2021-06-04 18:44:05 +00:00
|
|
|
|
var custom_icon_color := Color.gray
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var tool_button_size: int = ButtonSize.SMALL
|
2022-07-07 23:49:40 +00:00
|
|
|
|
var left_tool_color := Color("0086cf")
|
|
|
|
|
var right_tool_color := Color("fd6d14")
|
2021-06-03 19:42:08 +00:00
|
|
|
|
|
2021-12-01 18:50:50 +00:00
|
|
|
|
var default_width := 64
|
|
|
|
|
var default_height := 64
|
2020-01-10 19:24:07 +00:00
|
|
|
|
var default_fill_color := Color(0, 0, 0, 0)
|
2023-04-18 14:20:13 +00:00
|
|
|
|
var snapping_distance := 32.0
|
2021-01-20 14:59:42 +00:00
|
|
|
|
var grid_type = GridTypes.CARTESIAN
|
2023-04-18 13:38:55 +00:00
|
|
|
|
var grid_size := Vector2(2, 2)
|
|
|
|
|
var isometric_grid_size := Vector2(16, 8)
|
|
|
|
|
var grid_offset := Vector2.ZERO
|
2021-01-20 00:17:33 +00:00
|
|
|
|
var grid_draw_over_tile_mode := false
|
2019-12-07 17:34:54 +00:00
|
|
|
|
var grid_color := Color.black
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var pixel_grid_show_at_zoom := 1500.0 # percentage
|
2021-01-16 18:24:46 +00:00
|
|
|
|
var pixel_grid_color := Color("91212121")
|
2019-12-27 00:28:36 +00:00
|
|
|
|
var guide_color := Color.purple
|
2020-04-18 07:03:18 +00:00
|
|
|
|
var checker_size := 10
|
2020-05-03 00:42:44 +00:00
|
|
|
|
var checker_color_1 := Color(0.47, 0.47, 0.47, 1)
|
|
|
|
|
var checker_color_2 := Color(0.34, 0.35, 0.34, 1)
|
2020-08-17 19:30:58 +00:00
|
|
|
|
var checker_follow_movement := false
|
|
|
|
|
var checker_follow_scale := false
|
2020-10-25 23:10:14 +00:00
|
|
|
|
var tilemode_opacity := 1.0
|
2021-05-28 00:46:16 +00:00
|
|
|
|
|
|
|
|
|
var selection_animated_borders := true
|
|
|
|
|
var selection_border_color_1 := Color.white
|
|
|
|
|
var selection_border_color_2 := Color.black
|
|
|
|
|
|
2021-12-11 18:02:51 +00:00
|
|
|
|
var pause_when_unfocused := true
|
2021-01-05 18:01:50 +00:00
|
|
|
|
var fps_limit := 0
|
2019-12-05 23:48:29 +00:00
|
|
|
|
|
2020-07-29 00:16:02 +00:00
|
|
|
|
var autosave_interval := 1.0
|
2020-05-31 20:04:59 +00:00
|
|
|
|
var enable_autosave := true
|
2022-11-29 17:58:24 +00:00
|
|
|
|
var renderer := OS.get_current_video_driver() setget _renderer_changed
|
2022-11-29 19:10:49 +00:00
|
|
|
|
var tablet_driver := 0 setget _tablet_driver_changed
|
2020-05-31 20:04:59 +00:00
|
|
|
|
|
2019-12-25 19:42:01 +00:00
|
|
|
|
# Tools & options
|
2020-01-13 11:26:06 +00:00
|
|
|
|
var show_left_tool_icon := true
|
|
|
|
|
var show_right_tool_icon := true
|
2019-12-05 23:48:29 +00:00
|
|
|
|
var left_square_indicator_visible := true
|
2022-07-07 23:49:40 +00:00
|
|
|
|
var right_square_indicator_visible := true
|
2022-02-10 20:32:55 +00:00
|
|
|
|
var native_cursors := false
|
|
|
|
|
var cross_cursor := true
|
2020-04-24 21:42:02 +00:00
|
|
|
|
|
2019-12-25 19:42:01 +00:00
|
|
|
|
# View menu options
|
2022-02-11 22:47:26 +00:00
|
|
|
|
var greyscale_view := false
|
2020-11-23 16:53:21 +00:00
|
|
|
|
var mirror_view := false
|
2019-09-09 22:57:46 +00:00
|
|
|
|
var draw_grid := false
|
2021-01-16 18:24:46 +00:00
|
|
|
|
var draw_pixel_grid := false
|
2019-12-03 00:30:38 +00:00
|
|
|
|
var show_rulers := true
|
|
|
|
|
var show_guides := true
|
2023-02-12 13:20:53 +00:00
|
|
|
|
var show_mouse_guides := false
|
2023-01-25 02:37:03 +00:00
|
|
|
|
var snap_to_rectangular_grid := false
|
|
|
|
|
var snap_to_guides := false
|
2023-02-12 19:32:35 +00:00
|
|
|
|
var snap_to_perspective_guides := false
|
2019-12-05 23:48:29 +00:00
|
|
|
|
|
2019-12-25 19:42:01 +00:00
|
|
|
|
# Onion skinning options
|
2020-03-26 18:56:30 +00:00
|
|
|
|
var onion_skinning := false
|
2020-05-01 17:47:10 +00:00
|
|
|
|
var onion_skinning_past_rate := 1.0
|
|
|
|
|
var onion_skinning_future_rate := 1.0
|
2019-12-05 23:48:29 +00:00
|
|
|
|
var onion_skinning_blue_red := false
|
|
|
|
|
|
2019-12-25 19:42:01 +00:00
|
|
|
|
# Palettes
|
2019-12-15 03:11:32 +00:00
|
|
|
|
var palettes := {}
|
|
|
|
|
|
2023-03-16 17:50:45 +00:00
|
|
|
|
# Crop Options:
|
|
|
|
|
var crop_top := 0
|
|
|
|
|
var crop_bottom := 0
|
|
|
|
|
var crop_left := 0
|
|
|
|
|
var crop_right := 0
|
|
|
|
|
|
2019-12-25 19:42:01 +00:00
|
|
|
|
# Nodes
|
2023-03-31 18:58:56 +00:00
|
|
|
|
var base_layer_button_node: PackedScene = preload("res://src/UI/Timeline/BaseLayerButton.tscn")
|
Basic Layer Groups and Timeline Refactor (#698)
* Fixed issues with Shading tool Saturation and Value not always being right in Hue Shading mode
* Shading tool hue shifting fixes and tweaks
* Bringing over changes from layer groups brach, without any changes to layer blending
* Some quick fixes to make it work again
* Fixed some of the places where GroupLayers cause errors. Cel Buttons are now hidden when groups are collapsed
* Layer drag highlighting (need to actually drop them correctly, also need to do cels)
* Added more layer hierarchy related functions, organized the function order in the Layer classes a bit
* Switched the layer type changing from string to int
* Moved layer type enum to Global
* Added get_layer_type_name(), currently used for the default layer name
* Renamed the layer get_children/is_a_parent_of functions
* changed get_layer_type_name() to get_default_name(number)
* New layer drag and dropping behavior
* Added read/write_image_data_from/to_pxo functions to Cel classes to handle saving/loading the binary image data for each cel type
* Fixed warning
* Added a line to child layers wich makes it easier to see where they are in the hierarchy
* Fixed debugger warning
* Fixed all cel types loading as PixelCels
* Fixed spacing issue with cels when collapsing groups
* Fixed bug when dropping a child layer to the bottom region of its parent group, where it would end up to far down (maybe disappearing)
* updated temporary todo comments
* Created a base scene for layer buttons and merged layer button script into one
* Prevent the case of parenting to itself in layer drag and drop, fixed static reference to LayerButton still being BaseLayerButton
* Use a base scene for CelButtons
* First bit of the refactoring work
* Several bits of refactoring
* Fixed moving cels
* Cleaned up Project.move_cel function
* Fixed project_layer_removed
* Updated change_frame_order on FrameButton. Some (not all) work on getting the layer UI updated when pressing buttons such as collapse/visible/lock
* Bug fixes. Updating layer button's buttons
* Fixed timeline selection issues when creating a new project. Some code cleanup
* tweaks
* Removed a bunch of commented out code
* Removing more commented out code
* Fixed bugs with timeline selectio. Fixed cels being placed in the reverse layer order when adding a frame
* Changed add/remove_frame to add/remove_frames (multiple support)
* Refactored copy_frames in animation timeline
* added copy function to cel classes
* added layer copy function
* simplifed copy_frames a tiny bit
* Updated TODO comments to categorize them and remove any that were already done
* Turned Project.add/remove_layer into Project.add/remove_layers (multiple support), not yet tested
* Seperated the layer cloning functionality in timeline's add_layer to its own function, since they're only used by one button, renamed to _on_Button_pressed naming scheme, added children support to the delete layer button
* some TODOs
* Added layer swapping
* Added priorities to refactor TODOs
* Simplified layer swapping code a little
* Fixed performance regression on changing project, updated TODOs
* Included _on_MergeDownLayer_pressed in timeline refactor
* Cleaned up _on_MergeDownLayer_pressed refactor
* If all frames are selected, prevent being able to remove all of them
* Fixed cel linking when cloning layers/frames. Moved the copy function from cel classes to layer classes, splitting into copy_cel and copy_all_cels
* Combined and rewrote the 2 project _toggle_layer_buttons_.. functions into 1 simpler _toggle_layer_buttons function
* Simplified _toggle_layer_buttons some more
* Added hierarchy support for move up/down layer buttons
* Added toggle_frame_buttons method to project (extracted from _frame_changed). Called from main when setting up startup project. Removed _ from start of _toggle_layer_buttons name
* Fixed duplicate_layers parent references being to the original layers
* cleaned up project.move_layers method a bit
* TODOs
* moved the transform_content_confirm calls for the layer buttons in AnimationTimeline (Add/remove/clone) to the project layer modification functions
* animation first/last_frame tweaks and un-press play buttons when the first/last_frame are the same in _on_AnimationTimer_timeout in AnimationTimeline
* Cleaned up project_changed in ANimationTimeline a bit
* Cleaned up project_layer_added in AnimationTimeline
* Changed Layer classes get_default_name to set_name_to_default
* Cleaned up LayerButton.drop_data slightly
* Looked at some of my TODOs
* cleaned up copying cels
* Fixed CelButton linked_indicator not showing up right away when becoming linked
* Cleand up link/unlink cel menu option a little. Fixed situatoin where trying to call button_setup on cel_button that doesn't exist anymore due to undo/redo
* Fixed regression with copy_cel (linked) in when cloning a frame
* Minor cleanup, more detailed comments, updated TODOs
* more improved comments
* Made focus_mode on Cel/Layer/FrameButton NONE to fix bug where it looks like one is selected after pressing it and adding a new Layer/Frame (but its just in the focus state, not the pressed state
* Made AnimationTimeline.change_layer_order work a little more consistantly with LayerButton.drop_data, and fixed a minor bug in it
* Updated comments and TODOs
* cleanup
* removed some code that should no longer be needed
* updated comment
* removed Project's frames and layers setters _frames_changed and _layers_changed
* Made some 'for x in range(array.size())' just 'for x in array.size()'
* updated comments/TODOs
* Cel content changes intial
* Added 'content' methods to Cel classes
* Removed image var from PixelCelButton
* Reusing PixelCelButton.gd on GroupCelButton scene
* Renamed PixelCelButton.gd to CelButton.gd (as it will be used for all Cel Buttons) and deleted GroupCelButton.gd
* Hide the TransparentChecker on GroupCelButton.tscn until a preview texture is added for GroupCels
* TODOs, prevent memory leak when closing projects
* Link/unlink cel cleanup
:
* Added _project param to _init methods of Layer classes
* Added update_texture method to Cel classes (moving part from the update_texture and update_selected_cels_textures methods from Canvas.gd
* Removed a temporary check (which also fixed another bug)
* Clone child layers when cloning a layer
* Added temp dummy get_image method to GroupCel, and use get_image when copying or picking colors
* TODOs
* Made open_image_as_spritesheet_layer work after the timeline refactor (still doesn't work with groups yet though). TODO comment updates
* Added create_new_cel methods to Layer classes
* Updated TODOs and comments
* Renamed Layer class's create_empty_cel to new_empty_cel to match Project's new_emtpy_frame
* Renamed create_layer/cel_button to instantiate_layer/cel_button
* updated TODOs
* prioritized TODOs
* Fixed some warnings
* removed commented out code from previous commit
* Fixed export
* Made open_image_as_new_frame work after timeline refactor
* Fixed open_image_as_new_layer after timeline refactor
* Some linked cel fixes
* More linked cels fixes
* cleanup
* Optimized importing spreadsheet as new layer
* Fixed Scale Image crash with Groups
* Fixed onion skin with groups
* Removed blend_mode from BaseLayer for now
* Mostly fixed image effects
* Fixed resize canvas
* Fixed drag and drop not working with Cel Buttons on Group Layers
* updated TODOs
* Renamed Replace Frame (in open image) to Replace Cel
* Continued renaming Replace Frame to Replace Cel
* Made open_image_at_cels work after timeline refactor
* Added get_layer_path method to BaseLayer
* Replaced AtLayerSpinbox with AtLayerOption for Open Image as New Frame or Replace Cel
* Updated TODOs
* updated TODOs
* Comments for cel content methods
* fixed right clicking group cel button deselecting the button (even though cel is still selected
* frame/layer modification methods comments
* Removed unneeded size flags
* TODO updates
* Removed a loop that would never run from open_image_as_spritesheet_tab
* TODO update
* Combined BaseLayer.get_children_direct and get_children_recursive into a single get_children method with a bool for recursive. Added a get_child_count method
* Removed unneeded frame paramaters from _on_DeleteFrame_pressed and _on_CopyFrame_pressed
* TODO Updates
* Removed unneeded code from delete_frames
* Made delete_frames variable names more consistent with my other changes
* Continuation
* made variable names in copy_frames more consistent with rest of changes
* Update TODOs
* Removed TODOs for after this PR (moved to my notes)
* Fixed crash when pasting image on Group
* Fixed layer .visible check to be is_visible_in_hierarchy()
* Removed some drag highlight polish code that didn't work
* Removed code from Canvas update_texture and update_selected_cels_textures that was redundant
* gdformat
* gdformat
* gdlint fixes
* Fixed Cel button not having its linked indicator show when enabling new cels linked on a layer other than the current layer
* Fixed crop image and centralize image
* Added '# gdlint: ignore=max-public-methods' to the top of Project'
* Fixed dragging cels to layer of different type crash
* Formatted CelButton.gd
Co-authored-by: MrTriPie <MrTriPie>
2022-09-28 18:59:49 +00:00
|
|
|
|
var pixel_layer_button_node: PackedScene = preload("res://src/UI/Timeline/PixelLayerButton.tscn")
|
|
|
|
|
var group_layer_button_node: PackedScene = preload("res://src/UI/Timeline/GroupLayerButton.tscn")
|
|
|
|
|
var pixel_cel_button_node: PackedScene = preload("res://src/UI/Timeline/PixelCelButton.tscn")
|
|
|
|
|
var group_cel_button_node: PackedScene = preload("res://src/UI/Timeline/GroupCelButton.tscn")
|
2019-12-15 03:11:32 +00:00
|
|
|
|
|
2022-08-24 11:22:40 +00:00
|
|
|
|
onready var control: Node = get_tree().current_scene
|
2021-11-25 12:48:30 +00:00
|
|
|
|
|
|
|
|
|
onready var canvas: Canvas = control.find_node("Canvas")
|
|
|
|
|
onready var tabs: Tabs = control.find_node("Tabs")
|
|
|
|
|
onready var main_viewport: ViewportContainer = control.find_node("ViewportContainer")
|
2022-02-14 23:42:20 +00:00
|
|
|
|
onready var second_viewport: ViewportContainer = control.find_node("Second Canvas")
|
2022-01-29 22:47:25 +00:00
|
|
|
|
onready var canvas_preview_container: Container = control.find_node("Canvas Preview")
|
2023-02-28 15:07:48 +00:00
|
|
|
|
onready var global_tool_options: PanelContainer = control.find_node("Global Tool Options")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
onready var small_preview_viewport: ViewportContainer = canvas_preview_container.find_node(
|
|
|
|
|
"PreviewViewportContainer"
|
|
|
|
|
)
|
|
|
|
|
onready var camera: Camera2D = main_viewport.find_node("Camera2D")
|
2022-02-14 23:42:20 +00:00
|
|
|
|
onready var camera2: Camera2D = second_viewport.find_node("Camera2D2")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
onready var camera_preview: Camera2D = control.find_node("CameraPreview")
|
2022-01-29 22:47:25 +00:00
|
|
|
|
onready var cameras := [camera, camera2, camera_preview]
|
2021-11-25 12:48:30 +00:00
|
|
|
|
onready var horizontal_ruler: BaseButton = control.find_node("HorizontalRuler")
|
|
|
|
|
onready var vertical_ruler: BaseButton = control.find_node("VerticalRuler")
|
|
|
|
|
onready var transparent_checker: ColorRect = control.find_node("TransparentChecker")
|
|
|
|
|
onready var preview_zoom_slider: VSlider = control.find_node("PreviewZoomSlider")
|
|
|
|
|
|
|
|
|
|
onready var brushes_popup: Popup = control.find_node("BrushesPopup")
|
|
|
|
|
onready var patterns_popup: Popup = control.find_node("PatternsPopup")
|
2022-03-10 17:17:28 +00:00
|
|
|
|
onready var palette_panel: PalettePanel = control.find_node("Palettes")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
|
2022-12-01 23:15:49 +00:00
|
|
|
|
onready var references_panel: ReferencesPanel = control.find_node("Reference Images")
|
2023-02-12 13:20:53 +00:00
|
|
|
|
onready var perspective_editor := control.find_node("Perspective Editor")
|
2022-11-08 18:04:41 +00:00
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
onready var top_menu_container: Panel = control.find_node("TopMenuContainer")
|
|
|
|
|
onready var cursor_position_label: Label = control.find_node("CursorPosition")
|
|
|
|
|
onready var current_frame_mark_label: Label = control.find_node("CurrentFrameMark")
|
|
|
|
|
|
2022-01-29 22:47:25 +00:00
|
|
|
|
onready var animation_timeline: Panel = control.find_node("Animation Timeline")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
onready var animation_timer: Timer = animation_timeline.find_node("AnimationTimer")
|
2022-10-21 13:04:26 +00:00
|
|
|
|
onready var frame_hbox: HBoxContainer = animation_timeline.find_node("FrameHBox")
|
|
|
|
|
onready var layer_vbox: VBoxContainer = animation_timeline.find_node("LayerVBox")
|
|
|
|
|
onready var cel_vbox: VBoxContainer = animation_timeline.find_node("CelVBox")
|
|
|
|
|
onready var tag_container: Control = animation_timeline.find_node("TagContainer")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
onready var play_forward: BaseButton = animation_timeline.find_node("PlayForward")
|
|
|
|
|
onready var play_backwards: BaseButton = animation_timeline.find_node("PlayBackwards")
|
|
|
|
|
onready var remove_frame_button: BaseButton = animation_timeline.find_node("DeleteFrame")
|
|
|
|
|
onready var move_left_frame_button: BaseButton = animation_timeline.find_node("MoveLeft")
|
|
|
|
|
onready var move_right_frame_button: BaseButton = animation_timeline.find_node("MoveRight")
|
|
|
|
|
onready var remove_layer_button: BaseButton = animation_timeline.find_node("RemoveLayer")
|
|
|
|
|
onready var move_up_layer_button: BaseButton = animation_timeline.find_node("MoveUpLayer")
|
|
|
|
|
onready var move_down_layer_button: BaseButton = animation_timeline.find_node("MoveDownLayer")
|
|
|
|
|
onready var merge_down_layer_button: BaseButton = animation_timeline.find_node("MergeDownLayer")
|
2022-09-29 22:03:38 +00:00
|
|
|
|
onready var layer_opacity_slider: ValueSlider = animation_timeline.find_node("OpacitySlider")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
|
2023-03-16 18:07:03 +00:00
|
|
|
|
onready var tile_mode_offset_dialog: AcceptDialog = control.find_node("TileModeOffsetsDialog")
|
2021-11-25 12:48:30 +00:00
|
|
|
|
onready var open_sprites_dialog: FileDialog = control.find_node("OpenSprite")
|
|
|
|
|
onready var save_sprites_dialog: FileDialog = control.find_node("SaveSprite")
|
|
|
|
|
onready var save_sprites_html5_dialog: ConfirmationDialog = control.find_node("SaveSpriteHTML5")
|
|
|
|
|
onready var export_dialog: AcceptDialog = control.find_node("ExportDialog")
|
|
|
|
|
onready var preferences_dialog: AcceptDialog = control.find_node("PreferencesDialog")
|
|
|
|
|
onready var error_dialog: AcceptDialog = control.find_node("ErrorDialog")
|
|
|
|
|
|
|
|
|
|
onready var current_version: String = ProjectSettings.get_setting("application/config/Version")
|
2020-05-03 21:04:00 +00:00
|
|
|
|
|
2021-11-15 22:04:50 +00:00
|
|
|
|
|
2022-11-29 18:48:36 +00:00
|
|
|
|
func _init() -> void:
|
2022-11-30 00:09:06 +00:00
|
|
|
|
if ProjectSettings.get_setting("display/window/tablet_driver") == "winink":
|
|
|
|
|
tablet_driver = 1
|
2022-11-29 18:48:36 +00:00
|
|
|
|
|
|
|
|
|
|
2019-08-18 09:28:38 +00:00
|
|
|
|
func _ready() -> 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
|
|
|
|
_initialize_keychain()
|
|
|
|
|
|
2020-02-09 23:23:33 +00:00
|
|
|
|
if OS.has_feature("standalone"):
|
|
|
|
|
root_directory = OS.get_executable_path().get_base_dir()
|
2021-11-22 15:37:06 +00:00
|
|
|
|
# root_directory must be set earlier than this is because XDGDataDirs depends on it
|
|
|
|
|
directory_module = XDGDataPaths.new()
|
|
|
|
|
|
2019-12-20 14:36:23 +00:00
|
|
|
|
# Load settings from the config file
|
|
|
|
|
config_cache.load("user://cache.ini")
|
2020-10-27 21:03:43 +00:00
|
|
|
|
|
2021-12-01 18:50:50 +00:00
|
|
|
|
default_width = config_cache.get_value("preferences", "default_width", default_width)
|
|
|
|
|
default_height = config_cache.get_value("preferences", "default_height", default_height)
|
2021-12-01 18:02:39 +00:00
|
|
|
|
default_fill_color = config_cache.get_value(
|
|
|
|
|
"preferences", "default_fill_color", default_fill_color
|
|
|
|
|
)
|
2021-12-01 18:50:50 +00:00
|
|
|
|
var proj_size := Vector2(default_width, default_height)
|
2021-12-01 18:02:39 +00:00
|
|
|
|
projects.append(Project.new([], tr("untitled"), proj_size))
|
2020-06-04 23:48:38 +00:00
|
|
|
|
current_project = projects[0]
|
2021-12-01 18:50:50 +00:00
|
|
|
|
current_project.fill_color = default_fill_color
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
for node in get_tree().get_nodes_in_group("UIButtons"):
|
|
|
|
|
var tooltip: String = node.hint_tooltip
|
|
|
|
|
if !tooltip.empty() and node.shortcut:
|
|
|
|
|
ui_tooltips[node] = tooltip
|
2020-06-04 23:48:38 +00:00
|
|
|
|
|
2020-04-02 00:29:14 +00:00
|
|
|
|
|
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
|
|
|
|
func _initialize_keychain() -> void:
|
|
|
|
|
Keychain.config_file = config_cache
|
|
|
|
|
Keychain.actions = {
|
|
|
|
|
"new_file": Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.NEW),
|
|
|
|
|
"open_file": Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.OPEN),
|
2022-05-20 21:50:39 +00:00
|
|
|
|
"open_last_project":
|
|
|
|
|
Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.OPEN_LAST_PROJECT),
|
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
|
|
|
|
"save_file": Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.SAVE),
|
|
|
|
|
"save_file_as":
|
|
|
|
|
Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.SAVE_AS),
|
|
|
|
|
"export_file":
|
|
|
|
|
Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.EXPORT),
|
|
|
|
|
"export_file_as":
|
|
|
|
|
Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.EXPORT_AS),
|
|
|
|
|
"quit": Keychain.MenuInputAction.new("", "File menu", true, "FileMenu", FileMenu.QUIT),
|
|
|
|
|
"redo":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.REDO, true),
|
|
|
|
|
"undo":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.UNDO, true),
|
|
|
|
|
"cut": Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.CUT),
|
|
|
|
|
"copy": Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.COPY),
|
|
|
|
|
"paste": Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.PASTE),
|
2022-09-14 21:08:22 +00:00
|
|
|
|
"paste_in_place":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.PASTE_IN_PLACE),
|
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
|
|
|
|
"delete": Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.DELETE),
|
|
|
|
|
"new_brush":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.NEW_BRUSH),
|
2022-05-20 21:50:39 +00:00
|
|
|
|
"preferences":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Edit menu", true, "EditMenu", EditMenu.PREFERENCES),
|
|
|
|
|
"scale_image":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.SCALE_IMAGE),
|
|
|
|
|
"centralize_image":
|
|
|
|
|
Keychain.MenuInputAction.new(
|
|
|
|
|
"", "Image menu", true, "ImageMenu", ImageMenu.CENTRALIZE_IMAGE
|
|
|
|
|
),
|
|
|
|
|
"crop_image":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.CROP_IMAGE),
|
|
|
|
|
"resize_canvas":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.RESIZE_CANVAS),
|
|
|
|
|
"mirror_image":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.FLIP),
|
|
|
|
|
"rotate_image":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.ROTATE),
|
|
|
|
|
"invert_colors":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.INVERT_COLORS),
|
|
|
|
|
"desaturation":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.DESATURATION),
|
|
|
|
|
"outline":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.OUTLINE),
|
|
|
|
|
"drop_shadow":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.DROP_SHADOW),
|
|
|
|
|
"adjust_hsv":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.HSV),
|
|
|
|
|
"gradient":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.GRADIENT),
|
2022-06-11 13:15:34 +00:00
|
|
|
|
"gradient_map":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.GRADIENT_MAP),
|
2023-04-20 13:08:06 +00:00
|
|
|
|
"posterize":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Image menu", true, "ImageMenu", ImageMenu.POSTERIZE),
|
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":
|
|
|
|
|
Keychain.MenuInputAction.new("", "View menu", true, "ViewMenu", ViewMenu.MIRROR_VIEW),
|
|
|
|
|
"show_grid":
|
|
|
|
|
Keychain.MenuInputAction.new("", "View menu", true, "ViewMenu", ViewMenu.SHOW_GRID),
|
|
|
|
|
"show_pixel_grid":
|
|
|
|
|
Keychain.MenuInputAction.new("", "View menu", true, "ViewMenu", ViewMenu.SHOW_PIXEL_GRID),
|
|
|
|
|
"show_guides":
|
|
|
|
|
Keychain.MenuInputAction.new("", "View menu", true, "ViewMenu", ViewMenu.SHOW_GUIDES),
|
|
|
|
|
"show_rulers":
|
|
|
|
|
Keychain.MenuInputAction.new("", "View menu", true, "ViewMenu", ViewMenu.SHOW_RULERS),
|
|
|
|
|
"moveable_panels":
|
|
|
|
|
Keychain.MenuInputAction.new(
|
|
|
|
|
"", "Window menu", true, "WindowMenu", WindowMenu.MOVABLE_PANELS
|
|
|
|
|
),
|
|
|
|
|
"zen_mode":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Window menu", true, "WindowMenu", WindowMenu.ZEN_MODE),
|
|
|
|
|
"toggle_fullscreen":
|
|
|
|
|
Keychain.MenuInputAction.new(
|
|
|
|
|
"", "Window menu", true, "WindowMenu", WindowMenu.FULLSCREEN_MODE
|
|
|
|
|
),
|
|
|
|
|
"clear_selection":
|
|
|
|
|
Keychain.MenuInputAction.new(
|
|
|
|
|
"", "Select menu", true, "SelectMenu", SelectMenu.CLEAR_SELECTION
|
|
|
|
|
),
|
|
|
|
|
"select_all":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Select menu", true, "SelectMenu", SelectMenu.SELECT_ALL),
|
|
|
|
|
"invert_selection":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Select menu", true, "SelectMenu", SelectMenu.INVERT),
|
2022-05-20 21:50:39 +00:00
|
|
|
|
"view_splash_screen":
|
|
|
|
|
Keychain.MenuInputAction.new(
|
|
|
|
|
"", "Help menu", true, "HelpMenu", HelpMenu.VIEW_SPLASH_SCREEN
|
|
|
|
|
),
|
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
|
|
|
|
"open_docs":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Help menu", true, "HelpMenu", HelpMenu.ONLINE_DOCS),
|
2022-05-20 21:50:39 +00:00
|
|
|
|
"issue_tracker":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Help menu", true, "HelpMenu", HelpMenu.ISSUE_TRACKER),
|
|
|
|
|
"open_logs_folder":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Help menu", true, "HelpMenu", HelpMenu.OPEN_LOGS_FOLDER),
|
|
|
|
|
"changelog":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Help menu", true, "HelpMenu", HelpMenu.CHANGELOG),
|
|
|
|
|
"about_pixelorama":
|
|
|
|
|
Keychain.MenuInputAction.new("", "Help menu", true, "HelpMenu", HelpMenu.ABOUT_PIXELORAMA),
|
2022-05-16 18:49:07 +00:00
|
|
|
|
"zoom_in": Keychain.InputAction.new("", "Canvas"),
|
|
|
|
|
"zoom_out": Keychain.InputAction.new("", "Canvas"),
|
|
|
|
|
"camera_left": Keychain.InputAction.new("", "Canvas"),
|
|
|
|
|
"camera_right": Keychain.InputAction.new("", "Canvas"),
|
|
|
|
|
"camera_up": Keychain.InputAction.new("", "Canvas"),
|
|
|
|
|
"camera_down": Keychain.InputAction.new("", "Canvas"),
|
|
|
|
|
"pan": Keychain.InputAction.new("", "Canvas"),
|
2022-05-16 22:25:50 +00:00
|
|
|
|
"activate_left_tool": Keychain.InputAction.new("", "Canvas"),
|
|
|
|
|
"activate_right_tool": Keychain.InputAction.new("", "Canvas"),
|
2022-05-16 18:49:07 +00:00
|
|
|
|
"move_mouse_left": Keychain.InputAction.new("", "Cursor movement"),
|
|
|
|
|
"move_mouse_right": Keychain.InputAction.new("", "Cursor movement"),
|
|
|
|
|
"move_mouse_up": Keychain.InputAction.new("", "Cursor movement"),
|
|
|
|
|
"move_mouse_down": Keychain.InputAction.new("", "Cursor movement"),
|
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
|
|
|
|
"switch_colors": Keychain.InputAction.new("", "Buttons"),
|
|
|
|
|
"go_to_first_frame": Keychain.InputAction.new("", "Buttons"),
|
|
|
|
|
"go_to_last_frame": Keychain.InputAction.new("", "Buttons"),
|
|
|
|
|
"go_to_previous_frame": Keychain.InputAction.new("", "Buttons"),
|
|
|
|
|
"go_to_next_frame": Keychain.InputAction.new("", "Buttons"),
|
|
|
|
|
"play_backwards": Keychain.InputAction.new("", "Buttons"),
|
|
|
|
|
"play_forward": Keychain.InputAction.new("", "Buttons"),
|
|
|
|
|
"change_tool_mode": Keychain.InputAction.new("", "Tool modifiers", false),
|
|
|
|
|
"draw_create_line": Keychain.InputAction.new("", "Draw tools", false),
|
|
|
|
|
"draw_snap_angle": Keychain.InputAction.new("", "Draw tools", false),
|
2022-05-20 07:59:25 +00:00
|
|
|
|
"draw_color_picker": Keychain.InputAction.new("Quick color picker", "Draw tools", 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
|
|
|
|
"shape_perfect": Keychain.InputAction.new("", "Shape tools", false),
|
|
|
|
|
"shape_center": Keychain.InputAction.new("", "Shape tools", false),
|
|
|
|
|
"shape_displace": Keychain.InputAction.new("", "Shape tools", false),
|
|
|
|
|
"selection_add": Keychain.InputAction.new("", "Selection tools", false),
|
|
|
|
|
"selection_subtract": Keychain.InputAction.new("", "Selection tools", false),
|
|
|
|
|
"selection_intersect": Keychain.InputAction.new("", "Selection tools", false),
|
2022-05-16 17:01:17 +00:00
|
|
|
|
"transformation_confirm": Keychain.InputAction.new("", "Transformation tools", false),
|
|
|
|
|
"transformation_cancel": Keychain.InputAction.new("", "Transformation tools", 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
|
|
|
|
"transform_snap_axis": Keychain.InputAction.new("", "Transformation tools", false),
|
|
|
|
|
"transform_snap_grid": Keychain.InputAction.new("", "Transformation tools", false),
|
|
|
|
|
"transform_move_selection_only":
|
|
|
|
|
Keychain.InputAction.new("", "Transformation tools", false),
|
|
|
|
|
"transform_copy_selection_content":
|
|
|
|
|
Keychain.InputAction.new("", "Transformation tools", false),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Keychain.groups = {
|
2022-05-16 18:49:07 +00:00
|
|
|
|
"Canvas": Keychain.InputGroup.new("", false),
|
|
|
|
|
"Cursor movement": Keychain.InputGroup.new("Canvas"),
|
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
|
|
|
|
"Buttons": Keychain.InputGroup.new(),
|
|
|
|
|
"Tools": Keychain.InputGroup.new(),
|
|
|
|
|
"Left": Keychain.InputGroup.new("Tools"),
|
|
|
|
|
"Right": Keychain.InputGroup.new("Tools"),
|
|
|
|
|
"Menu": Keychain.InputGroup.new(),
|
|
|
|
|
"File menu": Keychain.InputGroup.new("Menu"),
|
|
|
|
|
"Edit menu": Keychain.InputGroup.new("Menu"),
|
|
|
|
|
"View menu": Keychain.InputGroup.new("Menu"),
|
|
|
|
|
"Select menu": Keychain.InputGroup.new("Menu"),
|
|
|
|
|
"Image menu": Keychain.InputGroup.new("Menu"),
|
|
|
|
|
"Window menu": Keychain.InputGroup.new("Menu"),
|
|
|
|
|
"Help menu": Keychain.InputGroup.new("Menu"),
|
|
|
|
|
"Tool modifiers": Keychain.InputGroup.new(),
|
|
|
|
|
"Draw tools": Keychain.InputGroup.new("Tool modifiers"),
|
|
|
|
|
"Shape tools": Keychain.InputGroup.new("Tool modifiers"),
|
|
|
|
|
"Selection tools": Keychain.InputGroup.new("Tool modifiers"),
|
|
|
|
|
"Transformation tools": Keychain.InputGroup.new("Tool modifiers"),
|
|
|
|
|
}
|
|
|
|
|
Keychain.ignore_actions = ["left_mouse", "right_mouse", "middle_mouse", "shift", "ctrl"]
|
|
|
|
|
Keychain.multiple_menu_accelerators = true
|
|
|
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
func notification_label(text: String) -> void:
|
2023-01-15 15:08:42 +00:00
|
|
|
|
var notification := NotificationLabel.new()
|
2019-12-08 01:12:34 +00:00
|
|
|
|
notification.text = tr(text)
|
2022-12-16 17:44:40 +00:00
|
|
|
|
notification.rect_position = main_viewport.rect_global_position
|
|
|
|
|
notification.rect_position.y += main_viewport.rect_size.y
|
2022-03-28 23:35:32 +00:00
|
|
|
|
control.add_child(notification)
|
2019-11-13 13:45:55 +00:00
|
|
|
|
|
2020-04-19 18:17:33 +00:00
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
func general_undo(project: Project = current_project) -> void:
|
2020-07-24 00:41:10 +00:00
|
|
|
|
project.undos -= 1
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var action_name: String = project.undo_redo.get_current_action_name()
|
2020-04-19 18:17:33 +00:00
|
|
|
|
notification_label("Undo: %s" % action_name)
|
|
|
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
func general_redo(project: Project = current_project) -> void:
|
|
|
|
|
if project.undos < project.undo_redo.get_version(): # If we did undo and then redo
|
2020-07-24 00:41:10 +00:00
|
|
|
|
project.undos = project.undo_redo.get_version()
|
2020-04-19 18:17:33 +00:00
|
|
|
|
if control.redone:
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var action_name: String = project.undo_redo.get_current_action_name()
|
2020-04-19 18:17:33 +00:00
|
|
|
|
notification_label("Redo: %s" % action_name)
|
|
|
|
|
|
|
|
|
|
|
2021-12-02 00:22:32 +00:00
|
|
|
|
func undo_or_redo(
|
|
|
|
|
undo: bool, frame_index := -1, layer_index := -1, project: Project = current_project
|
|
|
|
|
) -> void:
|
|
|
|
|
if undo:
|
|
|
|
|
general_undo(project)
|
|
|
|
|
else:
|
|
|
|
|
general_redo(project)
|
2021-11-25 12:48:30 +00:00
|
|
|
|
var action_name: String = project.undo_redo.get_current_action_name()
|
|
|
|
|
if (
|
2021-12-02 00:22:32 +00:00
|
|
|
|
action_name
|
|
|
|
|
in [
|
|
|
|
|
"Draw",
|
|
|
|
|
"Draw Shape",
|
2021-12-02 11:25:20 +00:00
|
|
|
|
"Select",
|
2021-12-02 00:22:32 +00:00
|
|
|
|
"Move Selection",
|
|
|
|
|
"Scale",
|
|
|
|
|
"Centralize",
|
|
|
|
|
"Merge Layer",
|
|
|
|
|
"Link Cel",
|
|
|
|
|
"Unlink Cel"
|
|
|
|
|
]
|
2021-11-25 12:48:30 +00:00
|
|
|
|
):
|
2021-12-02 00:22:32 +00:00
|
|
|
|
if layer_index > -1 and frame_index > -1:
|
|
|
|
|
canvas.update_texture(layer_index, frame_index, project)
|
2020-06-02 23:14:24 +00:00
|
|
|
|
else:
|
2020-07-24 00:41:10 +00:00
|
|
|
|
for i in project.frames.size():
|
|
|
|
|
for j in project.layers.size():
|
|
|
|
|
canvas.update_texture(j, i, project)
|
2020-06-02 23:14:24 +00:00
|
|
|
|
|
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
|
|
|
|
canvas.selection.update()
|
2020-06-02 23:14:24 +00:00
|
|
|
|
if action_name == "Scale":
|
2022-03-20 16:52:48 +00:00
|
|
|
|
for i in project.frames.size():
|
|
|
|
|
for j in project.layers.size():
|
Basic Layer Groups and Timeline Refactor (#698)
* Fixed issues with Shading tool Saturation and Value not always being right in Hue Shading mode
* Shading tool hue shifting fixes and tweaks
* Bringing over changes from layer groups brach, without any changes to layer blending
* Some quick fixes to make it work again
* Fixed some of the places where GroupLayers cause errors. Cel Buttons are now hidden when groups are collapsed
* Layer drag highlighting (need to actually drop them correctly, also need to do cels)
* Added more layer hierarchy related functions, organized the function order in the Layer classes a bit
* Switched the layer type changing from string to int
* Moved layer type enum to Global
* Added get_layer_type_name(), currently used for the default layer name
* Renamed the layer get_children/is_a_parent_of functions
* changed get_layer_type_name() to get_default_name(number)
* New layer drag and dropping behavior
* Added read/write_image_data_from/to_pxo functions to Cel classes to handle saving/loading the binary image data for each cel type
* Fixed warning
* Added a line to child layers wich makes it easier to see where they are in the hierarchy
* Fixed debugger warning
* Fixed all cel types loading as PixelCels
* Fixed spacing issue with cels when collapsing groups
* Fixed bug when dropping a child layer to the bottom region of its parent group, where it would end up to far down (maybe disappearing)
* updated temporary todo comments
* Created a base scene for layer buttons and merged layer button script into one
* Prevent the case of parenting to itself in layer drag and drop, fixed static reference to LayerButton still being BaseLayerButton
* Use a base scene for CelButtons
* First bit of the refactoring work
* Several bits of refactoring
* Fixed moving cels
* Cleaned up Project.move_cel function
* Fixed project_layer_removed
* Updated change_frame_order on FrameButton. Some (not all) work on getting the layer UI updated when pressing buttons such as collapse/visible/lock
* Bug fixes. Updating layer button's buttons
* Fixed timeline selection issues when creating a new project. Some code cleanup
* tweaks
* Removed a bunch of commented out code
* Removing more commented out code
* Fixed bugs with timeline selectio. Fixed cels being placed in the reverse layer order when adding a frame
* Changed add/remove_frame to add/remove_frames (multiple support)
* Refactored copy_frames in animation timeline
* added copy function to cel classes
* added layer copy function
* simplifed copy_frames a tiny bit
* Updated TODO comments to categorize them and remove any that were already done
* Turned Project.add/remove_layer into Project.add/remove_layers (multiple support), not yet tested
* Seperated the layer cloning functionality in timeline's add_layer to its own function, since they're only used by one button, renamed to _on_Button_pressed naming scheme, added children support to the delete layer button
* some TODOs
* Added layer swapping
* Added priorities to refactor TODOs
* Simplified layer swapping code a little
* Fixed performance regression on changing project, updated TODOs
* Included _on_MergeDownLayer_pressed in timeline refactor
* Cleaned up _on_MergeDownLayer_pressed refactor
* If all frames are selected, prevent being able to remove all of them
* Fixed cel linking when cloning layers/frames. Moved the copy function from cel classes to layer classes, splitting into copy_cel and copy_all_cels
* Combined and rewrote the 2 project _toggle_layer_buttons_.. functions into 1 simpler _toggle_layer_buttons function
* Simplified _toggle_layer_buttons some more
* Added hierarchy support for move up/down layer buttons
* Added toggle_frame_buttons method to project (extracted from _frame_changed). Called from main when setting up startup project. Removed _ from start of _toggle_layer_buttons name
* Fixed duplicate_layers parent references being to the original layers
* cleaned up project.move_layers method a bit
* TODOs
* moved the transform_content_confirm calls for the layer buttons in AnimationTimeline (Add/remove/clone) to the project layer modification functions
* animation first/last_frame tweaks and un-press play buttons when the first/last_frame are the same in _on_AnimationTimer_timeout in AnimationTimeline
* Cleaned up project_changed in ANimationTimeline a bit
* Cleaned up project_layer_added in AnimationTimeline
* Changed Layer classes get_default_name to set_name_to_default
* Cleaned up LayerButton.drop_data slightly
* Looked at some of my TODOs
* cleaned up copying cels
* Fixed CelButton linked_indicator not showing up right away when becoming linked
* Cleand up link/unlink cel menu option a little. Fixed situatoin where trying to call button_setup on cel_button that doesn't exist anymore due to undo/redo
* Fixed regression with copy_cel (linked) in when cloning a frame
* Minor cleanup, more detailed comments, updated TODOs
* more improved comments
* Made focus_mode on Cel/Layer/FrameButton NONE to fix bug where it looks like one is selected after pressing it and adding a new Layer/Frame (but its just in the focus state, not the pressed state
* Made AnimationTimeline.change_layer_order work a little more consistantly with LayerButton.drop_data, and fixed a minor bug in it
* Updated comments and TODOs
* cleanup
* removed some code that should no longer be needed
* updated comment
* removed Project's frames and layers setters _frames_changed and _layers_changed
* Made some 'for x in range(array.size())' just 'for x in array.size()'
* updated comments/TODOs
* Cel content changes intial
* Added 'content' methods to Cel classes
* Removed image var from PixelCelButton
* Reusing PixelCelButton.gd on GroupCelButton scene
* Renamed PixelCelButton.gd to CelButton.gd (as it will be used for all Cel Buttons) and deleted GroupCelButton.gd
* Hide the TransparentChecker on GroupCelButton.tscn until a preview texture is added for GroupCels
* TODOs, prevent memory leak when closing projects
* Link/unlink cel cleanup
:
* Added _project param to _init methods of Layer classes
* Added update_texture method to Cel classes (moving part from the update_texture and update_selected_cels_textures methods from Canvas.gd
* Removed a temporary check (which also fixed another bug)
* Clone child layers when cloning a layer
* Added temp dummy get_image method to GroupCel, and use get_image when copying or picking colors
* TODOs
* Made open_image_as_spritesheet_layer work after the timeline refactor (still doesn't work with groups yet though). TODO comment updates
* Added create_new_cel methods to Layer classes
* Updated TODOs and comments
* Renamed Layer class's create_empty_cel to new_empty_cel to match Project's new_emtpy_frame
* Renamed create_layer/cel_button to instantiate_layer/cel_button
* updated TODOs
* prioritized TODOs
* Fixed some warnings
* removed commented out code from previous commit
* Fixed export
* Made open_image_as_new_frame work after timeline refactor
* Fixed open_image_as_new_layer after timeline refactor
* Some linked cel fixes
* More linked cels fixes
* cleanup
* Optimized importing spreadsheet as new layer
* Fixed Scale Image crash with Groups
* Fixed onion skin with groups
* Removed blend_mode from BaseLayer for now
* Mostly fixed image effects
* Fixed resize canvas
* Fixed drag and drop not working with Cel Buttons on Group Layers
* updated TODOs
* Renamed Replace Frame (in open image) to Replace Cel
* Continued renaming Replace Frame to Replace Cel
* Made open_image_at_cels work after timeline refactor
* Added get_layer_path method to BaseLayer
* Replaced AtLayerSpinbox with AtLayerOption for Open Image as New Frame or Replace Cel
* Updated TODOs
* updated TODOs
* Comments for cel content methods
* fixed right clicking group cel button deselecting the button (even though cel is still selected
* frame/layer modification methods comments
* Removed unneeded size flags
* TODO updates
* Removed a loop that would never run from open_image_as_spritesheet_tab
* TODO update
* Combined BaseLayer.get_children_direct and get_children_recursive into a single get_children method with a bool for recursive. Added a get_child_count method
* Removed unneeded frame paramaters from _on_DeleteFrame_pressed and _on_CopyFrame_pressed
* TODO Updates
* Removed unneeded code from delete_frames
* Made delete_frames variable names more consistent with my other changes
* Continuation
* made variable names in copy_frames more consistent with rest of changes
* Update TODOs
* Removed TODOs for after this PR (moved to my notes)
* Fixed crash when pasting image on Group
* Fixed layer .visible check to be is_visible_in_hierarchy()
* Removed some drag highlight polish code that didn't work
* Removed code from Canvas update_texture and update_selected_cels_textures that was redundant
* gdformat
* gdformat
* gdlint fixes
* Fixed Cel button not having its linked indicator show when enabling new cels linked on a layer other than the current layer
* Fixed crop image and centralize image
* Added '# gdlint: ignore=max-public-methods' to the top of Project'
* Fixed dragging cels to layer of different type crash
* Formatted CelButton.gd
Co-authored-by: MrTriPie <MrTriPie>
2022-09-28 18:59:49 +00:00
|
|
|
|
var current_cel: BaseCel = project.frames[i].cels[j]
|
2023-03-31 18:58:56 +00:00
|
|
|
|
if current_cel is Cel3D:
|
|
|
|
|
current_cel.size_changed(project.size)
|
|
|
|
|
else:
|
|
|
|
|
current_cel.image_texture.create_from_image(current_cel.get_image(), 0)
|
2020-06-02 23:14:24 +00:00
|
|
|
|
canvas.camera_zoom()
|
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
|
|
|
|
canvas.grid.update()
|
|
|
|
|
canvas.pixel_grid.update()
|
2022-08-08 00:03:17 +00:00
|
|
|
|
project.selection_map_changed()
|
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
|
|
|
|
cursor_position_label.text = "[%s×%s]" % [project.size.x, project.size.y]
|
2020-06-02 23:14:24 +00:00
|
|
|
|
|
2019-12-27 22:57:28 +00:00
|
|
|
|
canvas.update()
|
2023-04-19 17:51:08 +00:00
|
|
|
|
second_viewport.get_child(0).get_node("CanvasPreview").update()
|
|
|
|
|
canvas_preview_container.canvas_preview.update()
|
2020-07-24 00:41:10 +00:00
|
|
|
|
if !project.has_changed:
|
|
|
|
|
project.has_changed = true
|
|
|
|
|
if project == current_project:
|
|
|
|
|
self.window_title = window_title + "(*)"
|
2020-04-19 18:17:33 +00:00
|
|
|
|
|
2019-10-29 21:22:38 +00:00
|
|
|
|
|
2021-11-29 15:12:30 +00:00
|
|
|
|
func _title_changed(value: String) -> void:
|
2020-02-22 15:21:52 +00:00
|
|
|
|
window_title = value
|
|
|
|
|
OS.set_window_title(value)
|
|
|
|
|
|
2020-04-19 18:17:33 +00:00
|
|
|
|
|
2021-11-29 15:12:30 +00:00
|
|
|
|
func _project_changed(value: int) -> void:
|
2021-04-23 20:37:07 +00:00
|
|
|
|
canvas.selection.transform_content_confirm()
|
2020-06-04 18:05:36 +00:00
|
|
|
|
current_project_index = value
|
|
|
|
|
current_project = projects[value]
|
2022-03-28 23:35:32 +00:00
|
|
|
|
connect("project_changed", current_project, "change_project")
|
|
|
|
|
emit_signal("project_changed")
|
|
|
|
|
disconnect("project_changed", current_project, "change_project")
|
2023-01-02 22:52:23 +00:00
|
|
|
|
emit_signal("cel_changed")
|
2020-04-19 17:39:08 +00:00
|
|
|
|
|
2020-04-19 18:17:33 +00:00
|
|
|
|
|
2022-11-29 17:58:24 +00:00
|
|
|
|
func _renderer_changed(value: int) -> void:
|
|
|
|
|
renderer = value
|
|
|
|
|
if OS.has_feature("editor"):
|
|
|
|
|
return
|
2022-12-01 18:17:03 +00:00
|
|
|
|
|
|
|
|
|
# Sets GLES2 as the default value in `override.cfg`.
|
|
|
|
|
# Without this, switching to GLES3 does not work, because it will default to GLES2.
|
|
|
|
|
ProjectSettings.set_initial_value("rendering/quality/driver/driver_name", "GLES2")
|
2022-11-29 17:58:24 +00:00
|
|
|
|
var renderer_name := OS.get_video_driver_name(renderer)
|
|
|
|
|
ProjectSettings.set_setting("rendering/quality/driver/driver_name", renderer_name)
|
|
|
|
|
ProjectSettings.save_custom(OVERRIDE_FILE)
|
|
|
|
|
|
|
|
|
|
|
2022-11-29 19:10:49 +00:00
|
|
|
|
func _tablet_driver_changed(value: int) -> void:
|
|
|
|
|
tablet_driver = value
|
|
|
|
|
if OS.has_feature("editor"):
|
|
|
|
|
return
|
|
|
|
|
var tablet_driver_name := OS.get_tablet_driver_name(tablet_driver)
|
|
|
|
|
ProjectSettings.set_setting("display/window/tablet_driver", tablet_driver_name)
|
|
|
|
|
ProjectSettings.save_custom(OVERRIDE_FILE)
|
|
|
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
func dialog_open(open: bool) -> void:
|
2021-11-25 17:10:04 +00:00
|
|
|
|
var dim_color := Color.white
|
2020-05-08 15:37:45 +00:00
|
|
|
|
if open:
|
|
|
|
|
can_draw = false
|
2021-03-17 17:28:01 +00:00
|
|
|
|
if dim_on_popup:
|
2021-11-25 17:10:04 +00:00
|
|
|
|
dim_color = Color(0.5, 0.5, 0.5)
|
2020-05-08 15:37:45 +00:00
|
|
|
|
else:
|
|
|
|
|
can_draw = true
|
2021-11-25 17:10:04 +00:00
|
|
|
|
|
2022-08-09 00:57:14 +00:00
|
|
|
|
var tween := create_tween().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
|
|
|
|
|
tween.tween_property(control, "modulate", dim_color, 0.1)
|
2020-05-08 15:37:45 +00:00
|
|
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
func disable_button(button: BaseButton, disable: bool) -> void:
|
2020-05-03 00:13:08 +00:00
|
|
|
|
button.disabled = disable
|
|
|
|
|
if disable:
|
|
|
|
|
button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
|
|
|
|
else:
|
|
|
|
|
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
|
|
|
|
|
|
|
|
if button is Button:
|
|
|
|
|
for c in button.get_children():
|
|
|
|
|
if c is TextureRect:
|
2021-12-02 11:25:20 +00:00
|
|
|
|
c.modulate.a = 0.5 if disable else 1.0
|
2020-05-03 00:13:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
func change_button_texturerect(texture_button: TextureRect, new_file_name: String) -> void:
|
2022-02-28 18:40:13 +00:00
|
|
|
|
if !texture_button.texture:
|
|
|
|
|
return
|
2020-05-06 12:19:53 +00:00
|
|
|
|
var file_name := texture_button.texture.resource_path.get_basename().get_file()
|
|
|
|
|
var directory_path := texture_button.texture.resource_path.get_basename().replace(file_name, "")
|
|
|
|
|
texture_button.texture = load(directory_path.plus_file(new_file_name))
|
|
|
|
|
|
|
|
|
|
|
2020-04-11 21:08:45 +00:00
|
|
|
|
func update_hint_tooltips() -> 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
|
|
|
|
yield(get_tree(), "idle_frame")
|
2022-02-21 16:02:02 +00:00
|
|
|
|
Tools.update_hint_tooltips()
|
2020-04-12 16:50:14 +00:00
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
|
for tip in ui_tooltips:
|
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 hint := "None"
|
|
|
|
|
var event_type: InputEvent = tip.shortcut.shortcut
|
|
|
|
|
if event_type is InputEventKey:
|
|
|
|
|
hint = event_type.as_text()
|
|
|
|
|
elif event_type is InputEventAction:
|
|
|
|
|
var first_key: InputEventKey = Keychain.action_get_first_key(event_type.action)
|
|
|
|
|
hint = first_key.as_text() if first_key else "None"
|
|
|
|
|
tip.hint_tooltip = tr(ui_tooltips[tip]) % hint
|
2023-03-31 18:58:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Used in case some of the values in a dictionary are Strings, when they should be something else
|
|
|
|
|
func convert_dictionary_values(dict: Dictionary) -> void:
|
|
|
|
|
for key in dict:
|
|
|
|
|
if key == "id" or key == "type":
|
|
|
|
|
dict[key] = int(dict[key])
|
|
|
|
|
if typeof(dict[key]) != TYPE_STRING:
|
|
|
|
|
continue
|
|
|
|
|
if "transform" in key: # Convert a String to a Transform
|
|
|
|
|
var transform_string: String = dict[key].replace(" - ", ", ")
|
|
|
|
|
dict[key] = str2var("Transform(" + transform_string + ")")
|
|
|
|
|
elif "color" in key: # Convert a String to a Color
|
|
|
|
|
dict[key] = str2var("Color(" + dict[key] + ")")
|
|
|
|
|
elif "v2" in key: # Convert a String to a Vector2
|
|
|
|
|
dict[key] = str2var("Vector2" + dict[key])
|
|
|
|
|
elif "size" in key or "center_offset" in key: # Convert a String to a Vector3
|
|
|
|
|
dict[key] = str2var("Vector3" + dict[key])
|