godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.06k stars 65 forks source link

Add `include_internal` flag to `Node.find_child` and `Node.find_children` #9561

Open jbromberg opened 1 month ago

jbromberg commented 1 month ago

Describe the project you are working on

A mobile Godot editor

Describe the problem or limitation you are having in your project

I'd like to be able to differentiate between internal and external children when using find_child and find_children

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The flag allows developers to differentiate between internal & external children and gives it similar functionality to the apis that already have it like get_children, get_child, etc

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

find_children("*", "", true, false, true) would include all recursive internal and external children of a node

If this enhancement will not be used often, can it be worked around with a few lines of script?

No since there isn't even currently a way to determine if a given child is internal or not. Currently you would have to write your own recursive search function that leverages the Node.get_children method since it supports the include_internal property.

Is there a reason why this should be core and not an add-on in the asset library?

It's core

RadiantUwU commented 1 month ago

Just want to know how many people want this before i commit to it.

RadiantUwU commented 2 weeks ago

Looks straight-forward to add, we'll register a compatibility method.