Compare commits
No commits in common. "9e115b690615293f55ce7c455099fc0b0c2c6760" and "354155db200738d5d0ed0e7d5f48451ffd78f515" have entirely different histories.
9e115b6906
...
354155db20
|
@ -65,9 +65,4 @@ public class GenericChunk : IChunk
|
||||||
{
|
{
|
||||||
writer.Write(Data);
|
writer.Write(Data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public interface IMergable
|
|
||||||
{
|
|
||||||
public abstract void Merge(IMergable other);
|
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ public record LinkId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LinkChunk : IChunk, IMergable
|
public class LinkChunk : IChunk
|
||||||
{
|
{
|
||||||
public record Link
|
public record Link
|
||||||
{
|
{
|
||||||
|
@ -68,15 +68,9 @@ public class LinkChunk : IChunk, IMergable
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Merge(IMergable other)
|
|
||||||
{
|
|
||||||
links.AddRange(((LinkChunk)other).links);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This should be generic like Property
|
public class LinkDataMetaProp : IChunk
|
||||||
public class LinkDataMetaProp : IChunk, IMergable
|
|
||||||
{
|
{
|
||||||
public record LinkData
|
public record LinkData
|
||||||
{
|
{
|
||||||
|
@ -108,9 +102,4 @@ public class LinkDataMetaProp : IChunk, IMergable
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Merge(IMergable other)
|
|
||||||
{
|
|
||||||
linkData.AddRange(((LinkDataMetaProp)other).linkData);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@ public class Property
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PropertyChunk<T> : IChunk, IMergable where T : Property, new()
|
public class PropertyChunk<T> : IChunk where T : Property, new()
|
||||||
{
|
{
|
||||||
public ChunkHeader Header { get; set; }
|
public ChunkHeader Header { get; set; }
|
||||||
public List<T> properties;
|
public List<T> properties;
|
||||||
|
@ -38,11 +38,6 @@ public class PropertyChunk<T> : IChunk, IMergable where T : Property, new()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Merge(IMergable other)
|
|
||||||
{
|
|
||||||
properties.AddRange(((PropertyChunk<T>)other).properties);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PropGeneric : Property
|
public class PropGeneric : Property
|
||||||
|
@ -116,14 +111,3 @@ public class PropString : Property
|
||||||
// value = tmpName[..Math.Min(length - 1, tmpName.Length)];
|
// value = tmpName[..Math.Min(length - 1, tmpName.Length)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PropFloat : Property
|
|
||||||
{
|
|
||||||
public float value;
|
|
||||||
|
|
||||||
public override void Read(BinaryReader reader)
|
|
||||||
{
|
|
||||||
base.Read(reader);
|
|
||||||
value = reader.ReadSingle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -109,7 +109,6 @@ public class DbFile
|
||||||
"P$OTxtRepr1" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr1" => new PropertyChunk<PropString>(),
|
||||||
"P$OTxtRepr2" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr2" => new PropertyChunk<PropString>(),
|
||||||
"P$OTxtRepr3" => new PropertyChunk<PropString>(),
|
"P$OTxtRepr3" => new PropertyChunk<PropString>(),
|
||||||
"P$RenderAlp" => new PropertyChunk<PropFloat>(),
|
|
||||||
"LD$MetaProp" => new LinkDataMetaProp(),
|
"LD$MetaProp" => new LinkDataMetaProp(),
|
||||||
_ when entryName.StartsWith("L$") => new LinkChunk(),
|
_ when entryName.StartsWith("L$") => new LinkChunk(),
|
||||||
_ when entryName.StartsWith("P$") => new PropertyChunk<PropGeneric>(),
|
_ when entryName.StartsWith("P$") => new PropertyChunk<PropGeneric>(),
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using KeepersCompound.LGS.Database.Chunks;
|
using KeepersCompound.LGS.Database.Chunks;
|
||||||
|
|
||||||
|
@ -36,69 +35,112 @@ public class ObjectHierarchy
|
||||||
{
|
{
|
||||||
_objects = new Dictionary<int, DarkObject>();
|
_objects = new Dictionary<int, DarkObject>();
|
||||||
|
|
||||||
T GetMergedChunk<T>(string name) where T : IMergable
|
if (db.Chunks.TryGetValue("P$ModelName", out var modelNamesRaw) &&
|
||||||
|
db.Chunks.TryGetValue("P$Scale", out var scalesRaw) &&
|
||||||
|
db.Chunks.TryGetValue("P$RenderTyp", out var renderTypesRaw) &&
|
||||||
|
db.Chunks.TryGetValue("P$OTxtRepr0", out var txtRepl0Raw) &&
|
||||||
|
db.Chunks.TryGetValue("P$OTxtRepr1", out var txtRepl1Raw) &&
|
||||||
|
db.Chunks.TryGetValue("P$OTxtRepr2", out var txtRepl2Raw) &&
|
||||||
|
db.Chunks.TryGetValue("P$OTxtRepr3", out var txtRepl3Raw) &&
|
||||||
|
db.Chunks.TryGetValue("L$MetaProp", out var metaPropLinksRaw) &&
|
||||||
|
db.Chunks.TryGetValue("LD$MetaProp", out var metaPropLinkDataRaw))
|
||||||
{
|
{
|
||||||
if (db.Chunks.TryGetValue(name, out var rawChunk))
|
var modelNames = (PropertyChunk<PropModelName>)modelNamesRaw;
|
||||||
|
var scales = (PropertyChunk<PropScale>)scalesRaw;
|
||||||
|
var renderTypes = (PropertyChunk<PropRenderType>)renderTypesRaw;
|
||||||
|
var txtRepl0s = (PropertyChunk<PropString>)txtRepl0Raw;
|
||||||
|
var txtRepl1s = (PropertyChunk<PropString>)txtRepl1Raw;
|
||||||
|
var txtRepl2s = (PropertyChunk<PropString>)txtRepl2Raw;
|
||||||
|
var txtRepl3s = (PropertyChunk<PropString>)txtRepl3Raw;
|
||||||
|
var metaPropLinks = (LinkChunk)metaPropLinksRaw;
|
||||||
|
var metaPropLinkData = (LinkDataMetaProp)metaPropLinkDataRaw;
|
||||||
|
|
||||||
|
// Merge gam chunks
|
||||||
|
if (gam != null &&
|
||||||
|
gam.Chunks.TryGetValue("P$ModelName", out var gamModelNames) &&
|
||||||
|
gam.Chunks.TryGetValue("P$Scale", out var gamScales) &&
|
||||||
|
gam.Chunks.TryGetValue("P$RenderTyp", out var gamRenderTypes) &&
|
||||||
|
gam.Chunks.TryGetValue("P$OTxtRepr0", out var gamTxtRepl0s) &&
|
||||||
|
gam.Chunks.TryGetValue("P$OTxtRepr1", out var gamTxtRepl1s) &&
|
||||||
|
gam.Chunks.TryGetValue("P$OTxtRepr2", out var gamTxtRepl2s) &&
|
||||||
|
gam.Chunks.TryGetValue("P$OTxtRepr3", out var gamTxtRepl3s) &&
|
||||||
|
gam.Chunks.TryGetValue("L$MetaProp", out var gamLinks) &&
|
||||||
|
gam.Chunks.TryGetValue("LD$MetaProp", out var gamLinkData))
|
||||||
{
|
{
|
||||||
var chunk = (T)rawChunk;
|
modelNames.properties.AddRange(((PropertyChunk<PropModelName>)gamModelNames).properties);
|
||||||
if (gam != null && gam.Chunks.TryGetValue(name, out var rawGamChunk))
|
scales.properties.AddRange(((PropertyChunk<PropScale>)gamScales).properties);
|
||||||
|
renderTypes.properties.AddRange(((PropertyChunk<PropRenderType>)gamRenderTypes).properties);
|
||||||
|
txtRepl0s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl0s).properties);
|
||||||
|
txtRepl1s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl1s).properties);
|
||||||
|
txtRepl2s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl2s).properties);
|
||||||
|
txtRepl3s.properties.AddRange(((PropertyChunk<PropString>)gamTxtRepl3s).properties);
|
||||||
|
metaPropLinks.links.AddRange(((LinkChunk)gamLinks).links);
|
||||||
|
metaPropLinkData.linkData.AddRange(((LinkDataMetaProp)gamLinkData).linkData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add parentages
|
||||||
|
var length = metaPropLinks.links.Count;
|
||||||
|
for (var i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
var link = metaPropLinks.links[i];
|
||||||
|
var linkData = metaPropLinkData.linkData[i];
|
||||||
|
var childId = link.source;
|
||||||
|
var parentId = link.destination;
|
||||||
|
if (!_objects.ContainsKey(childId))
|
||||||
{
|
{
|
||||||
var gamChunk = (T)rawGamChunk;
|
_objects.Add(childId, new DarkObject(childId));
|
||||||
chunk.Merge(gamChunk);
|
}
|
||||||
|
if (!_objects.ContainsKey(parentId))
|
||||||
|
{
|
||||||
|
_objects.Add(parentId, new DarkObject(parentId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linkData.priority == 0)
|
||||||
|
{
|
||||||
|
_objects[childId].parentId = parentId;
|
||||||
}
|
}
|
||||||
return chunk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ArgumentException($"No chunk with name ({name}) found", nameof(name));
|
void TryAddProp(string propName, Property prop)
|
||||||
}
|
|
||||||
|
|
||||||
// Add parentages
|
|
||||||
var metaPropLinks = GetMergedChunk<LinkChunk>("L$MetaProp");
|
|
||||||
var metaPropLinkData = GetMergedChunk<LinkDataMetaProp>("LD$MetaProp");
|
|
||||||
var length = metaPropLinks.links.Count;
|
|
||||||
for (var i = 0; i < length; i++)
|
|
||||||
{
|
|
||||||
var link = metaPropLinks.links[i];
|
|
||||||
var linkData = metaPropLinkData.linkData[i];
|
|
||||||
var childId = link.source;
|
|
||||||
var parentId = link.destination;
|
|
||||||
if (!_objects.ContainsKey(childId))
|
|
||||||
{
|
|
||||||
_objects.Add(childId, new DarkObject(childId));
|
|
||||||
}
|
|
||||||
if (!_objects.ContainsKey(parentId))
|
|
||||||
{
|
|
||||||
_objects.Add(parentId, new DarkObject(parentId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (linkData.priority == 0)
|
|
||||||
{
|
|
||||||
_objects[childId].parentId = parentId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddProp<T>(string name) where T : Property, new()
|
|
||||||
{
|
|
||||||
var chunk = GetMergedChunk<PropertyChunk<T>>(name);
|
|
||||||
foreach (var prop in chunk.properties)
|
|
||||||
{
|
{
|
||||||
var id = prop.objectId;
|
var id = prop.objectId;
|
||||||
if (!_objects.ContainsKey(id))
|
if (!_objects.ContainsKey(id))
|
||||||
{
|
{
|
||||||
_objects.Add(id, new DarkObject(id));
|
_objects.Add(id, new DarkObject(id));
|
||||||
}
|
}
|
||||||
_objects[id].properties.TryAdd(name, prop);
|
_objects[id].properties.TryAdd(propName, prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Find a way to do this better
|
||||||
|
foreach (var prop in modelNames.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$ModelName", prop);
|
||||||
|
}
|
||||||
|
foreach (var prop in scales.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$Scale", prop);
|
||||||
|
}
|
||||||
|
foreach (var prop in renderTypes.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$RenderTyp", prop);
|
||||||
|
}
|
||||||
|
foreach (var prop in txtRepl0s.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$OTxtRepr0", prop);
|
||||||
|
}
|
||||||
|
foreach (var prop in txtRepl1s.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$OTxtRepr1", prop);
|
||||||
|
}
|
||||||
|
foreach (var prop in txtRepl2s.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$OTxtRepr2", prop);
|
||||||
|
}
|
||||||
|
foreach (var prop in txtRepl3s.properties)
|
||||||
|
{
|
||||||
|
TryAddProp("P$OTxtRepr3", prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddProp<PropModelName>("P$ModelName");
|
|
||||||
AddProp<PropScale>("P$Scale");
|
|
||||||
AddProp<PropRenderType>("P$RenderTyp");
|
|
||||||
AddProp<PropString>("P$OTxtRepr0");
|
|
||||||
AddProp<PropString>("P$OTxtRepr1");
|
|
||||||
AddProp<PropString>("P$OTxtRepr2");
|
|
||||||
AddProp<PropString>("P$OTxtRepr3");
|
|
||||||
AddProp<PropFloat>("P$RenderAlp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetProperty<T>(int objectId, string propName) where T : Property
|
public T GetProperty<T>(int objectId, string propName) where T : Property
|
||||||
|
|
|
@ -62,11 +62,6 @@ public class ResourcePathManager
|
||||||
_extractionPath = extractionPath;
|
_extractionPath = extractionPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ConvertSeparator(string path)
|
|
||||||
{
|
|
||||||
return path.Replace('\\', '/');
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Init(string installPath)
|
public bool Init(string installPath)
|
||||||
{
|
{
|
||||||
// TODO: This can be done less awkwardly with the resource paths
|
// TODO: This can be done less awkwardly with the resource paths
|
||||||
|
@ -161,7 +156,6 @@ public class ResourcePathManager
|
||||||
throw new ArgumentException("No campaign found with given name", nameof(campaignName));
|
throw new ArgumentException("No campaign found with given name", nameof(campaignName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This expects resourceName to already have it's separator converted
|
|
||||||
public (string, string) GetResourcePath(
|
public (string, string) GetResourcePath(
|
||||||
ResourceType type,
|
ResourceType type,
|
||||||
string campaignName,
|
string campaignName,
|
||||||
|
@ -212,12 +206,11 @@ public class ResourcePathManager
|
||||||
{
|
{
|
||||||
foreach (var path in Directory.EnumerateFiles(dir, "*", texOptions))
|
foreach (var path in Directory.EnumerateFiles(dir, "*", texOptions))
|
||||||
{
|
{
|
||||||
var convertedPath = ConvertSeparator(path);
|
var ext = Path.GetExtension(path);
|
||||||
var ext = Path.GetExtension(convertedPath);
|
|
||||||
if (validExtensions.Contains(ext.ToLower()))
|
if (validExtensions.Contains(ext.ToLower()))
|
||||||
{
|
{
|
||||||
var key = Path.GetFileNameWithoutExtension(convertedPath).ToLower();
|
var key = Path.GetFileNameWithoutExtension(path).ToLower();
|
||||||
pathMap.TryAdd(key, convertedPath);
|
pathMap.TryAdd(key, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,12 +234,11 @@ public class ResourcePathManager
|
||||||
{
|
{
|
||||||
foreach (var path in Directory.EnumerateFiles(dir, "*", textureOptions))
|
foreach (var path in Directory.EnumerateFiles(dir, "*", textureOptions))
|
||||||
{
|
{
|
||||||
var convertedPath = ConvertSeparator(path);
|
var ext = Path.GetExtension(path);
|
||||||
var ext = Path.GetExtension(convertedPath);
|
|
||||||
if (validExtensions.Contains(ext.ToLower()))
|
if (validExtensions.Contains(ext.ToLower()))
|
||||||
{
|
{
|
||||||
var key = Path.GetRelativePath(root, convertedPath)[..^ext.Length].ToLower();
|
var key = Path.GetRelativePath(root, path)[..^ext.Length].ToLower();
|
||||||
pathMap.TryAdd(key, convertedPath);
|
pathMap.TryAdd(key, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,9 +260,8 @@ public class ResourcePathManager
|
||||||
{
|
{
|
||||||
foreach (var path in Directory.EnumerateFiles(dir, "*.bin", binOptions))
|
foreach (var path in Directory.EnumerateFiles(dir, "*.bin", binOptions))
|
||||||
{
|
{
|
||||||
var convertedPath = ConvertSeparator(path);
|
var key = Path.GetRelativePath(dir, path).ToLower();
|
||||||
var key = Path.GetRelativePath(dir, convertedPath).ToLower();
|
pathMap.TryAdd(key, path);
|
||||||
pathMap.TryAdd(key, convertedPath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,8 +277,8 @@ public class ResourcePathManager
|
||||||
{
|
{
|
||||||
if (line.StartsWith("load_path"))
|
if (line.StartsWith("load_path"))
|
||||||
{
|
{
|
||||||
// TODO: This can have multiple paths I think
|
// TODO: Do we only need to replace on systems with a different path separator?
|
||||||
var path = ConvertSeparator(line.Split(" ")[1]);
|
var path = line.Split(" ")[1].Replace("\\", "/");
|
||||||
omsPath = Path.GetFullPath(root + path);
|
omsPath = Path.GetFullPath(root + path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -303,9 +294,8 @@ public class ResourcePathManager
|
||||||
};
|
};
|
||||||
foreach (var path in Directory.GetFiles(omsPath, "*.mis", searchOptions))
|
foreach (var path in Directory.GetFiles(omsPath, "*.mis", searchOptions))
|
||||||
{
|
{
|
||||||
var convertedPath = ConvertSeparator(path);
|
var baseName = Path.GetFileName(path).ToLower();
|
||||||
var baseName = Path.GetFileName(convertedPath).ToLower();
|
map.Add(baseName, path);
|
||||||
map.Add(baseName, convertedPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -339,7 +329,7 @@ public class ResourcePathManager
|
||||||
if (line.StartsWith("fm_path"))
|
if (line.StartsWith("fm_path"))
|
||||||
{
|
{
|
||||||
// TODO: I think this can technically contain multiple paths
|
// TODO: I think this can technically contain multiple paths
|
||||||
var path = ConvertSeparator(line.Split(" ")[1]);
|
var path = line.Split(" ")[1].Replace("\\", "/");
|
||||||
fmsPath = Path.GetFullPath(root + path);
|
fmsPath = Path.GetFullPath(root + path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -354,11 +344,10 @@ public class ResourcePathManager
|
||||||
var campaignMap = new Dictionary<string, string>();
|
var campaignMap = new Dictionary<string, string>();
|
||||||
foreach (var path in Directory.GetFiles(dir))
|
foreach (var path in Directory.GetFiles(dir))
|
||||||
{
|
{
|
||||||
var convertedPath = ConvertSeparator(path);
|
if (extensions.Contains(Path.GetExtension(path).ToLower()))
|
||||||
if (extensions.Contains(Path.GetExtension(convertedPath).ToLower()))
|
|
||||||
{
|
{
|
||||||
var baseName = Path.GetFileName(convertedPath).ToLower();
|
var baseName = Path.GetFileName(path).ToLower();
|
||||||
campaignMap.Add(baseName, ConvertSeparator(path));
|
campaignMap.Add(baseName, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,6 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string OBJECT_MODELS_GROUP = "ObjectModels";
|
|
||||||
|
|
||||||
[Export(PropertyHint.GlobalFile, "*.mis")]
|
[Export(PropertyHint.GlobalFile, "*.mis")]
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
[Export]
|
[Export]
|
||||||
|
@ -96,13 +94,9 @@ public partial class Mission : Node3D
|
||||||
{
|
{
|
||||||
Build = true;
|
Build = true;
|
||||||
}
|
}
|
||||||
if (keyEvent.Keycode == Key.L)
|
|
||||||
{
|
|
||||||
ToggleLightmap();
|
|
||||||
}
|
|
||||||
if (keyEvent.Keycode == Key.O)
|
if (keyEvent.Keycode == Key.O)
|
||||||
{
|
{
|
||||||
ToggleObjectRendering();
|
ToggleLightmap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,17 +127,6 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleObjectRendering()
|
|
||||||
{
|
|
||||||
// It might be "better" to use a parent node and just toggle that, but
|
|
||||||
// the performance of this is completely fine so we'll stick with it
|
|
||||||
foreach (var node in GetTree().GetNodesInGroup(OBJECT_MODELS_GROUP))
|
|
||||||
{
|
|
||||||
var node3d = node as Node3D;
|
|
||||||
node3d.Visible = !node3d.Visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ToggleLightmap()
|
public void ToggleLightmap()
|
||||||
{
|
{
|
||||||
if (_lmLayerMask == Vector2I.Zero)
|
if (_lmLayerMask == Vector2I.Zero)
|
||||||
|
@ -253,7 +236,6 @@ public partial class Mission : Node3D
|
||||||
var txtRepl1 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr1");
|
var txtRepl1 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr1");
|
||||||
var txtRepl2 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr2");
|
var txtRepl2 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr2");
|
||||||
var txtRepl3 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr3");
|
var txtRepl3 = objHierarchy.GetProperty<PropString>(id, "P$OTxtRepr3");
|
||||||
var renderAlpha = objHierarchy.GetProperty<PropFloat>(id, "P$RenderAlp");
|
|
||||||
var renderMode = renderTypeProp == null ? PropRenderType.Mode.Normal : renderTypeProp.mode;
|
var renderMode = renderTypeProp == null ? PropRenderType.Mode.Normal : renderTypeProp.mode;
|
||||||
|
|
||||||
if (modelNameProp == null || renderMode == PropRenderType.Mode.NotRendered)
|
if (modelNameProp == null || renderMode == PropRenderType.Mode.NotRendered)
|
||||||
|
@ -296,8 +278,7 @@ public partial class Mission : Node3D
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var resType = ResourceType.ObjectTexture;
|
var resType = ResourceType.ObjectTexture;
|
||||||
var convertedValue = ResourcePathManager.ConvertSeparator(prop.value);
|
var resName = Path.GetFileNameWithoutExtension(prop.value);
|
||||||
var resName = Path.GetFileNameWithoutExtension(convertedValue);
|
|
||||||
path = pathManager.GetResourcePath(resType, _campaignName, resName).Item2;
|
path = pathManager.GetResourcePath(resType, _campaignName, resName).Item2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,13 +308,6 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderAlpha != null)
|
|
||||||
{
|
|
||||||
model.Transparency = 1.0f - renderAlpha.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
model.AddToGroup(OBJECT_MODELS_GROUP);
|
|
||||||
|
|
||||||
AddChild(model);
|
AddChild(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,7 @@ public class ModelLoader
|
||||||
{
|
{
|
||||||
if (material.Type == 0)
|
if (material.Type == 0)
|
||||||
{
|
{
|
||||||
var convertedName = ResourcePathManager.ConvertSeparator(material.Name);
|
var resName = Path.GetFileNameWithoutExtension(material.Name);
|
||||||
var resName = Path.GetFileNameWithoutExtension(convertedName);
|
|
||||||
var (_, path) = pathManager.GetResourcePath(ResourceType.ObjectTexture, campaignName, resName);
|
var (_, path) = pathManager.GetResourcePath(ResourceType.ObjectTexture, campaignName, resName);
|
||||||
if (path == null)
|
if (path == null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue