Fix pasting unknown node types

This commit is contained in:
Lubos Lenco
2021-04-26 12:19:48 +02:00
parent 9e7b7aa8b3
commit 95cf441074
+27
View File
@@ -506,6 +506,33 @@ class UINodes {
nodes.nodeCanvas(ui, c);
ui.inputEnabled = true;
// Remove nodes with unknown id for this canvas type
if (Zui.isPaste) {
var nodeList = canvasType == CanvasMaterial ? NodesMaterial.list : NodesBrush.list;
var i = 0;
while (i++ < c.nodes.length) {
var canvasNode = c.nodes[i];
if (Nodes.excludeRemove.indexOf(canvasNode.type) >= 0) {
continue;
}
var found = false;
for (list in nodeList) {
for (listNode in list) {
if (canvasNode.type == listNode.type) {
found = true;
break;
}
}
if (found) break;
}
if (!found) {
nodes.removeNode(canvasNode, c);
nodes.nodesSelected.remove(canvasNode);
i--;
}
}
}
// Recompile material on change
if (ui.changed) {
recompileMat = (ui.inputDX != 0 || ui.inputDY != 0 || !uichangedLast) && Config.raw.material_live; // Instant preview