-
-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Expose Node::get_internal_mode()
#90040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
See also (this doesn't fully close that as it's a broader topic): |
If you only want to check if a node is internal, you can do something like: func is_internal(node: Node) -> bool:
var count := get_child_count()
if count == 0:
return true
var index := node.get_index(true)
if index < get_child(0).get_index(true):
return true
if index > get_child(get_child_count() - 1).get_index(true):
return true
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description of INTERNAL_MODE_*
should also be updated accordingly. They were written for add_child()
so "will" is used.
fb2bd1f
to
f125808
Compare
@@ -1298,13 +1304,13 @@ | |||
Duplicate using [method PackedScene.instantiate]. If the node comes from a scene saved on disk, re-uses [method PackedScene.instantiate] as the base for the duplicated node and its children. | |||
</constant> | |||
<constant name="INTERNAL_MODE_DISABLED" value="0" enum="InternalMode"> | |||
The node will not be internal. | |||
The node is not internal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the description of InternalMode
as @timothyqiu suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not particularly urgent, but the descriptions of add_sibling()
, find_child()
, find_children()
, get_child()
, and more could use an update, as they refer to this value solely as the "internal parameter of add_child()
"
<method name="get_internal_mode" qualifiers="const"> | ||
<return type="int" enum="Node.InternalMode" /> | ||
<description> | ||
Returns the node's internal mode. See [enum InternalMode]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning when this value is written to. You know as well as me it's in add_child()
/add_sibling()
.
Sorry I deleted this branch accidently. Restored now |
Expose
Node::get_internal_mode()
so that we can easily check if the child entered is a internal node: