diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/option_button.cpp | 3 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 2 | ||||
-rw-r--r-- | scene/main/node.cpp | 18 | ||||
-rw-r--r-- | scene/main/node.h | 2 | ||||
-rw-r--r-- | scene/main/window.cpp | 2 |
5 files changed, 10 insertions, 17 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index e7de0f0912..5780cc5e71 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -334,9 +334,6 @@ OptionButton::OptionButton() { popup = memnew(PopupMenu); popup->hide(); add_child(popup); - // popup->set_pass_on_modal_close_click(false); - // popup->set_notify_transform(true); - popup->set_allow_search(true); popup->connect("index_pressed", callable_mp(this, &OptionButton::_selected)); popup->connect("id_focused", callable_mp(this, &OptionButton::_focused)); popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false)); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index b439d85983..6e19b820e0 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1442,7 +1442,7 @@ PopupMenu::PopupMenu() { during_grabbed_click = false; invalidated_click = false; - allow_search = false; + allow_search = true; search_time_msec = 0; search_string = ""; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index ad4d3c54be..c9d430c656 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1234,17 +1234,13 @@ void Node::add_child(Node *p_child, bool p_legible_unique_name) { _add_child_nocheck(p_child, p_child->data.name); } -void Node::add_child_below_node(Node *p_node, Node *p_child, bool p_legible_unique_name) { - ERR_FAIL_NULL(p_node); - ERR_FAIL_NULL(p_child); - - add_child(p_child, p_legible_unique_name); +void Node::add_sibling(Node *p_sibling, bool p_legible_unique_name) { + ERR_FAIL_NULL(p_sibling); + ERR_FAIL_COND_MSG(p_sibling == this, "Can't add sibling '" + p_sibling->get_name() + "' to itself."); // adding to itself! + ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy setting up children, add_sibling() failed. Consider using call_deferred(\"add_sibling\", sibling) instead."); - if (is_a_parent_of(p_node)) { - move_child(p_child, p_node->get_index() + 1); - } else { - WARN_PRINT("Cannot move under node " + p_node->get_name() + " as " + p_child->get_name() + " does not share a parent."); - } + get_parent()->add_child(p_sibling, p_legible_unique_name); + get_parent()->move_child(p_sibling, this->get_index() + 1); } void Node::_propagate_validate_owner() { @@ -2710,7 +2706,7 @@ void Node::_bind_methods() { GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE); ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case")); - ClassDB::bind_method(D_METHOD("add_child_below_node", "preceding_node", "node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_sibling", "sibling", "legible_unique_name"), &Node::add_sibling, DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_name", "name"), &Node::set_name); ClassDB::bind_method(D_METHOD("get_name"), &Node::get_name); diff --git a/scene/main/node.h b/scene/main/node.h index d1665d1236..7595aabd9a 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -266,7 +266,7 @@ public: void set_name(const String &p_name); void add_child(Node *p_child, bool p_legible_unique_name = false); - void add_child_below_node(Node *p_node, Node *p_child, bool p_legible_unique_name = false); + void add_sibling(Node *p_sibling, bool p_legible_unique_name = false); void remove_child(Node *p_child); int get_child_count() const; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index b2fc17c0ab..a9be8a1eff 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -992,7 +992,7 @@ void Window::popup_centered_ratio(float p_ratio) { ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window."); - Rect2i parent_rect; + Rect2 parent_rect; if (is_embedded()) { parent_rect = get_parent_viewport()->get_visible_rect(); |