diff options
author | Noshyaar <poommetee@protonmail.com> | 2018-01-01 18:48:33 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-01 18:48:33 +0700 |
commit | 2154f82302a8a5a7b25e5425a9579de692e0726f (patch) | |
tree | f529cac80d75a4e523f8bc1f5d8cdf8a0ce73cfb /editor | |
parent | 45612f16571b4bf1430363c40af1fa9f2f110903 (diff) | |
parent | 62f3af9de14f89a66cc738fac4c4e470a180ec23 (diff) |
Merge pull request #15152 from poke1024/editor-settings-change
Only send editor "settings_changed" if actually changed
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_settings.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 7450a6f0a9..c0932c47b8 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -75,20 +75,33 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool return true; } + bool changed = false; + if (p_value.get_type() == Variant::NIL) { - props.erase(p_name); + if (props.has(p_name)) { + props.erase(p_name); + changed = true; + } } else { - if (props.has(p_name)) - props[p_name].variant = p_value; - else + if (props.has(p_name)) { + if (p_value != props[p_name].variant) { + props[p_name].variant = p_value; + changed = true; + } + } else { props[p_name] = VariantContainer(p_value, last_order++); + changed = true; + } if (save_changed_setting) { - props[p_name].save = true; + if (props[p_name].save != true) { + props[p_name].save = true; + changed = true; + } } } - if (p_emit_signal) { + if (changed && p_emit_signal) { emit_signal("settings_changed"); } return true; |