Fix deleting materials causing index issues for shapes

This commit is contained in:
KillzXGaming 2019-05-20 16:59:47 -04:00
parent 1831efc3e9
commit cedaac5518
4 changed files with 11 additions and 1 deletions

Binary file not shown.

View file

@ -96,6 +96,7 @@ namespace Bfres.Structs
if (Type == BRESGroupType.Models)
{
ContextMenuStrip.Items.Add(new STToolStripSeparator());
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Show All Models", null, ShowAllModelsAction, Keys.Control | Keys.A));
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Hide All Models", null, HideAllModelsAction, Keys.Control | Keys.H));
}
}
@ -107,6 +108,7 @@ namespace Bfres.Structs
protected void BatchGenerateMipmapsAction(object sender, EventArgs e) { BatchGenerateMipmaps(); }
protected void HideAllModelsAction(object sender, EventArgs e) { HideAllModels(); }
protected void ShowAllModelsAction(object sender, EventArgs e) { ShowAllModels(); }
public void BatchGenerateMipmaps()
{
@ -117,6 +119,14 @@ namespace Bfres.Structs
}
}
public void ShowAllModels()
{
for (int i = 0; i < Nodes.Count; i++)
{
Nodes[i].Checked = true;
}
}
public void HideAllModels()
{
for (int i = 0; i < Nodes.Count; i++)

View file

@ -150,7 +150,7 @@ namespace Bfres.Structs
foreach (var shape in model.shapes)
{
//If there are indices higher than this index, shift them
if (shape.MaterialIndex > CurrentIndex)
if (shape.MaterialIndex >= CurrentIndex)
{
shape.MaterialIndex -= 1;
}