Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unchecking theme overrides not creating an undo action #92207

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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)) {
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2645,14 +2645,15 @@ 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);
}
}

void EditorPropertyColor::_picker_opening() {
last_color = picker->get_pick_color();
was_checked = !is_checkable() || is_checked();
}

void EditorPropertyColor::_notification(int p_what) {
Expand Down
1 change: 1 addition & 0 deletions editor/editor_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading