From e5d2b6d50f3480b1f7da9cae8b3342c3936d2804 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:21:20 +0100 Subject: [PATCH] Fix some missing categories in visual shader nodes --- scene/resources/visual_shader_nodes.h | 24 +++++++++++++++++-- .../resources/visual_shader_particle_nodes.h | 8 ------- scene/resources/visual_shader_sdf_nodes.h | 10 ++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h index 05c8fbd16c2a..0bd0c631b8b1 100644 --- a/scene/resources/visual_shader_nodes.h +++ b/scene/resources/visual_shader_nodes.h @@ -514,6 +514,8 @@ class VisualShaderNodeCurveXYZTexture : public VisualShaderNodeResizableBase { virtual Vector get_editable_properties() const override; virtual bool is_use_prop_slots() const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeCurveXYZTexture(); }; @@ -657,6 +659,8 @@ class VisualShaderNodeCubemap : public VisualShaderNode { virtual Vector get_editable_properties() const override; virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeCubemap(); }; @@ -832,6 +836,8 @@ class VisualShaderNodeIntOp : public VisualShaderNode { virtual Vector get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_SCALAR; } + VisualShaderNodeIntOp(); }; @@ -880,6 +886,8 @@ class VisualShaderNodeUIntOp : public VisualShaderNode { virtual Vector get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_SCALAR; } + VisualShaderNodeUIntOp(); }; @@ -1502,6 +1510,8 @@ class VisualShaderNodeDotProduct : public VisualShaderNode { virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_VECTOR; } + VisualShaderNodeDotProduct(); }; @@ -1548,6 +1558,8 @@ class VisualShaderNodeDeterminant : public VisualShaderNode { virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_VECTOR; } + VisualShaderNodeDeterminant(); }; @@ -1591,6 +1603,14 @@ class VisualShaderNodeClamp : public VisualShaderNode { virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { + if (op_type == OP_TYPE_FLOAT || op_type == OP_TYPE_INT || op_type == OP_TYPE_UINT) { + return CATEGORY_SCALAR; + } else { + return CATEGORY_VECTOR; + } + } + VisualShaderNodeClamp(); }; @@ -1990,8 +2010,6 @@ class VisualShaderNodeVectorDecompose : public VisualShaderNodeVectorBase { virtual void set_op_type(OpType p_op_type) override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; - virtual Category get_category() const override { return CATEGORY_VECTOR; } - VisualShaderNodeVectorDecompose(); }; @@ -2734,6 +2752,8 @@ class VisualShaderNodeFresnel : public VisualShaderNode { virtual bool is_generate_input_var(int p_port) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeFresnel(); }; diff --git a/scene/resources/visual_shader_particle_nodes.h b/scene/resources/visual_shader_particle_nodes.h index 23d06d4b7c35..31ba310c3c35 100644 --- a/scene/resources/visual_shader_particle_nodes.h +++ b/scene/resources/visual_shader_particle_nodes.h @@ -75,8 +75,6 @@ class VisualShaderNodeParticleSphereEmitter : public VisualShaderNodeParticleEmi virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; - virtual Category get_category() const override { return CATEGORY_PARTICLE; } - VisualShaderNodeParticleSphereEmitter(); }; @@ -94,8 +92,6 @@ class VisualShaderNodeParticleBoxEmitter : public VisualShaderNodeParticleEmitte virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; - virtual Category get_category() const override { return CATEGORY_PARTICLE; } - VisualShaderNodeParticleBoxEmitter(); }; @@ -112,8 +108,6 @@ class VisualShaderNodeParticleRingEmitter : public VisualShaderNodeParticleEmitt virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; - virtual Category get_category() const override { return CATEGORY_PARTICLE; } - VisualShaderNodeParticleRingEmitter(); }; @@ -166,8 +160,6 @@ class VisualShaderNodeParticleMeshEmitter : public VisualShaderNodeParticleEmitt HashMap get_editable_properties_names() const override; Vector get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override; - virtual Category get_category() const override { return CATEGORY_PARTICLE; } - VisualShaderNodeParticleMeshEmitter(); }; diff --git a/scene/resources/visual_shader_sdf_nodes.h b/scene/resources/visual_shader_sdf_nodes.h index 525098e5fc1f..d84cdb431be9 100644 --- a/scene/resources/visual_shader_sdf_nodes.h +++ b/scene/resources/visual_shader_sdf_nodes.h @@ -49,6 +49,8 @@ class VisualShaderNodeSDFToScreenUV : public VisualShaderNode { virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeSDFToScreenUV(); }; @@ -69,6 +71,8 @@ class VisualShaderNodeScreenUVToSDF : public VisualShaderNode { virtual bool is_input_port_default(int p_port, Shader::Mode p_mode) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeScreenUVToSDF(); }; @@ -88,6 +92,8 @@ class VisualShaderNodeTextureSDF : public VisualShaderNode { virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeTextureSDF(); }; @@ -107,6 +113,8 @@ class VisualShaderNodeTextureSDFNormal : public VisualShaderNode { virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeTextureSDFNormal(); }; @@ -126,6 +134,8 @@ class VisualShaderNodeSDFRaymarch : public VisualShaderNode { virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeSDFRaymarch(); };