From e2aca7e04734da91f511a61250f09ae967f20503 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Mon, 7 Sep 2020 12:29:44 +0300 Subject: [PATCH] Fix some broken visual shader nodes --- scene/resources/visual_shader.cpp | 3 +-- scene/resources/visual_shader.h | 4 ++-- scene/resources/visual_shader_nodes.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 1d5e4124d28..b43a80c3d34 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -172,8 +172,6 @@ void VisualShaderNode::_bind_methods() { } VisualShaderNode::VisualShaderNode() { - port_preview = -1; - simple_decl = true; } ///////////////////////////////////////////////////////// @@ -2951,6 +2949,7 @@ String VisualShaderNodeGroupBase::generate_code(Shader::Mode p_mode, VisualShade } VisualShaderNodeGroupBase::VisualShaderNodeGroupBase() { + simple_decl = false; } ////////////// Expression diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index c51f09ba363..8f22cb0a846 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -180,7 +180,7 @@ VARIANT_ENUM_CAST(VisualShader::Type) class VisualShaderNode : public Resource { GDCLASS(VisualShaderNode, Resource); - int port_preview; + int port_preview = -1; Map default_input_values; Map connected_input_ports; @@ -188,7 +188,7 @@ class VisualShaderNode : public Resource { int connected_output_count = 0; protected: - bool simple_decl = false; + bool simple_decl = true; static void _bind_methods(); public: diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 5c632019916..182aeae5d41 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -892,6 +892,7 @@ String VisualShaderNodeSample3D::get_warning(Shader::Mode p_mode, VisualShader:: } VisualShaderNodeSample3D::VisualShaderNodeSample3D() { + simple_decl = false; } ////////////// Texture2DArray @@ -1135,6 +1136,7 @@ void VisualShaderNodeCubemap::_bind_methods() { } VisualShaderNodeCubemap::VisualShaderNodeCubemap() { + simple_decl = false; } ////////////// Float Op @@ -2236,6 +2238,7 @@ void VisualShaderNodeColorFunc::_bind_methods() { } VisualShaderNodeColorFunc::VisualShaderNodeColorFunc() { + simple_decl = false; set_input_port_default_value(0, Vector3()); } @@ -4226,6 +4229,7 @@ bool VisualShaderNodeTextureUniform::is_qualifier_supported(Qualifier p_qual) co } VisualShaderNodeTextureUniform::VisualShaderNodeTextureUniform() { + simple_decl = false; } ////////////// Texture Uniform (Triplanar) @@ -4529,6 +4533,7 @@ String VisualShaderNodeIf::generate_code(Shader::Mode p_mode, VisualShader::Type } VisualShaderNodeIf::VisualShaderNodeIf() { + simple_decl = false; set_input_port_default_value(0, 0.0); set_input_port_default_value(1, 0.0); set_input_port_default_value(2, CMP_EPSILON); @@ -4593,6 +4598,7 @@ String VisualShaderNodeSwitch::generate_code(Shader::Mode p_mode, VisualShader:: } VisualShaderNodeSwitch::VisualShaderNodeSwitch() { + simple_decl = false; set_input_port_default_value(0, false); set_input_port_default_value(1, Vector3(1.0, 1.0, 1.0)); set_input_port_default_value(2, Vector3(0.0, 0.0, 0.0));