Skip to content

Commit 0555a2f

Browse files
author
tamat
committed
fixed the event actions not executed in nodes without onExecute
1 parent 7d214c6 commit 0555a2f

5 files changed

+60
-36
lines changed

build/litegraph.core.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,10 @@
10591059
var start = LiteGraph.getTime();
10601060
this.globaltime = 0.001 * (start - this.starttime);
10611061

1062+
//not optimal: executes possible pending actions in node, problem is it is not optimized
1063+
//it is done here as if it was done in the later loop it wont be called in the node missed the onExecute
1064+
1065+
//from now on it will iterate only on executable nodes which is faster
10621066
var nodes = this._nodes_executable
10631067
? this._nodes_executable
10641068
: this._nodes;
@@ -1073,7 +1077,8 @@
10731077
for (var i = 0; i < num; i++) {
10741078
for (var j = 0; j < limit; ++j) {
10751079
var node = nodes[j];
1076-
node.executePendingActions();
1080+
if(LiteGraph.use_deferred_actions && node._waiting_actions && node._waiting_actions.length)
1081+
node.executePendingActions();
10771082
if (node.mode == LiteGraph.ALWAYS && node.onExecute) {
10781083
//wrap node.onExecute();
10791084
node.doExecute();
@@ -1089,13 +1094,14 @@
10891094
if (this.onAfterExecute) {
10901095
this.onAfterExecute();
10911096
}
1092-
} else {
1097+
} else { //catch errors
10931098
try {
10941099
//iterations
10951100
for (var i = 0; i < num; i++) {
10961101
for (var j = 0; j < limit; ++j) {
10971102
var node = nodes[j];
1098-
node.executePendingActions();
1103+
if(LiteGraph.use_deferred_actions && node._waiting_actions && node._waiting_actions.length)
1104+
node.executePendingActions();
10991105
if (node.mode == LiteGraph.ALWAYS && node.onExecute) {
11001106
node.onExecute();
11011107
}
@@ -3366,7 +3372,7 @@
33663372
var target_connection = node.inputs[link_info.target_slot];
33673373

33683374
//instead of executing them now, it will be executed in the next graph loop, to ensure data flow
3369-
if(LiteGraph.use_deferred_actions)
3375+
if(LiteGraph.use_deferred_actions && node.onExecute)
33703376
{
33713377
if(!node._waiting_actions)
33723378
node._waiting_actions = [];

0 commit comments

Comments
 (0)