From d0f85b932115b08a94b46eadaa1650a40d5fc1de Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Mon, 14 Sep 2020 11:48:53 +0300 Subject: Fix setting the default texture to shader --- servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'servers') diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp index 90dd6af319..e723028e56 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp @@ -1256,6 +1256,10 @@ void RasterizerStorageRD::shader_set_code(RID p_shader, const String &p_code) { } material->shader_type = new_type; } + + for (Map::Element *E = shader->default_texture_parameter.front(); E; E = E->next()) { + shader->data->set_default_texture_param(E->key(), E->get()); + } } if (shader->data) { @@ -1292,7 +1296,9 @@ void RasterizerStorageRD::shader_set_default_texture_param(RID p_shader, const S } else { shader->default_texture_parameter.erase(p_name); } - + if (shader->data) { + shader->data->set_default_texture_param(p_name, p_texture); + } for (Set::Element *E = shader->owners.front(); E; E = E->next()) { Material *material = E->get(); _material_queue_update(material, false, true); -- cgit v1.2.3