From d0fbc467a674344a26963151945d40ab19c0e1af Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Fri, 12 Nov 2021 18:23:45 +0300 Subject: [PATCH] Fix editor crash due incorrect setup of default texture in visual shader --- scene/resources/visual_shader_nodes.cpp | 12 ++++++------ scene/resources/visual_shader_particle_nodes.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 111cd088f19..951870fe34f 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -497,7 +497,7 @@ String VisualShaderNodeTexture::get_input_port_default_hint(int p_port) const { Vector VisualShaderNodeTexture::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const { VisualShader::DefaultTextureParam dtp; dtp.name = make_unique_id(p_type, p_id, "tex"); - dtp.params[0] = texture; + dtp.params.push_back(texture); Vector ret; ret.push_back(dtp); return ret; @@ -895,7 +895,7 @@ String VisualShaderNodeCurveTexture::generate_code(Shader::Mode p_mode, VisualSh Vector VisualShaderNodeCurveTexture::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const { VisualShader::DefaultTextureParam dtp; dtp.name = make_unique_id(p_type, p_id, "curve"); - dtp.params[0] = texture; + dtp.params.push_back(texture); Vector ret; ret.push_back(dtp); return ret; @@ -980,7 +980,7 @@ String VisualShaderNodeCurveXYZTexture::generate_code(Shader::Mode p_mode, Visua Vector VisualShaderNodeCurveXYZTexture::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const { VisualShader::DefaultTextureParam dtp; dtp.name = make_unique_id(p_type, p_id, "curve3d"); - dtp.params[0] = texture; + dtp.params.push_back(texture); Vector ret; ret.push_back(dtp); return ret; @@ -1162,7 +1162,7 @@ String VisualShaderNodeTexture2DArray::get_input_port_name(int p_port) const { Vector VisualShaderNodeTexture2DArray::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const { VisualShader::DefaultTextureParam dtp; dtp.name = make_unique_id(p_type, p_id, "tex3d"); - dtp.params[0] = texture_array; + dtp.params.push_back(texture_array); Vector ret; ret.push_back(dtp); return ret; @@ -1219,7 +1219,7 @@ String VisualShaderNodeTexture3D::get_input_port_name(int p_port) const { Vector VisualShaderNodeTexture3D::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const { VisualShader::DefaultTextureParam dtp; dtp.name = make_unique_id(p_type, p_id, "tex3d"); - dtp.params[0] = texture; + dtp.params.push_back(texture); Vector ret; ret.push_back(dtp); return ret; @@ -1318,7 +1318,7 @@ bool VisualShaderNodeCubemap::is_output_port_expandable(int p_port) const { Vector VisualShaderNodeCubemap::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const { VisualShader::DefaultTextureParam dtp; dtp.name = make_unique_id(p_type, p_id, "cube"); - dtp.params[0] = cube_map; + dtp.params.push_back(cube_map); Vector ret; ret.push_back(dtp); return ret; diff --git a/scene/resources/visual_shader_particle_nodes.cpp b/scene/resources/visual_shader_particle_nodes.cpp index c8f6e9182f6..7dd4eed15be 100644 --- a/scene/resources/visual_shader_particle_nodes.cpp +++ b/scene/resources/visual_shader_particle_nodes.cpp @@ -351,11 +351,11 @@ String VisualShaderNodeParticleMeshEmitter::generate_code(Shader::Mode p_mode, V Vector VisualShaderNodeParticleMeshEmitter::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const { VisualShader::DefaultTextureParam dtp_vx; dtp_vx.name = make_unique_id(p_type, p_id, "mesh_vx"); - dtp_vx.params[0] = position_texture; + dtp_vx.params.push_back(position_texture); VisualShader::DefaultTextureParam dtp_nm; dtp_nm.name = make_unique_id(p_type, p_id, "mesh_nm"); - dtp_nm.params[0] = normal_texture; + dtp_nm.params.push_back(normal_texture); Vector ret; ret.push_back(dtp_vx);