This commit is contained in:
tamat
2023-02-28 13:28:57 +01:00
parent 376f6434e8
commit 54c2c1c5f7
2 changed files with 34 additions and 0 deletions

View File

@@ -3192,6 +3192,15 @@
return;
}
if(slot == null)
{
console.error("slot must be a number");
return;
}
if(slot.constructor !== Number)
console.warn("slot must be a number, use node.trigger('name') if you want to use a string");
var output = this.outputs[slot];
if (!output) {
return;

View File

@@ -437,7 +437,32 @@
LiteGraph.registerNodeType("events/semaphore", SemaphoreEvent);
function OnceEvent() {
this.addInput("in", LiteGraph.ACTION );
this.addInput("reset", LiteGraph.ACTION );
this.addOutput("out", LiteGraph.EVENT );
this._once = false;
this.properties = {};
var that = this;
this.addWidget("button","reset","",function(){
that._once = false;
});
}
OnceEvent.title = "Once";
OnceEvent.desc = "Only passes an event once, then gets locked";
OnceEvent.prototype.onAction = function(action, param) {
if( action == "in" && !this._once )
{
this._once = true;
this.triggerSlot( 0, param );
}
else if( action == "reset" )
this._once = false;
};
LiteGraph.registerNodeType("events/once", OnceEvent);
function DataStore() {
this.addInput("data", 0);