Solved COMBO type ugly display issue

This commit is contained in:
80sVectorz
2023-12-11 12:06:12 +01:00
parent 58bf09cddb
commit 19da7ad15d
+17 -1
View File
@@ -2,7 +2,7 @@ import { app } from "../../../scripts/app.js";
import { addValueControlWidget } from "../../../scripts/widgets.js";
app.registerExtension({
name: "StaticPrimitives",
name: "StaticPrimitives.NumericPrimitives.control_after_generate",
async nodeCreated(node) {
const staticPrimitiveWidgetIndex = node.widgets?.findIndex((w) => w.name === 'Input_FLOAT' || w.name == 'Input_INT');
if (staticPrimitiveWidgetIndex > -1) {
@@ -11,4 +11,20 @@ app.registerExtension({
node.widgets.splice(staticPrimitiveWidgetIndex+1,0,node.widgets.pop());
}
}
});
app.registerExtension({
name: "StaticPrimitives.CollectionPrimitives.OutputLabels",
async beforeRegisterNodeDef(nodeType, nodeData, app){
if (nodeData.name.endsWith("StaticCollectionPrimitive")){
const originalNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
originalNodeCreated?.apply(this,arguments);
var name = this.type;
name = name.slice(0,name.length-"StaticCollectionPrimitive".length);
this.addOutput(name,"COMBO");
this.removeOutput(0);
originalNodeCreated?.apply(this,arguments);
}
}
}
});