From 8f25d153a3b096f73916a81a276a7106cf0c0a08 Mon Sep 17 00:00:00 2001 From: kidow Date: Mon, 9 Dec 2024 20:06:50 +0800 Subject: [PATCH 1/2] Avoid running unnecessary call chains --- ControlFlowUtils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ControlFlowUtils.py b/ControlFlowUtils.py index 5d000c9..f65536a 100644 --- a/ControlFlowUtils.py +++ b/ControlFlowUtils.py @@ -848,7 +848,14 @@ HOVER OVER THE INPUTS AND OUTPUTS FOR MORE INFO. if "A" in condition: lazy+=["A"] if "B" in condition: lazy+=["B"] - if require_inputs: + skipped_computation = False + if condition == "CUSTOM": + if "a" in custom_expression.casefold() and A is None: + skipped_computation = True + if "b" in custom_expression.casefold() and B is None: + skipped_computation = True + + if require_inputs and not skipped_computation: ret = s.compare(A,B,condition,NOT,custom_expression) From b58a2629c76938f29cb158c4acba4001ad040404 Mon Sep 17 00:00:00 2001 From: kidow Date: Mon, 9 Dec 2024 20:25:04 +0800 Subject: [PATCH 2/2] Avoid running unnecessary call chains --- ControlFlowUtils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ControlFlowUtils.py b/ControlFlowUtils.py index f65536a..bf6263b 100644 --- a/ControlFlowUtils.py +++ b/ControlFlowUtils.py @@ -761,6 +761,8 @@ If Require_Inputs is enabled, then you must specify the TRUE_IN and FALSE_IN inp If Condition is set to CUSTOM, you may further specify a custom expression which will be evaluated. Within this expression you may use the variables A and B to refer to those respective inputs as well as any named global variables from [Memory Storage] nodes. Most valid Python expressions, types and built-in functions are supported in the custom expression. For a full list of supported operations please consult the file 'Helper.py' included in this node pack. HOVER OVER THE INPUTS AND OUTPUTS FOR MORE INFO. + +When the condition is set to 'CUSTOM', the parameters Input A and Input B used in the custom_expression must not be None. """ def compare(self,A,B,condition,NOT,custom_expression=""):