Skip to content
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

add_child and add_child_below_node dont use the same syntax and it's quite confusing #2730

Closed
golddotasksquestions opened this issue Aug 30, 2019 · 0 comments · Fixed by godotengine/godot#36581

Comments

@golddotasksquestions
Copy link
Contributor

golddotasksquestions commented Aug 30, 2019

https://docs.godotengine.org/en/3.1/classes/class_node.html#class-node-method-add-child

void add_child ( Node node, bool legible_unique_name=false )

Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.

Setting legible_unique_name to true creates child nodes with human-readable names, based on the name of the node being instanced instead of its type.

void add_child_below_node ( Node node, Node child_node, bool legible_unique_name=false )

Adds a child node. The child is placed below the given node in the list of children.

Setting legible_unique_name to true creates child nodes with human-readable names, based on the name of the node being instanced instead of its type.

Here: "add_child ( Node node," <- the node that gets added is the first argument and called "node",
here: "add_child_below_node ( Node node, Node child_node, <- the first argument is also called "node" like above, but the node that gets added is not this one but the second argument called "child_node"

Both descriptions in the first line say "Adds a child node."

If only one of those method descriptions would exist, they would be clear, but together they are confusing because of the changing syntax. It's not clear what argument is for the node I want to add, which one is for the node that gets something appended to.

Proposal:
void add_child_below_node ( Node appending node, Node node, bool legible_unique_name=false )

Adds a child node below the appending node.
Setting legible_unique_name to true creates child nodes with human-readable names, based on the name of the node being instanced instead of its type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants