Fixes colorpicker popup immeditately closing when interacting with colorpicker property in a subinspector. Fixes #19559

This commit is contained in:
ordigdug 2018-08-18 11:10:23 -04:00
parent ff8e6f920c
commit 17b439844d
2 changed files with 9 additions and 1 deletions

View file

@ -1735,12 +1735,18 @@ EditorPropertyTransform::EditorPropertyTransform() {
void EditorPropertyColor::_color_changed(const Color &p_color) {
emit_signal("property_changed", get_edited_property(), p_color);
emit_signal("property_changed", get_edited_property(), p_color, true);
}
void EditorPropertyColor::_popup_closed() {
emit_signal("property_changed", get_edited_property(), picker->get_pick_color(), false);
}
void EditorPropertyColor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_color_changed"), &EditorPropertyColor::_color_changed);
ClassDB::bind_method(D_METHOD("_popup_closed"), &EditorPropertyColor::_popup_closed);
}
void EditorPropertyColor::update_property() {
@ -1758,6 +1764,7 @@ EditorPropertyColor::EditorPropertyColor() {
add_child(picker);
picker->set_flat(true);
picker->connect("color_changed", this, "_color_changed");
picker->connect("popup_closed", this, "_popup_closed");
}
////////////// NODE PATH //////////////////////

View file

@ -476,6 +476,7 @@ class EditorPropertyColor : public EditorProperty {
GDCLASS(EditorPropertyColor, EditorProperty)
ColorPickerButton *picker;
void _color_changed(const Color &p_color);
void _popup_closed();
protected:
static void _bind_methods();