From 3add24b550feee4a86cb3e075af3d051db2d308e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kol=C3=A1=C5=99?= Date: Tue, 24 Jan 2023 12:09:04 +0100 Subject: [PATCH] has all connected inputs value --- src/nodes/Node.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/nodes/Node.ts b/src/nodes/Node.ts index ccf0abf..42369bc 100644 --- a/src/nodes/Node.ts +++ b/src/nodes/Node.ts @@ -43,6 +43,9 @@ export default class Node { const startTag =`graphfx-update-start:${this.uid}`; const endTag = `graphfx-update-end:${this.uid}` this.__scheduledUpdate = false; + if (!this.hasAllConnectedInputsValue()) { + return; + } performance.mark(startTag) await this._update(); performance.mark(endTag) @@ -89,6 +92,15 @@ export default class Node { return this.__out; } + hasAllConnectedInputsValue() { + for(const inputName of Object.keys(this.in.variables)) { + if (this.in[inputName].output && !this.in[inputName].value) { + return false; + } + } + return true; + } + /** * Create json serializable object */