Compare commits
5 Commits
15c69f3092
...
eaf440bd03
Author | SHA1 | Date |
---|---|---|
Jarrod Doyle | eaf440bd03 | |
Jarrod Doyle | 0d01de1a29 | |
Jarrod Doyle | 931e01337f | |
Jarrod Doyle | 1edceee044 | |
Jarrod Doyle | f85514a40a |
|
@ -87,7 +87,7 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
public override void _ShortcutInput(InputEvent @event)
|
||||||
{
|
{
|
||||||
if (@event is InputEventKey keyEvent && keyEvent.Pressed)
|
if (@event is InputEventKey keyEvent && keyEvent.Pressed)
|
||||||
{
|
{
|
||||||
|
@ -508,6 +508,11 @@ 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;
|
||||||
|
|
|
@ -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 ImageTexture LoadGif(string path)
|
private static Image 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 ImageTexture.CreateFromImage(image);
|
return image;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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 ImageTexture LoadPcx(string path)
|
private static Image LoadPcx(string path)
|
||||||
{
|
{
|
||||||
static Color[] LoadFamilyPalette(string famPath)
|
static Color[] LoadFamilyPalette(string famPath)
|
||||||
{
|
{
|
||||||
|
@ -119,6 +119,6 @@ public partial class TextureLoader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ImageTexture.CreateFromImage(image);
|
return image;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,13 +60,14 @@ 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 texture = ext switch
|
var image = ext switch
|
||||||
{
|
{
|
||||||
"pcx" => LoadPcx(path),
|
"pcx" => LoadPcx(path),
|
||||||
"gif" => LoadGif(path),
|
"gif" => LoadGif(path),
|
||||||
_ => ImageTexture.CreateFromImage(Image.LoadFromFile(path)),
|
_ => Image.LoadFromFile(path),
|
||||||
};
|
};
|
||||||
return texture;
|
image.GenerateMipmaps();
|
||||||
|
return ImageTexture.CreateFromImage(image);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -40,7 +40,7 @@ public partial class ResourceSelector : Control
|
||||||
_CancelButton.Pressed += () => Visible = false;
|
_CancelButton.Pressed += () => Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
public override void _UnhandledInput(InputEvent @event)
|
||||||
{
|
{
|
||||||
if (@event is InputEventKey keyEvent && keyEvent.Pressed)
|
if (@event is InputEventKey keyEvent && keyEvent.Pressed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ var _e = false
|
||||||
var _shift = false
|
var _shift = false
|
||||||
var _alt = false
|
var _alt = false
|
||||||
|
|
||||||
func _input(event):
|
func _unhandled_input(event):
|
||||||
# Receives mouse motion
|
# Receives mouse motion
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
_mouse_position = event.relative
|
_mouse_position = event.relative
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue