mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-23 14:03:13 +00:00
Control + T to quickly select the used area of a cel
This commit is contained in:
parent
46958273ac
commit
42aa60a817
5 changed files with 36 additions and 3 deletions
|
@ -225,6 +225,10 @@ msgstr ""
|
||||||
msgid "Invert"
|
msgid "Invert"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. Found under the Select menu. When selected, the area of non-transparent pixels in the cel is being selected.
|
||||||
|
msgid "Select cel area"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Modify"
|
msgid "Modify"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ paste_in_place={
|
||||||
}
|
}
|
||||||
paste_from_clipboard={
|
paste_from_clipboard={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":86,"key_label":0,"unicode":86,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":true,"pressed":false,"keycode":86,"physical_keycode":0,"key_label":0,"unicode":86,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
delete={
|
delete={
|
||||||
|
@ -378,6 +378,11 @@ clear_selection={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":68,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":68,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
select_cel_area={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":84,"physical_keycode":0,"key_label":0,"unicode":116,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
left_rectangletool_tool={
|
left_rectangletool_tool={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":83,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":83,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
|
|
@ -66,7 +66,7 @@ enum ImageMenu {
|
||||||
CROP_TO_CONTENT,
|
CROP_TO_CONTENT,
|
||||||
}
|
}
|
||||||
## Enumeration of items present in the Select Menu.
|
## Enumeration of items present in the Select Menu.
|
||||||
enum SelectMenu { SELECT_ALL, CLEAR_SELECTION, INVERT, WRAP_STROKES, MODIFY }
|
enum SelectMenu { SELECT_ALL, CLEAR_SELECTION, INVERT, SELECT_CEL_AREA, WRAP_STROKES, MODIFY }
|
||||||
## Enumeration of items present in the Help Menu.
|
## Enumeration of items present in the Help Menu.
|
||||||
enum HelpMenu {
|
enum HelpMenu {
|
||||||
VIEW_SPLASH_SCREEN,
|
VIEW_SPLASH_SCREEN,
|
||||||
|
@ -829,6 +829,7 @@ func _initialize_keychain() -> void:
|
||||||
&"clear_selection": Keychain.InputAction.new("", "Select menu", true),
|
&"clear_selection": Keychain.InputAction.new("", "Select menu", true),
|
||||||
&"select_all": Keychain.InputAction.new("", "Select menu", true),
|
&"select_all": Keychain.InputAction.new("", "Select menu", true),
|
||||||
&"invert_selection": Keychain.InputAction.new("", "Select menu", true),
|
&"invert_selection": Keychain.InputAction.new("", "Select menu", true),
|
||||||
|
&"select_cel_area": Keychain.InputAction.new("", "Select menu", true),
|
||||||
&"view_splash_screen": Keychain.InputAction.new("", "Help menu", true),
|
&"view_splash_screen": Keychain.InputAction.new("", "Help menu", true),
|
||||||
&"open_docs": Keychain.InputAction.new("", "Help menu", true),
|
&"open_docs": Keychain.InputAction.new("", "Help menu", true),
|
||||||
&"issue_tracker": Keychain.InputAction.new("", "Help menu", true),
|
&"issue_tracker": Keychain.InputAction.new("", "Help menu", true),
|
||||||
|
|
|
@ -1022,6 +1022,26 @@ func clear_selection(use_undo := false) -> void:
|
||||||
commit_undo("Clear Selection", undo_data_tmp)
|
commit_undo("Clear Selection", undo_data_tmp)
|
||||||
|
|
||||||
|
|
||||||
|
func select_cel_rect() -> void:
|
||||||
|
transform_content_confirm()
|
||||||
|
var project := Global.current_project
|
||||||
|
var undo_data_tmp := get_undo_data(false)
|
||||||
|
project.selection_map.crop(project.size.x, project.size.y)
|
||||||
|
project.selection_map.clear()
|
||||||
|
var current_cel := project.get_current_cel()
|
||||||
|
var cel_image: Image
|
||||||
|
if current_cel is GroupCel:
|
||||||
|
var group_layer := project.layers[project.current_layer] as GroupLayer
|
||||||
|
cel_image = group_layer.blend_children(project.frames[project.current_frame])
|
||||||
|
else:
|
||||||
|
cel_image = current_cel.get_image()
|
||||||
|
project.selection_map.select_rect(cel_image.get_used_rect())
|
||||||
|
project.selection_map_changed()
|
||||||
|
big_bounding_rectangle = project.selection_map.get_used_rect()
|
||||||
|
project.selection_offset = Vector2.ZERO
|
||||||
|
commit_undo("Select", undo_data_tmp)
|
||||||
|
|
||||||
|
|
||||||
func _project_switched() -> void:
|
func _project_switched() -> void:
|
||||||
marching_ants_outline.offset = Global.current_project.selection_offset
|
marching_ants_outline.offset = Global.current_project.selection_offset
|
||||||
big_bounding_rectangle = Global.current_project.selection_map.get_used_rect()
|
big_bounding_rectangle = Global.current_project.selection_map.get_used_rect()
|
||||||
|
|
|
@ -6,7 +6,7 @@ const DOCS_URL := "https://www.oramainteractive.com/Pixelorama-Docs/"
|
||||||
const ISSUES_URL := "https://github.com/Orama-Interactive/Pixelorama/issues"
|
const ISSUES_URL := "https://github.com/Orama-Interactive/Pixelorama/issues"
|
||||||
const SUPPORT_URL := "https://www.patreon.com/OramaInteractive"
|
const SUPPORT_URL := "https://www.patreon.com/OramaInteractive"
|
||||||
# gdlint: ignore=max-line-length
|
# gdlint: ignore=max-line-length
|
||||||
const CHANGELOG_URL := "https://github.com/Orama-Interactive/Pixelorama/blob/master/CHANGELOG.md#v105---2024-11-18"
|
const CHANGELOG_URL := "https://github.com/Orama-Interactive/Pixelorama/blob/master/CHANGELOG.md#v11---unreleased"
|
||||||
const EXTERNAL_LINK_ICON := preload("res://assets/graphics/misc/external_link.svg")
|
const EXTERNAL_LINK_ICON := preload("res://assets/graphics/misc/external_link.svg")
|
||||||
const PIXELORAMA_ICON := preload("res://assets/graphics/icons/icon_16x16.png")
|
const PIXELORAMA_ICON := preload("res://assets/graphics/icons/icon_16x16.png")
|
||||||
const HEART_ICON := preload("res://assets/graphics/misc/heart.svg")
|
const HEART_ICON := preload("res://assets/graphics/misc/heart.svg")
|
||||||
|
@ -530,6 +530,7 @@ func _setup_select_menu() -> void:
|
||||||
"All": "select_all",
|
"All": "select_all",
|
||||||
"Clear": "clear_selection",
|
"Clear": "clear_selection",
|
||||||
"Invert": "invert_selection",
|
"Invert": "invert_selection",
|
||||||
|
"Select cel area": "select_cel_area",
|
||||||
"Wrap Strokes": "",
|
"Wrap Strokes": "",
|
||||||
"Modify": ""
|
"Modify": ""
|
||||||
}
|
}
|
||||||
|
@ -1117,6 +1118,8 @@ func select_menu_id_pressed(id: int) -> void:
|
||||||
Global.canvas.selection.clear_selection(true)
|
Global.canvas.selection.clear_selection(true)
|
||||||
Global.SelectMenu.INVERT:
|
Global.SelectMenu.INVERT:
|
||||||
Global.canvas.selection.invert()
|
Global.canvas.selection.invert()
|
||||||
|
Global.SelectMenu.SELECT_CEL_AREA:
|
||||||
|
Global.canvas.selection.select_cel_rect()
|
||||||
Global.SelectMenu.WRAP_STROKES:
|
Global.SelectMenu.WRAP_STROKES:
|
||||||
var state = select_menu.is_item_checked(id)
|
var state = select_menu.is_item_checked(id)
|
||||||
Global.canvas.selection.flag_tilemode = !state
|
Global.canvas.selection.flag_tilemode = !state
|
||||||
|
|
Loading…
Add table
Reference in a new issue