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

[Feature request] recursively double all nodes in a scene #432

Open
feefladder opened this issue Oct 4, 2022 · 3 comments
Open

[Feature request] recursively double all nodes in a scene #432

feefladder opened this issue Oct 4, 2022 · 3 comments
Labels
would be great Great idea, no idea how to implement and could be a huge undertaking.

Comments

@feefladder
Copy link

So this is quite a common use case I think:

I added a script to add functionality to a parent node. Because the parent does quite some initialization and has resources that I'd rather link through the GUI, I want to make a PackedScene out of it and load that for my unit (and also integration) tests.

However, currently the doubler only doubles the top-level node in a scene. It would be nice to have a recursive option (that could default to false) that searches for scripts in all scene nodes and doubles them.

I understand it would make things a bit more complex, but since the (partial) double function already does type-checking, maybe adding a boolean would not be too confusing?

@feefladder feefladder changed the title recursively double all nodes in a scene [Feature request] recursively double all nodes in a scene Oct 6, 2022
@bitwes
Copy link
Owner

bitwes commented Oct 7, 2022

You would like to automatically create double and partial_double scripts for all children (recursively) in a scene?

This might be possible. It would probably have to set the script on all the nodes instead of making new nodes. This will retain any references to the nodes and easily preserve their spot in the tree. Gut does have a replace_node method (and I think Godot added one awhile back) that will retain names and position in the tree. That could be useful here.

This seems feasible, but might have a lot of issues that I'm not thinking of yet.

@bitwes bitwes added the would be great Great idea, no idea how to implement and could be a huge undertaking. label Oct 7, 2022
@feefladder
Copy link
Author

You would like to automatically create double and partial_double scripts for all children (recursively) in a scene?

Exactly, so I can check all signals and everything for integration tests, while not having to build the scene from code :)

This might be possible. It would probably have to set the script on all the nodes instead of making new nodes. This will retain any references to the nodes and easily preserve their spot in the tree. Gut does have a replace_node method (and I think Godot added one awhile back) that will retain names and position in the tree. That could be useful here.

I did get it to work at some point with set_script I could make a proposal PR!

@bitwes
Copy link
Owner

bitwes commented Oct 7, 2022

PRs are always welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
would be great Great idea, no idea how to implement and could be a huge undertaking.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants