Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some missing categories in visual shader nodes #89190

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions scene/resources/visual_shader_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ class VisualShaderNodeCurveXYZTexture : public VisualShaderNodeResizableBase {
virtual Vector<StringName> get_editable_properties() const override;
virtual bool is_use_prop_slots() const override;

virtual Category get_category() const override { return CATEGORY_TEXTURES; }

VisualShaderNodeCurveXYZTexture();
};

Expand Down Expand Up @@ -657,6 +659,8 @@ class VisualShaderNodeCubemap : public VisualShaderNode {
virtual Vector<StringName> 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();
};

Expand Down Expand Up @@ -832,6 +836,8 @@ class VisualShaderNodeIntOp : public VisualShaderNode {

virtual Vector<StringName> get_editable_properties() const override;

virtual Category get_category() const override { return CATEGORY_SCALAR; }

VisualShaderNodeIntOp();
};

Expand Down Expand Up @@ -880,6 +886,8 @@ class VisualShaderNodeUIntOp : public VisualShaderNode {

virtual Vector<StringName> get_editable_properties() const override;

virtual Category get_category() const override { return CATEGORY_SCALAR; }

VisualShaderNodeUIntOp();
};

Expand Down Expand Up @@ -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();
};

Expand Down Expand Up @@ -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();
};

Expand Down Expand Up @@ -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();
};

Expand Down Expand Up @@ -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; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was redundant


VisualShaderNodeVectorDecompose();
};

Expand Down Expand Up @@ -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();
};

Expand Down
8 changes: 0 additions & 8 deletions scene/resources/visual_shader_particle_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were redundant as the parent type already does this


VisualShaderNodeParticleSphereEmitter();
};

Expand All @@ -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();
};

Expand All @@ -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();
};

Expand Down Expand Up @@ -166,8 +160,6 @@ class VisualShaderNodeParticleMeshEmitter : public VisualShaderNodeParticleEmitt
HashMap<StringName, String> get_editable_properties_names() const override;
Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override;

virtual Category get_category() const override { return CATEGORY_PARTICLE; }

VisualShaderNodeParticleMeshEmitter();
};

Expand Down
10 changes: 10 additions & 0 deletions scene/resources/visual_shader_sdf_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure exactly what category to assign these to

Copy link
Member

@Geometror Geometror Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to add a new category for SDF nodes in the future. Or we just use CATEGORY_TEXTURES or CATEGORY_SPECIAL, at least that's what I would do for now.


VisualShaderNodeSDFToScreenUV();
};

Expand All @@ -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();
};

Expand All @@ -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();
};

Expand All @@ -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();
};

Expand All @@ -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();
};

Expand Down
Loading