From 7c9afbc13977739813cb22b236a81abbdb742107 Mon Sep 17 00:00:00 2001 From: Yuri Rubinsky Date: Mon, 22 Jul 2024 11:16:12 +0300 Subject: [PATCH] Fix warning printing for `VisualShaderNodeTextureParameter` --- scene/resources/visual_shader_nodes.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 38c60828e81..5f70a24fcd6 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -6498,6 +6498,8 @@ bool VisualShaderNodeTextureParameter::is_show_prop_names() const { } String VisualShaderNodeTextureParameter::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const { + String warning = VisualShaderNodeParameter::get_warning(p_mode, p_type); + if (texture_source != SOURCE_NONE) { String texture_source_str; @@ -6528,7 +6530,10 @@ String VisualShaderNodeTextureParameter::get_warning(Shader::Mode p_mode, Visual default: break; } - return vformat(RTR("'%s' type is incompatible with '%s' source."), texture_type_str, texture_source_str); + if (!warning.is_empty()) { + warning += "\n"; + } + warning += vformat(RTR("'%s' type is incompatible with '%s' source."), texture_type_str, texture_source_str); } else if (color_default != COLOR_DEFAULT_WHITE) { String color_default_str; @@ -6542,11 +6547,14 @@ String VisualShaderNodeTextureParameter::get_warning(Shader::Mode p_mode, Visual default: break; } - return vformat(RTR("'%s' default color is incompatible with '%s' source."), color_default_str, texture_source_str); + if (!warning.is_empty()) { + warning += "\n"; + } + warning += vformat(RTR("'%s' default color is incompatible with '%s' source."), color_default_str, texture_source_str); } } - return ""; + return warning; } HashMap VisualShaderNodeTextureParameter::get_editable_properties_names() const {