Update nodes on texture delete
This commit is contained in:
@@ -420,4 +420,4 @@ class ImportArm {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package arm.ui;
|
||||
|
||||
import zui.Zui;
|
||||
import zui.Nodes;
|
||||
import iron.data.Data;
|
||||
import iron.system.Time;
|
||||
import iron.system.Input;
|
||||
@@ -116,12 +117,15 @@ class TabTextures {
|
||||
Project.assets.splice(i, 1);
|
||||
Project.assetNames.splice(i, 1);
|
||||
function _parse(g: kha.graphics4.Graphics) {
|
||||
arm.node.MaterialParser.parsePaintMaterial();
|
||||
arm.util.RenderUtil.makeMaterialPreview();
|
||||
UISidebar.inst.hwnd1.redraws = 2;
|
||||
iron.App.removeRender(_parse);
|
||||
arm.node.MaterialParser.parsePaintMaterial();
|
||||
arm.util.RenderUtil.makeMaterialPreview();
|
||||
UISidebar.inst.hwnd1.redraws = 2;
|
||||
iron.App.removeRender(_parse);
|
||||
}
|
||||
iron.App.notifyOnRender(_parse);
|
||||
|
||||
for (m in Project.materials) updateTexturePointers(m.canvas.nodes, i);
|
||||
for (b in Project.brushes) updateTexturePointers(b.canvas.nodes, i);
|
||||
}
|
||||
}, 4);
|
||||
}
|
||||
@@ -136,4 +140,17 @@ class TabTextures {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function updateTexturePointers(nodes: Array<TNode>, i: Int) {
|
||||
for (n in nodes) {
|
||||
if (n.type == "TEX_IMAGE") {
|
||||
if (n.buttons[0].default_value == i) {
|
||||
n.buttons[0].default_value = 9999; // Texture deleted, use pink now
|
||||
}
|
||||
else if (n.buttons[0].default_value > i) {
|
||||
n.buttons[0].default_value--; // Offset by deleted texture
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user