summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-23 23:25:42 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-23 23:25:42 +0200
commitdab6e1514f59c2a3f1f078b94d0a50e4d5338193 (patch)
tree4e5214bb96f25570ea1bd6af2a7a06db6d68f871
parent0d52de617fed381d7388d5e967e21bb869164d4a (diff)
parente1798f4278a10de00d1d95e81031391f9ee16c61 (diff)
downloadredot-engine-dab6e1514f59c2a3f1f078b94d0a50e4d5338193.tar.gz
Merge pull request #92207 from YeldhamDev/undo_theme_fix
Fix unchecking theme overrides not creating an undo action
-rw-r--r--editor/editor_inspector.cpp6
-rw-r--r--editor/editor_inspector.h2
-rw-r--r--editor/editor_properties.cpp3
-rw-r--r--editor/editor_properties.h1
4 files changed, 6 insertions, 6 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 7c5e3877f2..a9f32927a8 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -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);
}
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 3cbee5c502..e52903101d 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -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;
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 49b30bd06e..fe50961b54 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -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) {
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index d16c80bfc4..f2c5497e4f 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -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;