summaryrefslogtreecommitdiff
path: root/scene/main/shader_globals_override.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/shader_globals_override.cpp')
-rw-r--r--scene/main/shader_globals_override.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
index ed08c45a01..0049359cad 100644
--- a/scene/main/shader_globals_override.cpp
+++ b/scene/main/shader_globals_override.cpp
@@ -229,20 +229,19 @@ void ShaderGlobalsOverride::_activate() {
active = true;
add_to_group(SceneStringNames::get_singleton()->shader_overrides_group_active);
- const StringName *K = nullptr;
- while ((K = overrides.next(K))) {
- Override *o = overrides.getptr(*K);
+ for (const KeyValue<StringName, Override> &E : overrides) {
+ const Override *o = &E.value;
if (o->in_use && o->override.get_type() != Variant::NIL) {
if (o->override.get_type() == Variant::OBJECT) {
RID tex_rid = o->override;
- RS::get_singleton()->global_variable_set_override(*K, tex_rid);
+ RS::get_singleton()->global_variable_set_override(E.key, tex_rid);
} else {
- RS::get_singleton()->global_variable_set_override(*K, o->override);
+ RS::get_singleton()->global_variable_set_override(E.key, o->override);
}
}
- }
- update_configuration_warnings(); //may have activated
+ update_configuration_warnings(); //may have activated
+ }
}
}
@@ -256,11 +255,10 @@ void ShaderGlobalsOverride::_notification(int p_what) {
case Node3D::NOTIFICATION_EXIT_TREE: {
if (active) {
//remove overrides
- const StringName *K = nullptr;
- while ((K = overrides.next(K))) {
- Override *o = overrides.getptr(*K);
+ for (const KeyValue<StringName, Override> &E : overrides) {
+ const Override *o = &E.value;
if (o->in_use) {
- RS::get_singleton()->global_variable_set_override(*K, Variant());
+ RS::get_singleton()->global_variable_set_override(E.key, Variant());
}
}
}