if-else

xod/core/if-else

Outputs either input value depending on condition
if-else
@/if-else
Outputs either input value depending on condition
CONDboolean
Condition value
Tgeneric t1
Value to be output if condition is true
Fgeneric t1
Value to be output if condition is false
if-else
R
COND
T
F
Rgeneric t1
Outputs value of `T` if `COND` is true, and `F` otherwise

C++ implementation

#pragma XOD dirtieness disable

node {
    void evaluate(Context ctx) {
        auto cond = getValue<input_COND>(ctx);
        auto trueVal = getValue<input_T>(ctx);
        auto falseVal = getValue<input_F>(ctx);
        emitValue<output_R>(ctx, cond ? trueVal : falseVal);
    }
}