Skip to content

Commit

Permalink
Fix the code that fetches the model from the part's config.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lisias committed Sep 28, 2021
1 parent 50e4545 commit 32ac73e
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Source-Code/VesselDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,29 @@ public void Awake()

if (cfgNode.HasValue("name"))
{
string partName = cfgNode.GetValue("name");
string url = urlConfig.parent.url.Substring(0, urlConfig.parent.url.LastIndexOf("/"));
string model = System.IO.Path.GetFileNameWithoutExtension(cfgNode.GetValue("mesh"));
if (!partModelNameLookup.ContainsKey(urlConfig.name))
if (cfgNode.HasValue("mesh"))
{
string modelName = cfgNode.GetValue("mesh");
modelName = System.IO.Path.GetFileNameWithoutExtension(modelName);
Debug.LogFormat("DOE Addint {0} {1}/{2}", partName, url, modelName);
partModelNameLookup.Add(partName, url + "/" + modelName);
}
else if (cfgNode.HasNode("MODEL"))
{
ConfigNode cn = cfgNode.GetNode("MODEL");
string modelName = cn?.GetValue("model");
Debug.LogFormat("DOE Addint {0} {1}", partName, modelName);
partModelNameLookup.Add(partName, modelName);
}
else
{
partModelNameLookup.Add(urlConfig.name, url + "/" + model);
if (DistantObjectSettings.debugMode)
{
Debug.LogError(Constants.DistantObject + " -- Could not find a model for part " + partName + ". Part will not render for VesselDraw.");
}
sawErrors = true;
}
}
else
Expand Down

0 comments on commit 32ac73e

Please sign in to comment.