Add a `Node.add_child_at()` method to add a node at a specific index
**Describe the problem or limitation you are having in your project:** There is currently no way to directly add a child at an arbitrary index. The options we are have are either: 1. `add_child` then move it with `move_child` 2. Use `add_child_below_node` to specifiy a sibling. This method is already pretty poor and [has been replaced](https://github.com/godotengine/godot/issues/19642) with `add_sibling` in `master`, and it doesn't allow you to add a node at index 0 because the new node is added after the sibling. Honestly, I was a little surprised to find this feature missing. **Describe the feature / enhancement and how it helps to overcome the problem or limitation:** Implement a simple `add_child_at` which takes an index parameter in addition to the child. E.g. ``` # Add child at index 0 parent.add_child_at(child, 0) ``` **If this enhancement will not be used often, can it be worked around with a few lines of script?:** It's pretty fast to work around with `add` then `move`, but tree mutations seem like common enough operations to be worth adding. If we think `add_sibling` was a common enough use-case, then this seems pretty reasonable too. **Is there a reason why this should be core and not an add-on in the asset library?:** Complements existing core functionality.
Posted by andy-noisyduck on Jul 1, 2020, 3:24 PM
Tags
Related issues
- [Meta] Feedback on granular control over Copilot changes
- unexpected status 401 Unauthorized issue
- [MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
- [CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
- Video stops playing after some minutes
- [MODEL] Claude verbose code comments by default — ignores instructions to stop.
Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments
github (Software)
[Meta] Feedback on granular control over Copilot changes
unexpected status 401 Unauthorized issue
[MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
[CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
Video stops playing after some minutes
[MODEL] Claude verbose code comments by default — ignores instructions to stop.
Scope Codex VS Code chats to the current workspace/project
Update on "Co-authored-by: Copilot" in commit messages
Add a `Node.add_child_at()` method to add a node at a specific index
**Describe the problem or limitation you are having in your project:** There is currently no way to directly add a child at an arbitrary index. The options we are have are either: 1. `add_child` then move it with `move_child` 2. Use `add_child_below_node` to specifiy a sibling. This method is already pretty poor and [has been replaced](https://github.com/godotengine/godot/issues/19642) with `add_sibling` in `master`, and it doesn't allow you to add a node at index 0 because the new node is added after the sibling. Honestly, I was a little surprised to find this feature missing. **Describe the feature / enhancement and how it helps to overcome the problem or limitation:** Implement a simple `add_child_at` which takes an index parameter in addition to the child. E.g. ``` # Add child at index 0 parent.add_child_at(child, 0) ``` **If this enhancement will not be used often, can it be worked around with a few lines of script?:** It's pretty fast to work around with `add` then `move`, but tree mutations seem like common enough operations to be worth adding. If we think `add_sibling` was a common enough use-case, then this seems pretty reasonable too. **Is there a reason why this should be core and not an add-on in the asset library?:** Complements existing core functionality.
Comments (0)
No comments yet. Start the discussion.