Merge pull request #92207 from YeldhamDev/undo_theme_fix

Fix unchecking theme overrides not creating an undo action
This commit is contained in:
Rémi Verschelde 2024-05-23 23:25:42 +02:00
commit dab6e1514f
No known key found for this signature in database
GPG key ID: C3336907360768E1
4 changed files with 6 additions and 6 deletions

View file

@ -3782,7 +3782,6 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
}
emit_signal(_prop_edited, p_name);
} else if (Object::cast_to<MultiNodeEdit>(object)) {
Object::cast_to<MultiNodeEdit>(object)->set_property_field(p_name, p_value, p_changed_field);
_edit_request_change(object, p_name);
@ -3959,7 +3958,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
//property checked
if (autoclear) {
if (!p_checked) {
object->set(p_path, Variant());
_edit_set(p_path, Variant(), false, "");
} else {
Variant to_create;
List<PropertyInfo> pinfo;
@ -3971,7 +3970,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
break;
}
}
object->set(p_path, to_create);
_edit_set(p_path, to_create, false, "");
}
if (editor_property_map.has(p_path)) {
@ -3982,7 +3981,6 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
E->update_cache();
}
}
} else {
emit_signal(SNAME("property_toggled"), p_path, p_checked);
}

View file

@ -344,7 +344,7 @@ class EditorInspectorArray : public EditorInspectorSection {
MODE_NONE,
MODE_USE_COUNT_PROPERTY,
MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION,
} mode;
} mode = MODE_NONE;
StringName count_property;
StringName array_element_prefix;
String swap_method;

View file

@ -2645,7 +2645,7 @@ void EditorPropertyColor::_color_changed(const Color &p_color) {
}
void EditorPropertyColor::_popup_closed() {
get_edited_object()->set(get_edited_property(), last_color);
get_edited_object()->set(get_edited_property(), was_checked ? Variant(last_color) : Variant());
if (!picker->get_pick_color().is_equal_approx(last_color)) {
emit_changed(get_edited_property(), picker->get_pick_color(), "", false);
}
@ -2653,6 +2653,7 @@ void EditorPropertyColor::_popup_closed() {
void EditorPropertyColor::_picker_opening() {
last_color = picker->get_pick_color();
was_checked = !is_checkable() || is_checked();
}
void EditorPropertyColor::_notification(int p_what) {

View file

@ -625,6 +625,7 @@ class EditorPropertyColor : public EditorProperty {
Color last_color;
bool live_changes_enabled = true;
bool was_checked = false;
protected:
virtual void _set_read_only(bool p_read_only) override;