mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
BRLYT : Fix removing texture maps.
This commit is contained in:
parent
a22557b18c
commit
5f9493839e
3 changed files with 26 additions and 2 deletions
|
@ -2470,6 +2470,12 @@ namespace LayoutBXLYT
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual void RemoveTexture(int index)
|
||||
{
|
||||
if (index < TextureMaps.Length)
|
||||
TextureMaps = TextureMaps.RemoveAt(index);
|
||||
}
|
||||
|
||||
public virtual BxlytMaterial Clone()
|
||||
{
|
||||
return (BxlytMaterial)this.MemberwiseClone();
|
||||
|
|
|
@ -88,6 +88,24 @@ namespace LayoutBXLYT.Revolution
|
|||
return mat;
|
||||
}
|
||||
|
||||
public override void RemoveTexture(int index)
|
||||
{
|
||||
base.RemoveTexture(index);
|
||||
if (TexCoordGens.Count > index)
|
||||
TexCoordGens.RemoveAt(index);
|
||||
if (IndirectTexTransforms.Count > index)
|
||||
IndirectTexTransforms.RemoveAt(index);
|
||||
if (TextureTransforms.Length > index)
|
||||
TextureTransforms = TextureTransforms.RemoveAt(index);
|
||||
|
||||
RemoveTexCoordSources(index);
|
||||
|
||||
Console.WriteLine($"TexCoordGens {TexCoordGens.Count}");
|
||||
Console.WriteLine($"TextureMaps {TextureMaps.Length}");
|
||||
Console.WriteLine($"TextureTransforms {TextureTransforms.Length}");
|
||||
Console.WriteLine($"IndirectTexTransforms {IndirectTexTransforms.Count}");
|
||||
}
|
||||
|
||||
public override bool RemoveTexCoordSources(int index)
|
||||
{
|
||||
foreach (var texGen in TexCoordGens)
|
||||
|
|
|
@ -364,14 +364,14 @@ namespace LayoutBXLYT
|
|||
{
|
||||
if (ActiveMaterial.TextureMaps.Length > SelectedIndex && SelectedIndex >= 0)
|
||||
{
|
||||
ActiveMaterial.TextureMaps = ActiveMaterial.TextureMaps.RemoveAt(SelectedIndex);
|
||||
ActiveMaterial.RemoveTexture(SelectedIndex);
|
||||
|
||||
//Apply to all selected panes
|
||||
foreach (BasePane pane in ParentEditor.SelectedPanes)
|
||||
{
|
||||
var mat = pane.TryGetActiveMaterial();
|
||||
if (mat != null && mat != ActiveMaterial && mat.TextureMaps?.Length > SelectedIndex)
|
||||
mat.TextureMaps = mat.TextureMaps.RemoveAt(SelectedIndex);
|
||||
mat.RemoveTexture(SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue