You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Remove confusing Control::is_top_level_control()
It's hard to tell at first glance under what circumstances `is_top_level_control()` returns `true`. So it's hard to decide when to use this method. And it seems to be just a helper function for `Control::get_root_parent_control()`. `is_top_level_control()` seems to only return `true` during entry and exit of canvas.
This commit is contained in:
@@ -607,11 +607,6 @@ bool Control::_property_get_revert(const StringName &p_name, Variant &r_property
|
|||||||
|
|
||||||
// Global relations.
|
// Global relations.
|
||||||
|
|
||||||
bool Control::is_top_level_control() const {
|
|
||||||
ERR_READ_THREAD_GUARD_V(false);
|
|
||||||
return is_inside_tree() && (!data.parent_canvas_item && !data.RI && is_set_as_top_level());
|
|
||||||
}
|
|
||||||
|
|
||||||
Control *Control::get_parent_control() const {
|
Control *Control::get_parent_control() const {
|
||||||
ERR_READ_THREAD_GUARD_V(nullptr);
|
ERR_READ_THREAD_GUARD_V(nullptr);
|
||||||
return data.parent_control;
|
return data.parent_control;
|
||||||
@@ -631,10 +626,6 @@ Control *Control::get_root_parent_control() const {
|
|||||||
const Control *c = Object::cast_to<Control>(ci);
|
const Control *c = Object::cast_to<Control>(ci);
|
||||||
if (c) {
|
if (c) {
|
||||||
root = c;
|
root = c;
|
||||||
|
|
||||||
if (c->data.RI || c->is_top_level_control()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ci = ci->get_parent_item();
|
ci = ci->get_parent_item();
|
||||||
|
|||||||
@@ -428,8 +428,6 @@ public:
|
|||||||
|
|
||||||
// Global relations.
|
// Global relations.
|
||||||
|
|
||||||
bool is_top_level_control() const;
|
|
||||||
|
|
||||||
Control *get_parent_control() const;
|
Control *get_parent_control() const;
|
||||||
Window *get_parent_window() const;
|
Window *get_parent_window() const;
|
||||||
Control *get_root_parent_control() const;
|
Control *get_root_parent_control() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user