if comparison == 'and':
result = number_a if number_a != 0 and number_b != 0 else number_b
elif comparison == 'or':
result = number_a if number_a != 0 or number_b != 0 else number_b
I am not brushed up on python syntax so that might not be right. Here's what I'm thinking in JS:
if (comparison === 'if A and B') {
return (a !== 0 && b !== 0) ? a : b;
} else if (comparison === 'if A or B') {
return (a !== 0 || b !== 0 ) ? a : b;
} else if (comparison === 'if A nor B') {
return (a === 0 && b === 0) ? a : b;
}
Of course the result also taking respect to the new "return a boolean" result option in the Number Input Condition Switch.
Right now to achieve an AND you need two booleans inputs (instead of any value) and can multiple those two booleans together (if any are 0 then it returns 0). OR is a bit more challenging, and neither handles cases where you just want to use non-negative numbers. The AND and OR functions above would help the Number Input Condition Switch cover those cases with a single node.
Here's a specific example where it would be useful. The first Landscape Enabled A and connecting nodes are essentially NOR, and Landscape Enabled is an AND. With "if A and B" and "if A nor B" I could replace the below with just 2 nodes.
Originally posted here:
https://github.com/WASasquatch/was-node-suite-comfyui/issues/85#issuecomment-1575687865
Something like:
I am not brushed up on python syntax so that might not be right. Here's what I'm thinking in JS:
Of course the result also taking respect to the new "return a boolean" result option in the Number Input Condition Switch.
Right now to achieve an AND you need two booleans inputs (instead of any value) and can multiple those two booleans together (if any are 0 then it returns 0). OR is a bit more challenging, and neither handles cases where you just want to use non-negative numbers. The AND and OR functions above would help the Number Input Condition Switch cover those cases with a single node.
Here's a specific example where it would be useful. The first Landscape Enabled A and connecting nodes are essentially NOR, and Landscape Enabled is an AND. With "if A and B" and "if A nor B" I could replace the below with just 2 nodes.
I can make a PR for this too if you'd like!