make removable slots only the ones created from editor

This commit is contained in:
tamat
2021-09-16 11:25:32 +02:00
parent c2f7e389b9
commit 9ad6301101
9 changed files with 1394 additions and 1311 deletions

View File

@@ -1,3 +1,4 @@
(function(global) {
// *************************************************************
// LiteGraph CLASS *******
@@ -9148,6 +9149,7 @@ LGraphNode.prototype.executeAction = function(action)
var font_size =
group.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE;
ctx.font = font_size + "px Arial";
ctx.textAlign = "left";
ctx.fillText(group.title, pos[0] + 4, pos[1] + font_size);
}
@@ -9389,9 +9391,14 @@ LGraphNode.prototype.executeAction = function(action)
continue;
}
var label = entry[0];
if (entry[2] && entry[2].label) {
if(!entry[2])
entry[2] = {};
if (entry[2].label) {
label = entry[2].label;
}
entry[2].removable = true;
var data = { content: label, value: entry };
if (entry[1] == LiteGraph.ACTION) {
data.className = "event";
@@ -9478,9 +9485,12 @@ LGraphNode.prototype.executeAction = function(action)
continue;
} //skip the ones already on
var label = entry[0];
if (entry[2] && entry[2].label) {
if(!entry[2])
entry[2] = {};
if (entry[2].label) {
label = entry[2].label;
}
entry[2].removable = true;
var data = { content: label, value: entry };
if (entry[1] == LiteGraph.EVENT) {
data.className = "event";
@@ -11120,7 +11130,7 @@ LGraphNode.prototype.executeAction = function(action)
}
var _slot = slot.input || slot.output;
menu_info.push(
_slot.locked
_slot.locked || !_slot.removable
? "Cannot remove"
: { content: "Remove Slot", slot: slot }
);
@@ -12100,3 +12110,4 @@ LGraphNode.prototype.executeAction = function(action)
if (typeof exports != "undefined") {
exports.LiteGraph = this.LiteGraph;
}