List and render DrawableArray (damaged) models for fragments in ModelForm (and VehicleForm)

This commit is contained in:
dexy 2021-04-15 17:40:23 +10:00
parent e0bd87f51c
commit 6268298207
5 changed files with 86 additions and 0 deletions

View File

@ -616,6 +616,17 @@ namespace CodeWalker.GameFiles
assign(PhysicsLODGroup.PhysicsLOD2);
assign(PhysicsLODGroup.PhysicsLOD3);
if (DrawableArray?.data_items != null)
{
foreach (var arrd in DrawableArray.data_items)
{
assigndr(arrd, null, 0);
}
}
}
public void AssignChildrenSkeletonsAndBounds()

View File

@ -991,6 +991,26 @@ namespace CodeWalker.Forms
}
}
}
var fdarr = fdrawable.OwnerFragment?.DrawableArray?.data_items;
if (fdarr != null)
{
var fdnames = fdrawable.OwnerFragment?.DrawableArrayNames?.data_items;
for (int i = 0; i < fdarr.Length; i++)
{
var arrd = fdarr[i];
if ((arrd != null) && (arrd.AllModels?.Length > 0))
{
var dname = ((fdnames != null) && (i < fdnames.Length)) ? fdnames[i]?.Value : arrd.Name;
if (string.IsNullOrEmpty(dname)) dname = "(No name)";
AddDrawableModelsTreeNodes(arrd.DrawableModels?.High, dname + " - High Detail", false);
AddDrawableModelsTreeNodes(arrd.DrawableModels?.Med, dname + " - Medium Detail", false);
AddDrawableModelsTreeNodes(arrd.DrawableModels?.Low, dname + " - Low Detail", false);
AddDrawableModelsTreeNodes(arrd.DrawableModels?.VLow, dname + " - Very Low Detail", false);
}
}
}
}
}
}

View File

@ -62,6 +62,26 @@ namespace CodeWalker.Forms
}
}
}
var fdarr = fdrawable.OwnerFragment?.DrawableArray?.data_items;
if (fdarr != null)
{
var fdnames = fdrawable.OwnerFragment?.DrawableArrayNames?.data_items;
for (int i = 0; i < fdarr.Length; i++)
{
var arrd = fdarr[i];
if ((arrd != null) && (arrd.AllModels?.Length > 0))
{
var dname = ((fdnames != null) && (i < fdnames.Length)) ? fdnames[i]?.Value : arrd.Name;
if (string.IsNullOrEmpty(dname)) dname = "(No name)";
AddDrawableModelsTreeNodes(arrd.DrawableModels?.High, dname + " - High Detail");
AddDrawableModelsTreeNodes(arrd.DrawableModels?.Med, dname + " - Medium Detail");
AddDrawableModelsTreeNodes(arrd.DrawableModels?.Low, dname + " - Low Detail");
AddDrawableModelsTreeNodes(arrd.DrawableModels?.VLow, dname + " - Very Low Detail");
}
}
}
}
}
}

View File

@ -2729,6 +2729,21 @@ namespace CodeWalker.Rendering
}
}
bool isselected = SelectionFlagsTestAll || (f.Drawable == SelectedDrawable);
if (isselected)
{
var darr = f.DrawableArray?.data_items;
if (darr != null)
{
for (int i = 0; i < darr.Length; i++)
{
RenderDrawable(darr[i], arch, ent, txdhash, null, null, animClip);
}
}
}
return true;
}

View File

@ -659,6 +659,26 @@ namespace CodeWalker
}
}
}
var fdarr = fdrawable.OwnerFragment?.DrawableArray?.data_items;
if (fdarr != null)
{
var fdnames = fdrawable.OwnerFragment?.DrawableArrayNames?.data_items;
for (int i = 0; i < fdarr.Length; i++)
{
var arrd = fdarr[i];
if ((arrd != null) && (arrd.AllModels?.Length > 0))
{
var dname = ((fdnames != null) && (i < fdnames.Length)) ? fdnames[i]?.Value : arrd.Name;
if (string.IsNullOrEmpty(dname)) dname = "(No name)";
AddDrawableModelsTreeNodes(arrd.DrawableModels?.High, dname + " - High Detail", false);
AddDrawableModelsTreeNodes(arrd.DrawableModels?.Med, dname + " - Medium Detail", false);
AddDrawableModelsTreeNodes(arrd.DrawableModels?.Low, dname + " - Low Detail", false);
AddDrawableModelsTreeNodes(arrd.DrawableModels?.VLow, dname + " - Very Low Detail", false);
}
}
}
}
}