Merge pull request #45831 from Chaosus/vs_fix_boolean_scalarop_parsing

[3.2] Visual Shader Parenthesis fix
This commit is contained in:
Rémi Verschelde 2021-02-08 21:28:54 +01:00 committed by GitHub
commit 72872959f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1190,7 +1190,7 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
} else if (in_type == VisualShaderNode::PORT_TYPE_BOOLEAN && out_type == VisualShaderNode::PORT_TYPE_SCALAR) {
inputs[i] = src_var + " > 0.0 ? true : false";
} else if (in_type == VisualShaderNode::PORT_TYPE_SCALAR && out_type == VisualShaderNode::PORT_TYPE_BOOLEAN) {
inputs[i] = src_var + " ? 1.0 : 0.0";
inputs[i] = "(" + src_var + " ? 1.0 : 0.0)";
} else if (in_type == VisualShaderNode::PORT_TYPE_VECTOR && out_type == VisualShaderNode::PORT_TYPE_BOOLEAN) {
inputs[i] = "vec3(" + src_var + " ? 1.0 : 0.0)";
}