Skip to content

Commit

Permalink
Fix shader parameter assign
Browse files Browse the repository at this point in the history
-Make sure the remap is created properly if never assigned before.

Fixes godotengine#72923. Supersedes godotengine#73066.
  • Loading branch information
reduz committed Feb 18, 2023
1 parent e9c7b8d commit 34fd128
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scene/resources/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,15 @@ void ShaderMaterial::set_shader_parameter(const StringName &p_param, const Varia
param_cache.erase(p_param);
RS::get_singleton()->material_set_param(_get_material(), p_param, Variant());
} else {
param_cache[p_param] = p_value;
Variant *v = param_cache.getptr(p_param);
if (!v) {
// Never assigned, also update the remap cache.
remap_cache["shader_parameter/" + p_param.operator String()] = p_param;
param_cache.insert(p_param, p_value);
} else {
*v = p_value;
}

if (p_value.get_type() == Variant::OBJECT) {
RID tex_rid = p_value;
if (tex_rid == RID()) {
Expand Down

0 comments on commit 34fd128

Please sign in to comment.