Skip to content

Commit

Permalink
Layout shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
voylin committed Mar 8, 2024
1 parent e6ec104 commit 80e04a9
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function compile_gdextension() {
;;
*)
echo "Choosing platform=linuxbsd as no (valid) argument was given."
platform=linuxbsd
platform=linux
;;
esac
echo "Select build taget:"
Expand Down
58 changes: 58 additions & 0 deletions src/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,64 @@ path/configs/effects="user://effect_configs/"
path/configs/transitions="user://transition_configs/"
path/configs/render_profiles="user://render_profile_configs/"

[input]

editor_layout_1={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"echo":false,"script":null)
]
}
editor_layout_2={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"echo":false,"script":null)
]
}
editor_layout_3={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"echo":false,"script":null)
]
}
editor_layout_4={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"echo":false,"script":null)
]
}
editor_layout_5={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"echo":false,"script":null)
]
}
editor_layout_6={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":54,"key_label":0,"unicode":54,"echo":false,"script":null)
]
}
editor_layout_7={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":55,"key_label":0,"unicode":55,"echo":false,"script":null)
]
}
editor_layout_8={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":56,"key_label":0,"unicode":56,"echo":false,"script":null)
]
}
editor_layout_9={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":57,"key_label":0,"unicode":57,"echo":false,"script":null)
]
}
editor_layout_prev={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194323,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
editor_layout_next={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194324,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}

[internationalization]

locale/translations=PackedStringArray("res://translations/de.mo", "res://translations/en.mo", "res://translations/fr.mo", "res://translations/ja.mo", "res://translations/nl.mo", "res://translations/pl_PL.mo", "res://translations/pt_BR.mo", "res://translations/ru_RU.mo", "res://translations/uk_UA.mo", "res://translations/zh_TW.mo")
Expand Down
19 changes: 18 additions & 1 deletion src/ui/screen_editor/scripts/editor_ui.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class_name EditorUI extends HBoxContainer
# TODO:
# - Figure out re-ordering buttons in sidebar; (Right click shows menu for 'move up' and 'move down'?)
# - Adding new layouts to sidebar (Right menu click?);
# - Shortcuts for easily switching between different layouts (ctrl+number?);
# - Make it possible to set custom icons (Right click menu);


var instance: EditorUI
var config := ConfigFile.new()

Expand All @@ -41,6 +41,23 @@ func _ready():
add_layout("render_menu")


func _input(event) -> void:
## Shortcuts for changing the editor layout.
# TODO: Make it possible to change these shortcuts
for layout_id in range(1,10):
if event.is_action_pressed("editor_layout_%s" % layout_id):
change_layout(layout_id)
if event.is_action_pressed("editor_layout_prev"):
change_layout(clamp(%LayoutContainer.current_tab - 1, 1,9))
if event.is_action_pressed("editor_layout_prev"):
change_layout(clamp(%LayoutContainer.current_tab + 1, 1,9))


func change_layout(id: int) -> void:
if id <= (%LayoutContainer.get_child_count() - 1):
%LayoutContainer.current_tab = id


## Loading in all layouts
func load_layouts() -> void:
# First load in all custom layouts
Expand Down

0 comments on commit 80e04a9

Please sign in to comment.