Add asset browser to main scene with hotkey

This commit is contained in:
Jarrod Doyle 2024-09-17 17:43:37 +01:00
parent 1edceee044
commit 931e01337f
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
3 changed files with 40 additions and 6 deletions

View File

@ -0,0 +1,28 @@
using Godot;
namespace KeepersCompound.TMV.UI;
public partial class AssetBrowser : Control
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public override void _ShortcutInput(InputEvent input)
{
if (input is InputEventKey keyEvent && keyEvent.Pressed)
{
if (keyEvent.Keycode == Key.Space)
{
Visible = !Visible;
GetViewport().SetInputAsHandled();
}
}
}
}

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://byknmqac1a5vn"] [gd_scene load_steps=9 format=3 uid="uid://byknmqac1a5vn"]
[ext_resource type="Texture2D" uid="uid://b208ufsau5jhb" path="res://project/jorge.png" id="1_1vlw2"] [ext_resource type="Texture2D" uid="uid://b208ufsau5jhb" path="res://project/jorge.png" id="1_1vlw2"]
[ext_resource type="Script" path="res://project/code/TMV/UI/AssetBrowser.cs" id="1_5rr8c"]
[ext_resource type="Script" path="res://project/code/TMV/UI/TextureBrowser.cs" id="1_72xft"] [ext_resource type="Script" path="res://project/code/TMV/UI/TextureBrowser.cs" id="1_72xft"]
[ext_resource type="Texture2D" uid="uid://beb4tj06ivjae" path="res://project/assets/icons/Search.svg" id="1_ityvd"] [ext_resource type="Texture2D" uid="uid://beb4tj06ivjae" path="res://project/assets/icons/Search.svg" id="1_ityvd"]
[ext_resource type="Texture2D" uid="uid://dx8paqeom7dtb" path="res://project/assets/icons/Sort.svg" id="3_0k1fm"] [ext_resource type="Texture2D" uid="uid://dx8paqeom7dtb" path="res://project/assets/icons/Sort.svg" id="3_0k1fm"]
@ -9,6 +10,7 @@
[ext_resource type="Texture2D" uid="uid://bfswg75r148mr" path="res://project/assets/icons/ActionCopy.svg" id="7_2pq2g"] [ext_resource type="Texture2D" uid="uid://bfswg75r148mr" path="res://project/assets/icons/ActionCopy.svg" id="7_2pq2g"]
[node name="AssetBrowser" type="Control"] [node name="AssetBrowser" type="Control"]
visible = false
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -17,12 +19,12 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
script = ExtResource("1_5rr8c")
[node name="TabContainer" type="TabContainer" parent="."] [node name="TabContainer" type="TabContainer" parent="."]
layout_mode = 1 layout_mode = 2
anchors_preset = 15 offset_right = 1152.0
anchor_right = 1.0 offset_bottom = 648.0
anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
current_tab = 0 current_tab = 0

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=6 format=3 uid="uid://boxi211q3kx6c"] [gd_scene load_steps=7 format=3 uid="uid://boxi211q3kx6c"]
[ext_resource type="Script" path="res://project/code/TMV/Mission.cs" id="1_3gnqe"] [ext_resource type="Script" path="res://project/code/TMV/Mission.cs" id="1_3gnqe"]
[ext_resource type="Script" path="res://project/code/camera.gd" id="2_w5otl"] [ext_resource type="Script" path="res://project/code/camera.gd" id="2_w5otl"]
[ext_resource type="PackedScene" uid="uid://bfxdpxkcgwlkx" path="res://project/scenes/ui/resource_selector.tscn" id="3_kdn7u"] [ext_resource type="PackedScene" uid="uid://bfxdpxkcgwlkx" path="res://project/scenes/ui/resource_selector.tscn" id="3_kdn7u"]
[ext_resource type="PackedScene" uid="uid://byknmqac1a5vn" path="res://project/scenes/asset_browser/asset_browser.tscn" id="3_noiti"]
[ext_resource type="PackedScene" uid="uid://0h2w7w84vbea" path="res://project/scenes/ui/lightmap_layer_toggler.tscn" id="4_naip8"] [ext_resource type="PackedScene" uid="uid://0h2w7w84vbea" path="res://project/scenes/ui/lightmap_layer_toggler.tscn" id="4_naip8"]
[sub_resource type="Environment" id="Environment_cckyk"] [sub_resource type="Environment" id="Environment_cckyk"]
@ -26,6 +27,9 @@ unique_name_in_owner = true
[node name="LightmapToggler" parent="UI" instance=ExtResource("4_naip8")] [node name="LightmapToggler" parent="UI" instance=ExtResource("4_naip8")]
unique_name_in_owner = true unique_name_in_owner = true
visible = false
[node name="AssetBrowser" parent="UI" instance=ExtResource("3_noiti")]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_cckyk") environment = SubResource("Environment_cckyk")