Compare commits

..

No commits in common. "eaf440bd03a981857016f6d36a03722ab49b8dc9" and "15c69f3092304e24f02bc9793d9663e2febd89fd" have entirely different histories.

9 changed files with 16 additions and 46 deletions

View File

@ -87,7 +87,7 @@ public partial class Mission : Node3D
} }
} }
public override void _ShortcutInput(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (@event is InputEventKey keyEvent && keyEvent.Pressed) if (@event is InputEventKey keyEvent && keyEvent.Pressed)
{ {
@ -508,11 +508,6 @@ public partial class Mission : Node3D
}); });
} }
for (var i = 0; i < lmLayerCount; i++)
{
lmImages[i].GenerateMipmaps();
}
var lightmapTexture = new Texture2DArray(); var lightmapTexture = new Texture2DArray();
lightmapTexture.CreateFromImages(lmImages); lightmapTexture.CreateFromImages(lmImages);
return lightmapTexture; return lightmapTexture;

View File

@ -7,12 +7,12 @@ public partial class TextureLoader
{ {
// References: // References:
// - https://www.w3.org/Graphics/GIF/spec-gif89a.txt // - https://www.w3.org/Graphics/GIF/spec-gif89a.txt
private static Image LoadGif(string path) private static ImageTexture LoadGif(string path)
{ {
var gif = new GifDecoder(path); var gif = new GifDecoder(path);
var gifImage = gif.GetImage(0); var gifImage = gif.GetImage(0);
var bytes = gifImage.GetRgbaBytes(); var bytes = gifImage.GetRgbaBytes();
var image = Image.CreateFromData(gifImage.Width, gifImage.Height, false, Image.Format.Rgba8, bytes); var image = Image.CreateFromData(gifImage.Width, gifImage.Height, false, Image.Format.Rgba8, bytes);
return image; return ImageTexture.CreateFromImage(image);
} }
} }

View File

@ -12,7 +12,7 @@ public partial class TextureLoader
// References: // References:
// - https://www.fileformat.info/format/pcx/egff.htm // - https://www.fileformat.info/format/pcx/egff.htm
// - http://www.fysnet.net/pcxfile.htm // - http://www.fysnet.net/pcxfile.htm
private static Image LoadPcx(string path) private static ImageTexture LoadPcx(string path)
{ {
static Color[] LoadFamilyPalette(string famPath) static Color[] LoadFamilyPalette(string famPath)
{ {
@ -119,6 +119,6 @@ public partial class TextureLoader
} }
} }
return image; return ImageTexture.CreateFromImage(image);
} }
} }

View File

@ -60,14 +60,13 @@ public partial class TextureLoader
string[] validExtensions = { "png", "tga", "pcx", "gif" }; string[] validExtensions = { "png", "tga", "pcx", "gif" };
if (validExtensions.Contains(ext)) if (validExtensions.Contains(ext))
{ {
var image = ext switch var texture = ext switch
{ {
"pcx" => LoadPcx(path), "pcx" => LoadPcx(path),
"gif" => LoadGif(path), "gif" => LoadGif(path),
_ => Image.LoadFromFile(path), _ => ImageTexture.CreateFromImage(Image.LoadFromFile(path)),
}; };
image.GenerateMipmaps(); return texture;
return ImageTexture.CreateFromImage(image);
} }
return null; return null;
} }

View File

@ -1,18 +0,0 @@
using Godot;
namespace KeepersCompound.TMV.UI;
public partial class AssetBrowser : Control
{
public override void _ShortcutInput(InputEvent input)
{
if (input is InputEventKey keyEvent && keyEvent.Pressed)
{
if (keyEvent.Keycode == Key.Space)
{
Visible = !Visible;
GetViewport().SetInputAsHandled();
}
}
}
}

View File

@ -40,7 +40,7 @@ public partial class ResourceSelector : Control
_CancelButton.Pressed += () => Visible = false; _CancelButton.Pressed += () => Visible = false;
} }
public override void _UnhandledInput(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (@event is InputEventKey keyEvent && keyEvent.Pressed) if (@event is InputEventKey keyEvent && keyEvent.Pressed)
{ {

View File

@ -28,7 +28,7 @@ var _e = false
var _shift = false var _shift = false
var _alt = false var _alt = false
func _unhandled_input(event): func _input(event):
# Receives mouse motion # Receives mouse motion
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
_mouse_position = event.relative _mouse_position = event.relative

View File

@ -1,7 +1,6 @@
[gd_scene load_steps=9 format=3 uid="uid://byknmqac1a5vn"] [gd_scene load_steps=8 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"]
@ -10,7 +9,6 @@
[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
@ -19,12 +17,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 = 2 layout_mode = 1
offset_right = 1152.0 anchors_preset = 15
offset_bottom = 648.0 anchor_right = 1.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,9 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://boxi211q3kx6c"] [gd_scene load_steps=6 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"]
@ -27,9 +26,6 @@ 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")