From 954f7cca6025887dc2e665e3cc24b8428c29c593 Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Sun, 25 Feb 2018 21:05:40 +0100 Subject: [PATCH] Fix #17019 : overrides with unknown base setting If at the time of the _GLOBAL_DEF call a setting itself was unknown, the function would always return the supplied default value instead of checking for overrides. This commit changes that, lookup now always happens which correctly takes overrides into account. --- core/project_settings.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/project_settings.cpp b/core/project_settings.cpp index d3a62263acb..ac4a4b7d155 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -816,12 +816,11 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) { Variant ret; - if (ProjectSettings::get_singleton()->has_setting(p_var)) { - ret = ProjectSettings::get_singleton()->get(p_var); - } else { + if (!ProjectSettings::get_singleton()->has_setting(p_var)) { ProjectSettings::get_singleton()->set(p_var, p_default); - ret = p_default; } + ret = ProjectSettings::get_singleton()->get(p_var); + ProjectSettings::get_singleton()->set_initial_value(p_var, p_default); ProjectSettings::get_singleton()->set_builtin_order(p_var); return ret;