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

Change layers with Control + Up/Down arrow keys

We already have Control + Left/Right for changing frames, so it makes sense to have Up/Down for layers
This commit is contained in:
Emmanouil Papadeas 2024-04-10 16:58:04 +03:00
parent 4e8a02c1a4
commit 92e8666da2
3 changed files with 26 additions and 0 deletions

View file

@ -853,6 +853,16 @@ pixelize={
"deadzone": 0.5,
"events": []
}
go_to_previous_layer={
"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":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
go_to_next_layer={
"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":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
[input_devices]

View file

@ -796,6 +796,8 @@ func _initialize_keychain() -> void:
"go_to_last_frame": Keychain.InputAction.new("", "Buttons"),
"go_to_previous_frame": Keychain.InputAction.new("", "Buttons"),
"go_to_next_frame": Keychain.InputAction.new("", "Buttons"),
"go_to_previous_layer": Keychain.InputAction.new("", "Buttons"),
"go_to_next_layer": Keychain.InputAction.new("", "Buttons"),
"play_backwards": Keychain.InputAction.new("", "Buttons"),
"play_forward": Keychain.InputAction.new("", "Buttons"),
"onion_skinning_toggle": Keychain.InputAction.new("", "Buttons"),

View file

@ -136,6 +136,20 @@ func _notification(what: int) -> void:
func _input(event: InputEvent) -> void:
var project := Global.current_project
if event.is_action_pressed("go_to_previous_layer"):
project.selected_cels.clear()
if project.current_layer > 0:
project.change_cel(-1, project.current_layer - 1)
else:
project.change_cel(-1, project.layers.size() - 1)
elif event.is_action_pressed("go_to_next_layer"):
project.selected_cels.clear()
if project.current_layer < project.layers.size() - 1:
project.change_cel(-1, project.current_layer + 1)
else:
project.change_cel(-1, 0)
var mouse_pos := get_global_mouse_position()
var timeline_rect := Rect2(global_position, size)
if timeline_rect.has_point(mouse_pos):