1
0
Fork 0

Only send editor "settings_changed" if actually changed.

This commit is contained in:
Bernhard Liebl 2017-12-29 11:03:29 +01:00
parent f11a138505
commit 62f3af9de1
1 changed files with 19 additions and 6 deletions

View File

@ -75,20 +75,33 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool
return true; return true;
} }
bool changed = false;
if (p_value.get_type() == Variant::NIL) { if (p_value.get_type() == Variant::NIL) {
if (props.has(p_name)) {
props.erase(p_name); props.erase(p_name);
changed = true;
}
} else { } else {
if (props.has(p_name)) if (props.has(p_name)) {
if (p_value != props[p_name].variant) {
props[p_name].variant = p_value; props[p_name].variant = p_value;
else changed = true;
}
} else {
props[p_name] = VariantContainer(p_value, last_order++); props[p_name] = VariantContainer(p_value, last_order++);
changed = true;
}
if (save_changed_setting) { if (save_changed_setting) {
if (props[p_name].save != true) {
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"); emit_signal("settings_changed");
} }
return true; return true;