|
1059 | 1059 | var start = LiteGraph.getTime(); |
1060 | 1060 | this.globaltime = 0.001 * (start - this.starttime); |
1061 | 1061 |
|
| 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 |
1062 | 1066 | var nodes = this._nodes_executable |
1063 | 1067 | ? this._nodes_executable |
1064 | 1068 | : this._nodes; |
|
1073 | 1077 | for (var i = 0; i < num; i++) { |
1074 | 1078 | for (var j = 0; j < limit; ++j) { |
1075 | 1079 | var node = nodes[j]; |
1076 | | - node.executePendingActions(); |
| 1080 | + if(LiteGraph.use_deferred_actions && node._waiting_actions && node._waiting_actions.length) |
| 1081 | + node.executePendingActions(); |
1077 | 1082 | if (node.mode == LiteGraph.ALWAYS && node.onExecute) { |
1078 | 1083 | //wrap node.onExecute(); |
1079 | 1084 | node.doExecute(); |
|
1089 | 1094 | if (this.onAfterExecute) { |
1090 | 1095 | this.onAfterExecute(); |
1091 | 1096 | } |
1092 | | - } else { |
| 1097 | + } else { //catch errors |
1093 | 1098 | try { |
1094 | 1099 | //iterations |
1095 | 1100 | for (var i = 0; i < num; i++) { |
1096 | 1101 | for (var j = 0; j < limit; ++j) { |
1097 | 1102 | var node = nodes[j]; |
1098 | | - node.executePendingActions(); |
| 1103 | + if(LiteGraph.use_deferred_actions && node._waiting_actions && node._waiting_actions.length) |
| 1104 | + node.executePendingActions(); |
1099 | 1105 | if (node.mode == LiteGraph.ALWAYS && node.onExecute) { |
1100 | 1106 | node.onExecute(); |
1101 | 1107 | } |
|
3366 | 3372 | var target_connection = node.inputs[link_info.target_slot]; |
3367 | 3373 |
|
3368 | 3374 | //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) |
3370 | 3376 | { |
3371 | 3377 | if(!node._waiting_actions) |
3372 | 3378 | node._waiting_actions = []; |
|
0 commit comments