Skip to content

Commit

Permalink
Merge pull request #43893 from Chaosus/vs_warnings_3.2
Browse files Browse the repository at this point in the history
[3.2] Added extra warning to texture nodes in visual shader
  • Loading branch information
akien-mga authored Jan 5, 2021
2 parents 3d88ea8 + 3223747 commit 6a708d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scene/resources/visual_shader_nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,10 @@ Vector<StringName> VisualShaderNodeTexture::get_editable_properties() const {

String VisualShaderNodeTexture::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {

if (is_input_port_connected(2) && source != SOURCE_PORT) {
return TTR("The sampler port is connected but not used. Consider changing the source to 'SamplerPort'.");
}

if (source == SOURCE_TEXTURE) {
return String(); // all good
}
Expand Down Expand Up @@ -907,6 +911,13 @@ Vector<StringName> VisualShaderNodeCubeMap::get_editable_properties() const {
return props;
}

String VisualShaderNodeCubeMap::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {
if (is_input_port_connected(2) && source != SOURCE_PORT) {
return TTR("The sampler port is connected but not used. Consider changing the source to 'SamplerPort'.");
}
return String();
}

void VisualShaderNodeCubeMap::_bind_methods() {

ClassDB::bind_method(D_METHOD("set_source", "value"), &VisualShaderNodeCubeMap::set_source);
Expand Down
1 change: 1 addition & 0 deletions scene/resources/visual_shader_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ class VisualShaderNodeCubeMap : public VisualShaderNode {
TextureType get_texture_type() const;

virtual Vector<StringName> get_editable_properties() const;
virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const;

VisualShaderNodeCubeMap();
};
Expand Down

0 comments on commit 6a708d6

Please sign in to comment.