diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 7c5e3877f22..a9f32927a8f 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(object)) { Object::cast_to(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 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 3cbee5c5023..e52903101d1 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 49b30bd06e2..fe50961b548 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 d16c80bfc44..f2c5497e4f3 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;