Fix incorrect paths for textures relative to mission file
This commit is contained in:
parent
9d49b38bf2
commit
aaf93477d0
|
@ -371,6 +371,7 @@ public partial class Mission : Node3D
|
||||||
private void LoadTextures(TxList textureList)
|
private void LoadTextures(TxList textureList)
|
||||||
{
|
{
|
||||||
// TODO: This has hardcoded .png extension and relies on you placing extracted and converted images in godot user directory
|
// TODO: This has hardcoded .png extension and relies on you placing extracted and converted images in godot user directory
|
||||||
|
// TODO: Use PathJoin
|
||||||
var count = textureList.ItemCount;
|
var count = textureList.ItemCount;
|
||||||
for (var i = 0; i < count; i++)
|
for (var i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -388,9 +389,11 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
path += item.Name + ".png"; // Hardcoded extension!
|
path += item.Name + ".png"; // Hardcoded extension!
|
||||||
|
|
||||||
if (File.Exists(FileName + path))
|
// TODO: It's case sensitive :)
|
||||||
|
var fmFamPath = Path.GetDirectoryName(FileName).PathJoin(path);
|
||||||
|
if (File.Exists(fmFamPath))
|
||||||
{
|
{
|
||||||
path = FileName + path;
|
path = fmFamPath;
|
||||||
}
|
}
|
||||||
else if (File.Exists(ProjectSettings.GlobalizePath($"user://textures{path}")))
|
else if (File.Exists(ProjectSettings.GlobalizePath($"user://textures{path}")))
|
||||||
{
|
{
|
||||||
|
@ -398,6 +401,7 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GD.Print($"Failed to find texture: {path}");
|
||||||
path = "user://textures/jorge.png";
|
path = "user://textures/jorge.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue