Merge pull request #61483 from kleonc/popup-update-exclusive-when-shown

[3.x] Allow changing `exclusive` of already popped up `Popup`
This commit is contained in:
Rémi Verschelde 2022-05-31 12:14:37 +02:00 committed by GitHub
commit b44928586b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View file

@ -2051,6 +2051,11 @@ void Control::show_modal(bool p_exclusive) {
data.modal_frame = Engine::get_singleton()->get_frames_drawn();
}
void Control::set_modal_exclusive(bool p_exclusive) {
ERR_FAIL_NULL_MSG(data.MI, "Modal exclusive can be set only if the Control is already shown as modal.");
data.modal_exclusive = p_exclusive;
}
void Control::_modal_set_prev_focus_owner(ObjectID p_prev) {
data.modal_prev_focus_owner = p_prev;
}

View file

@ -250,6 +250,7 @@ protected:
virtual void remove_child_notify(Node *p_child);
//virtual void _window_gui_input(InputEvent p_event);
void set_modal_exclusive(bool p_exclusive);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;

View file

@ -194,6 +194,9 @@ void Popup::_popup(const Rect2 &p_bounds, const bool p_centered) {
void Popup::set_exclusive(bool p_exclusive) {
exclusive = p_exclusive;
if (popped_up) {
set_modal_exclusive(exclusive);
}
}
bool Popup::is_exclusive() const {