function define_filter_document_node_test() {
//document filter
//node constructor class
function MyAddNode() {
this.properties = { value: "Aa", values: "Aa;Bb;Cc" };
this._values = this.properties.values.split(";");
var that = this;
this.widget = this.addWidget("combo", "name",
this.properties.value, function (v) {
that.properties.value = v;
that.triggerSlot(1, v); },
{ property: "value", values: this._values }
);
this.addOutput("res", "string");
this.properties = { precision: 1 };
}
//name to show
MyAddNode.title = "document_filter";
var resData =01;
//function to call when the node is executed
MyAddNode.prototype.onExecute = function () {
callbackObj.getElementBy(this.properties.value).then(function (res) {
resData = res;
});
this.setOutputData(0, resData);
}
//register in the system
LiteGraph.registerNodeType("basic/filter_document_node", MyAddNode);
}
LiteGraph.js库的自定义节点项详细做法
最新推荐文章于 2024-08-09 07:20:52 发布