From 13bb90afa21f9de56a75c31b5160201915f397b7 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Wed, 30 Oct 2024 19:01:24 +0100 Subject: [PATCH] Add shortcuts for suggested actions, list shortcuts on the settings screen Not ideal to show them on the settings screen when they are not configurable, but the about/help screen is very saturated as it is. --- globals/Controller.gd | 7 + globals/VoiceManager.gd | 7 + gui/components/help/PianoOverlay.gd | 60 ++++ gui/components/help/ShortcutLine.gd | 90 ++++++ gui/components/help/ShortcutLine.tscn | 32 ++ gui/components/preview/PianoContainer.gd | 9 +- gui/components/preview/PianoRoll.gd | 15 + gui/panels/SettingsPanel.gd | 12 +- gui/panels/SettingsPanel.tscn | 377 +++++++++++++++++++++-- gui/theme/project_theme.tres | 4 + project.godot | 94 ++++++ 11 files changed, 681 insertions(+), 26 deletions(-) create mode 100644 gui/components/help/PianoOverlay.gd create mode 100644 gui/components/help/ShortcutLine.gd create mode 100644 gui/components/help/ShortcutLine.tscn diff --git a/globals/Controller.gd b/globals/Controller.gd index d99b960..5146f01 100644 --- a/globals/Controller.gd +++ b/globals/Controller.gd @@ -32,6 +32,13 @@ func _notification(what: int) -> void: _file_dialog.queue_free() +func _shortcut_input(event: InputEvent) -> void: + if event.is_action_pressed("glasan_randomize_voice", false, true): + voice_manager.randomize_current_voice() + elif event.is_action_pressed("glasan_play_note", false, true): + voice_manager.play_sample() + + # Dialog management. func get_file_dialog() -> FileDialog: diff --git a/globals/VoiceManager.gd b/globals/VoiceManager.gd index 57e771a..8bfc235 100644 --- a/globals/VoiceManager.gd +++ b/globals/VoiceManager.gd @@ -99,6 +99,13 @@ func change_voice_type(type: int) -> void: voice_changed.emit() +func randomize_current_voice() -> void: + if not _current_voice: + return + + _current_voice.randomize_voice() + + # Sample management. func get_sample_params() -> Sample: diff --git a/gui/components/help/PianoOverlay.gd b/gui/components/help/PianoOverlay.gd new file mode 100644 index 0000000..8fb3869 --- /dev/null +++ b/gui/components/help/PianoOverlay.gd @@ -0,0 +1,60 @@ +################################################### +# Part of Glasan FX # +# Copyright (c) 2024 Yuri Sizov and contributors # +# Provided under MIT # +################################################### + +@tool +class_name PianoOverlay extends Control + +@export var piano_container: PianoContainer = null: + set = set_piano_container + +var _shortcut_buffers: Array[TextLine] = [] + + +func _ready() -> void: + _update_shortcut_buffers() + + +func _draw() -> void: + if not is_instance_valid(piano_container): + return + + for i in _shortcut_buffers.size(): + var text_buffer := _shortcut_buffers[i] + var text_color := PianoKey.LIGHT_COLOR if Note.is_note_sharp(i) else PianoKey.DARK_COLOR + + var key_rect := piano_container._valid_children[i].get_rect() + var text_position := key_rect.position + Vector2(key_rect.size.x / 2.0, key_rect.size.y) + text_position.x -= text_buffer.get_size().x / 2.0 + text_position.y -= text_buffer.get_size().y + 6.0 + + text_buffer.draw(get_canvas_item(), text_position, text_color) + + +func _update_shortcut_buffers() -> void: + _shortcut_buffers.clear() + if not is_instance_valid(piano_container): + return + + var font := get_theme_font("font") + var font_size := get_theme_font_size("font_size") + + for i in piano_container.number_of_keys: + var text_buffer := TextLine.new() + var shortcut_name := &"glasan_play_key%d" % [ i ] + var shortcut_text := ShortcutLine.get_action_as_string(shortcut_name) + + text_buffer.add_string(shortcut_text, font, font_size) + _shortcut_buffers.push_back(text_buffer) + + queue_redraw() + + +func set_piano_container(value: PianoContainer) -> void: + if piano_container == value: + return + + piano_container = value + _update_shortcut_buffers() diff --git a/gui/components/help/ShortcutLine.gd b/gui/components/help/ShortcutLine.gd new file mode 100644 index 0000000..ae6beb1 --- /dev/null +++ b/gui/components/help/ShortcutLine.gd @@ -0,0 +1,90 @@ +################################################### +# Part of Glasan FX # +# Copyright (c) 2024 Yuri Sizov and contributors # +# Provided under MIT # +################################################### + +@tool +class_name ShortcutLine extends HBoxContainer + +@export var key_text: String = "KEY": + set = set_key_text +@export var key_is_action: bool = true: + set = set_key_is_action +@export_multiline var description_text: String = "Description": + set = set_description_text + +@onready var _key_label: Label = $KeyLabel +@onready var _description_label: Label = $DescriptionLabel + + +func _ready() -> void: + _update_labels() + + +func _update_labels() -> void: + if not is_inside_tree(): + return + + if key_is_action: + _key_label.text = get_action_as_string(key_text) + else: + _key_label.text = key_text + + _description_label.text = description_text + + +func set_key_text(value: String) -> void: + key_text = value + _update_labels() + + +func set_key_is_action(value: bool) -> void: + key_is_action = value + _update_labels() + + +func set_description_text(value: String) -> void: + description_text = value + _update_labels() + + +static func get_action_as_string(action_text: String) -> String: + var bound_events := InputMap.action_get_events(action_text) + if bound_events.size() <= 0: + return "[UNBOUND]" + + var first_event := bound_events[0] + if first_event is InputEventKey: + var key_event := first_event as InputEventKey + var key_bits := PackedStringArray() + + if key_event.shift_pressed: + key_bits.push_back("SHIFT") + if key_event.ctrl_pressed: + key_bits.push_back("CTRL") + if key_event.meta_pressed: + if OS.has_feature("macos") || OS.has_feature("web_macos"): + key_bits.push_back("CMD") + elif OS.has_feature("windows") || OS.has_feature("web_windows"): + key_bits.push_back("WIN") + else: + key_bits.push_back("META") + if key_event.alt_pressed: + key_bits.push_back("ALT") + + var keycode := key_event.keycode + if keycode == KEY_NONE: + keycode = key_event.physical_keycode + + var keycode_string := OS.get_keycode_string(keycode) + if keycode in [ KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT ]: + keycode_string = "ARROW " + keycode_string + + if keycode_string.is_empty(): + keycode_string = "[UNKNOWN]" + key_bits.append(keycode_string) + + return " + ".join(key_bits) + + return first_event.as_text() diff --git a/gui/components/help/ShortcutLine.tscn b/gui/components/help/ShortcutLine.tscn new file mode 100644 index 0000000..a51f64c --- /dev/null +++ b/gui/components/help/ShortcutLine.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=2 format=3 uid="uid://cinwiem08gkak"] + +[ext_resource type="Script" path="res://gui/components/help/ShortcutLine.gd" id="1_06v85"] + +[node name="ShortcutLine" type="HBoxContainer"] +auto_translate_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 28.0 +grow_horizontal = 2 +script = ExtResource("1_06v85") + +[node name="KeyLabel" type="Label" parent="."] +auto_translate_mode = 1 +layout_mode = 2 +size_flags_horizontal = 0 +theme_type_variation = &"ShortcutLabelAccented" +text = "[UNBOUND]" +uppercase = true + +[node name="Filler" type="Control" parent="."] +auto_translate_mode = 1 +custom_minimum_size = Vector2(12, 0) +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="DescriptionLabel" type="Label" parent="."] +auto_translate_mode = 1 +layout_mode = 2 +size_flags_horizontal = 0 +theme_type_variation = &"ShortcutLabel" +text = "Description" diff --git a/gui/components/preview/PianoContainer.gd b/gui/components/preview/PianoContainer.gd index cb80dea..f86dac9 100644 --- a/gui/components/preview/PianoContainer.gd +++ b/gui/components/preview/PianoContainer.gd @@ -18,7 +18,7 @@ const KEY_SCENE := preload("res://gui/components/preview/PianoKey.tscn") @export var reset_keys: bool: set = set_reset_keys -var _valid_children: int = 0 +var _valid_children: Array[Control] = [] var _light_children: Array[Control] = [] var _dark_children: Array[Control] = [] @@ -86,6 +86,7 @@ func _get_minimum_size() -> Vector2: var min_size := Vector2.ZERO var child_index := 0 + _valid_children.clear() _light_children.clear() _dark_children.clear() @@ -107,9 +108,9 @@ func _get_minimum_size() -> Vector2: else: _dark_children.push_back(child_control) + _valid_children.push_back(child_control) child_index += 1 - _valid_children = child_index return min_size @@ -141,7 +142,7 @@ func _sort_children() -> void: child_rect.position.x -= child_rect.size.x / 2.0 # Give the last child the remainder. - if child_index == (_valid_children - 1): + if child_index == (_valid_children.size() - 1): child_rect.size.x = size.x - child_offset.x fit_child_in_rect(key, child_rect) @@ -157,6 +158,8 @@ func _sort_children() -> void: child_index += 1 +# Key management. + func set_number_of_keys(value: int) -> void: if number_of_keys == value: return diff --git a/gui/components/preview/PianoRoll.gd b/gui/components/preview/PianoRoll.gd index 621635c..6b7b7d8 100644 --- a/gui/components/preview/PianoRoll.gd +++ b/gui/components/preview/PianoRoll.gd @@ -28,6 +28,21 @@ func _ready() -> void: _octave_down_button.pressed.connect(_shift_octave.bind(-1)) +func _shortcut_input(event: InputEvent) -> void: + if event.is_action_pressed("glasan_octave_up", false, true): + _shift_octave(1) + elif event.is_action_pressed("glasan_octave_down", false, true): + _shift_octave(-1) + + for i in Note.MAX: + var action_name := &"glasan_play_key%d" % [ i ] + if event.is_action_pressed(action_name, false, true): + _change_note(i) + break + + +# Property management. + func set_note_value(value: int) -> void: if note_value == value: return diff --git a/gui/panels/SettingsPanel.gd b/gui/panels/SettingsPanel.gd index 9b866d5..1f19f4f 100644 --- a/gui/panels/SettingsPanel.gd +++ b/gui/panels/SettingsPanel.gd @@ -17,15 +17,19 @@ func _ready() -> void: super() _update_settings_controls() - _scale_100_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(100)) - _scale_125_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(125)) - _scale_150_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(150)) - _scale_200_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(200)) + if not Engine.is_editor_hint(): + _scale_100_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(100)) + _scale_125_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(125)) + _scale_150_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(150)) + _scale_200_button.pressed.connect(Controller.settings_manager.set_gui_scale.bind(200)) # Settings management. func _update_settings_controls() -> void: + if Engine.is_editor_hint(): + return + var gui_scale := Controller.settings_manager.get_gui_scale() _scale_100_button.button_pressed = (gui_scale == 100) diff --git a/gui/panels/SettingsPanel.tscn b/gui/panels/SettingsPanel.tscn index 67b57bd..dec2beb 100644 --- a/gui/panels/SettingsPanel.tscn +++ b/gui/panels/SettingsPanel.tscn @@ -1,11 +1,13 @@ -[gd_scene load_steps=12 format=3 uid="uid://hqtpm3a6ykn4"] +[gd_scene load_steps=23 format=3 uid="uid://hqtpm3a6ykn4"] [ext_resource type="Script" path="res://gui/panels/SettingsPanel.gd" id="1_6126i"] [ext_resource type="Shader" path="res://gui/panels/PlasticPanel.gdshader" id="2_rxkyi"] -[ext_resource type="Script" path="res://gui/components/text_effects/AccentedContentEffect.gd" id="3_3ixdy"] [ext_resource type="PackedScene" uid="uid://gprht0fu6hyh" path="res://gui/components/GlowButton.tscn" id="3_4ikp2"] -[ext_resource type="Script" path="res://gui/components/text_effects/HighlightedContentEffect.gd" id="4_2gy8u"] -[ext_resource type="Script" path="res://gui/components/text_effects/MetaContentEffect.gd" id="5_ceu84"] +[ext_resource type="PackedScene" uid="uid://cinwiem08gkak" path="res://gui/components/help/ShortcutLine.tscn" id="4_rwkof"] +[ext_resource type="Script" path="res://gui/components/preview/PianoContainer.gd" id="5_hapji"] +[ext_resource type="PackedScene" uid="uid://dt8h6osxvf3im" path="res://gui/components/preview/PianoKey.tscn" id="6_0rehk"] +[ext_resource type="Shader" path="res://gui/components/preview/PianoKey.gdshader" id="7_22kyv"] +[ext_resource type="Script" path="res://gui/components/help/PianoOverlay.gd" id="9_a1pdq"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_3jmxr"] resource_local_to_scene = true @@ -31,14 +33,245 @@ resource_local_to_scene = false resource_name = "ScaleButtons" allow_unpress = true -[sub_resource type="RichTextEffect" id="RichTextEffect_rlffm"] -script = ExtResource("3_3ixdy") +[sub_resource type="ShaderMaterial" id="ShaderMaterial_x32la"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = false +shader_parameter/inset_right = true +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.0 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_mbd8o"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = false +shader_parameter/inset_right = false +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.05 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_dmbso"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = true +shader_parameter/inset_right = true +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.0 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_7l4bw"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = false +shader_parameter/inset_right = false +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.05 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ykwxo"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = true +shader_parameter/inset_right = false +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.0 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_fte1o"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = false +shader_parameter/inset_right = true +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.0 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_6fnqx"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = false +shader_parameter/inset_right = false +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.05 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_bjhkh"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = true +shader_parameter/inset_right = true +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.0 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_w7pls"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = false +shader_parameter/inset_right = false +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.05 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_vy4uj"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = true +shader_parameter/inset_right = true +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.0 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) -[sub_resource type="RichTextEffect" id="RichTextEffect_w4c3v"] -script = ExtResource("4_2gy8u") +[sub_resource type="ShaderMaterial" id="ShaderMaterial_tarp2"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = false +shader_parameter/inset_right = false +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.05 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) -[sub_resource type="RichTextEffect" id="RichTextEffect_gx3ca"] -script = ExtResource("5_ceu84") +[sub_resource type="ShaderMaterial" id="ShaderMaterial_0xr05"] +resource_local_to_scene = true +shader = ExtResource("7_22kyv") +shader_parameter/state_pressed = 0.0 +shader_parameter/state_selected = false +shader_parameter/inset_left = true +shader_parameter/inset_right = false +shader_parameter/shadow_position = 0.212 +shader_parameter/shadow_size = 0.08 +shader_parameter/shadow_compensation = 0.0 +shader_parameter/inset_height = 0.382 +shader_parameter/inset_smoothness = 0.024 +shader_parameter/inset_shadow_position = 0.019 +shader_parameter/inset_shadow_size = 0.022 +shader_parameter/selection_x_factor = 2.6 +shader_parameter/selection_offset = 0.8 +shader_parameter/selection_size = 0.066 +shader_parameter/selection_smoothness = 0.006 +shader_parameter/selection_color = Color(0.710837, 0.283876, 0.25255, 1) [node name="SettingsPanel" type="PanelContainer"] anchors_preset = 15 @@ -64,7 +297,6 @@ theme_type_variation = &"AboutLayoutContainer" [node name="SettingsSection" type="VBoxContainer" parent="Content/Layout"] layout_mode = 2 -size_flags_vertical = 3 [node name="SettingsTitle" type="Label" parent="Content/Layout/SettingsSection"] layout_mode = 2 @@ -132,15 +364,122 @@ layout_mode = 2 [node name="ShortcutsSection" type="VBoxContainer" parent="Content/Layout"] layout_mode = 2 -size_flags_vertical = 3 -[node name="ShortcutsTitle" type="Label" parent="Content/Layout/ShortcutsSection"] +[node name="GeneralTitle" type="Label" parent="Content/Layout/ShortcutsSection"] +layout_mode = 2 +text = "GENERAL HOTKEYS" + +[node name="GeneralShortcut1" parent="Content/Layout/ShortcutsSection" instance=ExtResource("4_rwkof")] +layout_mode = 2 +key_text = "glasan_play_note" +description_text = "Play the sound effect with current parameters" + +[node name="GeneralShortcut2" parent="Content/Layout/ShortcutsSection" instance=ExtResource("4_rwkof")] +layout_mode = 2 +key_text = "glasan_randomize_voice" +description_text = "Randomize parameters of the current voice" + +[node name="Spacer" type="Control" parent="Content/Layout/ShortcutsSection"] +layout_mode = 2 + +[node name="PianoRollTitle" type="Label" parent="Content/Layout/ShortcutsSection"] +layout_mode = 2 +text = "PIANO ROLL HOTKEYS" + +[node name="OctaveShortcut1" parent="Content/Layout/ShortcutsSection" instance=ExtResource("4_rwkof")] +layout_mode = 2 +key_text = "glasan_octave_up" +description_text = "Change the piano roll octave to be higher" + +[node name="OctaveShortcut2" parent="Content/Layout/ShortcutsSection" instance=ExtResource("4_rwkof")] +layout_mode = 2 +key_text = "glasan_octave_down" +description_text = "Change the piano roll octave to be lower" + +[node name="Label" type="Label" parent="Content/Layout/ShortcutsSection"] +layout_mode = 2 +theme_type_variation = &"ShortcutLabel" +text = "Change the current note and play it:" + +[node name="MarginContainer" type="MarginContainer" parent="Content/Layout/ShortcutsSection"] +layout_mode = 2 +size_flags_horizontal = 4 + +[node name="PianoContainer" type="Container" parent="Content/Layout/ShortcutsSection/MarginContainer"] +custom_minimum_size = Vector2(0, 90) +layout_mode = 2 +size_flags_horizontal = 4 +script = ExtResource("5_hapji") + +[node name="Key0" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +material = SubResource("ShaderMaterial_x32la") +layout_mode = 2 +inset_right = true + +[node name="Key1" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +show_behind_parent = false +material = SubResource("ShaderMaterial_mbd8o") +layout_mode = 2 +color = Color(0.35, 0.36, 0.38, 1) + +[node name="Key2" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +material = SubResource("ShaderMaterial_dmbso") +layout_mode = 2 +inset_left = true +inset_right = true + +[node name="Key3" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +show_behind_parent = false +material = SubResource("ShaderMaterial_7l4bw") +layout_mode = 2 +color = Color(0.35, 0.36, 0.38, 1) + +[node name="Key4" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +material = SubResource("ShaderMaterial_ykwxo") +layout_mode = 2 +inset_left = true + +[node name="Key5" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +material = SubResource("ShaderMaterial_fte1o") +layout_mode = 2 +inset_right = true + +[node name="Key6" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +show_behind_parent = false +material = SubResource("ShaderMaterial_6fnqx") +layout_mode = 2 +color = Color(0.35, 0.36, 0.38, 1) + +[node name="Key7" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +material = SubResource("ShaderMaterial_bjhkh") +layout_mode = 2 +inset_left = true +inset_right = true + +[node name="Key8" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +show_behind_parent = false +material = SubResource("ShaderMaterial_w7pls") +layout_mode = 2 +color = Color(0.35, 0.36, 0.38, 1) + +[node name="Key9" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +material = SubResource("ShaderMaterial_vy4uj") +layout_mode = 2 +inset_left = true +inset_right = true + +[node name="Key10" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +show_behind_parent = false +material = SubResource("ShaderMaterial_tarp2") +layout_mode = 2 +color = Color(0.35, 0.36, 0.38, 1) + +[node name="Key11" parent="Content/Layout/ShortcutsSection/MarginContainer/PianoContainer" instance=ExtResource("6_0rehk")] +material = SubResource("ShaderMaterial_0xr05") layout_mode = 2 -text = "HOTKEYS" +inset_left = true -[node name="ShortcutsContent" type="RichTextLabel" parent="Content/Layout/ShortcutsSection"] -custom_minimum_size = Vector2(640, 0) +[node name="PianoOverlay" type="Control" parent="Content/Layout/ShortcutsSection/MarginContainer" node_paths=PackedStringArray("piano_container")] layout_mode = 2 -bbcode_enabled = true -fit_content = true -custom_effects = [SubResource("RichTextEffect_rlffm"), SubResource("RichTextEffect_w4c3v"), SubResource("RichTextEffect_gx3ca")] +script = ExtResource("9_a1pdq") +piano_container = NodePath("../PianoContainer") diff --git a/gui/theme/project_theme.tres b/gui/theme/project_theme.tres index e42baf3..b0d4f63 100644 --- a/gui/theme/project_theme.tres +++ b/gui/theme/project_theme.tres @@ -498,6 +498,10 @@ RollerKnob/colors/unsafe_margin_color = Color(0.410206, 0.109915, 0.0680521, 1) RollerKnob/colors/value_color = Color(0.831535, 0.772145, 0.613004, 1) RollerKnob/font_sizes/value_size = 11 RollerKnob/styles/panel = SubResource("StyleBoxFlat_5jo2q") +ShortcutLabel/base_type = &"Label" +ShortcutLabel/colors/font_color = Color(0.703915, 0.742978, 0.757542, 1) +ShortcutLabelAccented/base_type = &"Label" +ShortcutLabelAccented/colors/font_color = Color(0.929412, 0.831373, 0.470588, 1) TabContainer/colors/font_hovered_color = Color(0.847059, 0.847059, 0.847059, 1) TabContainer/colors/font_selected_color = Color(0.95, 0.95, 0.95, 1) TabContainer/colors/font_unselected_color = Color(0.846616, 0.846616, 0.846616, 1) diff --git a/project.godot b/project.godot index e65e756..ab3b2ea 100644 --- a/project.godot +++ b/project.godot @@ -40,6 +40,100 @@ naming/script_name_casing=1 theme/custom="res://gui/theme/project_theme.tres" +[input] + +ui_accept={ +"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":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, 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":4194310,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +ui_select={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null) +] +} +glasan_randomize_voice={ +"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":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null) +] +} +glasan_play_note={ +"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) +] +} +glasan_play_key0={ +"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":90,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null) +] +} +glasan_play_key1={ +"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) +] +} +glasan_play_key2={ +"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":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null) +] +} +glasan_play_key3={ +"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) +] +} +glasan_play_key4={ +"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":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) +] +} +glasan_play_key5={ +"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":86,"key_label":0,"unicode":118,"location":0,"echo":false,"script":null) +] +} +glasan_play_key6={ +"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":71,"key_label":0,"unicode":103,"location":0,"echo":false,"script":null) +] +} +glasan_play_key7={ +"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":66,"key_label":0,"unicode":98,"location":0,"echo":false,"script":null) +] +} +glasan_play_key8={ +"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":72,"key_label":0,"unicode":104,"location":0,"echo":false,"script":null) +] +} +glasan_play_key9={ +"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":78,"key_label":0,"unicode":110,"location":0,"echo":false,"script":null) +] +} +glasan_play_key10={ +"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":74,"key_label":0,"unicode":106,"location":0,"echo":false,"script":null) +] +} +glasan_play_key11={ +"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":77,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null) +] +} +glasan_octave_up={ +"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":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null) +] +} +glasan_octave_down={ +"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) +] +} + [rendering] renderer/rendering_method="gl_compatibility"