Skip to content
This repository was archived by the owner on May 18, 2023. It is now read-only.

Commit 095afba

Browse files
committed
Deleting an object prompts to delete materials if it's the only object using the material
1 parent 2aea6ea commit 095afba

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

BrawlLib/SSBB/ResourceNodes/MDL0/MDL0MaterialNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,7 @@ public void Remove(bool force)
21392139
if (Parent != null)
21402140
{
21412141
if (ShaderNode != null && ShaderNode.Materials.Length == 1)
2142-
if (force || MessageBox.Show("Do you want to remove this material's shader? (It's only used by this material)", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
2142+
if (force || MessageBox.Show("Do you want to remove this material's shader?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
21432143
ShaderNode.Remove();
21442144

21452145
ShaderNode = null;

BrawlLib/SSBB/ResourceNodes/MDL0/MDL0ObjectNode.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,6 +1526,13 @@ public override void Remove()
15261526

15271527
public void Remove(bool force)
15281528
{
1529+
int i = 0;
1530+
foreach(DrawCall dc in _drawCalls)
1531+
{
1532+
++i;
1533+
if(dc.MaterialNode._objects.Count == 1 && (force || MessageBox.Show("Do you want to remove this object's material" + (_drawCalls.Count > 1 ? (" " + i) : "") + "?", "", MessageBoxButtons.YesNo) == DialogResult.Yes))
1534+
dc.MaterialNode.Remove();
1535+
}
15291536
Remove(
15301537
_vertexNode != null && _vertexNode._objects.Count == 1 && (force || MessageBox.Show("Do you want to remove this object's vertex node?", "", MessageBoxButtons.YesNo) == DialogResult.Yes),
15311538
_normalNode != null && _normalNode._objects.Count == 1 && (force || MessageBox.Show("Do you want to remove this object's normal node?", "", MessageBoxButtons.YesNo) == DialogResult.Yes),

CanaryBuild/Canary

1.19 KB
Binary file not shown.

0 commit comments

Comments
 (0)