summaryrefslogtreecommitdiff
path: root/editor/editor_settings.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-11-30 08:08:36 +0100
committerGitHub <noreply@github.com>2017-11-30 08:08:36 +0100
commitcf50ce86e04399f69a8b3f8da9728354cc6d04a0 (patch)
tree522425dd14496240d7a15a3c39fa8ec1e5df4b22 /editor/editor_settings.cpp
parent40a7b7e391e14fa53a0547c9c173a869f3da626e (diff)
parent4b80bc3303c88b545d63c6d8ecd63ad22d44ac3d (diff)
Merge pull request #13407 from djrm/pr_fixes
Fixed editor settings disappearing (caused by uninitialized variable).
Diffstat (limited to 'editor/editor_settings.cpp')
-rw-r--r--editor/editor_settings.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 52672fff72..638b23382d 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -75,10 +75,9 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool
return true;
}
- if (p_value.get_type() == Variant::NIL)
+ if (p_value.get_type() == Variant::NIL) {
props.erase(p_name);
- else {
-
+ } else {
if (props.has(p_name))
props[p_name].variant = p_value;
else
@@ -967,6 +966,8 @@ void EditorSettings::raise_order(const String &p_setting) {
void EditorSettings::set_initial_value(const StringName &p_setting, const Variant &p_value) {
+ _THREAD_SAFE_METHOD_
+
if (!props.has(p_setting))
return;
props[p_setting].initial = p_value;
@@ -979,7 +980,8 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) {
if (EditorSettings::get_singleton()->has_setting(p_setting))
ret = EditorSettings::get_singleton()->get(p_setting);
else
- EditorSettings::get_singleton()->set(p_setting, p_default);
+ EditorSettings::get_singleton()->set_manually(p_setting, p_default);
+
if (!EditorSettings::get_singleton()->has_default_value(p_setting))
EditorSettings::get_singleton()->set_initial_value(p_setting, p_default);
@@ -997,12 +999,15 @@ bool EditorSettings::property_can_revert(const String &p_setting) {
if (!props.has(p_setting))
return false;
+ if (!props[p_setting].has_default_value)
+ return false;
+
return props[p_setting].initial != props[p_setting].variant;
}
Variant EditorSettings::property_get_revert(const String &p_setting) {
- if (!props.has(p_setting))
+ if (!props.has(p_setting) || !props[p_setting].has_default_value)
return Variant();
return props[p_setting].initial;