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

Allow Autoloads to be instanced below the user-run scene #165

Open
samdze opened this issue Oct 18, 2019 · 1 comment
Open

Allow Autoloads to be instanced below the user-run scene #165

samdze opened this issue Oct 18, 2019 · 1 comment

Comments

@samdze
Copy link

samdze commented Oct 18, 2019

Describe the project you are working on:
Top-down 2d game with several viewports that have to be updated in a specific order, then rendered.

Describe the problem or limitation you are having in your project:
I'd like to have a way to globally update or call functions in nodes that are scattered across the SceneTree.
I want to update the positions of those objects only after everything else has been updated.

Describe how this feature / enhancement will help you overcome this problem or limitation:
I'd like to be able to define Autoloads that will be created below the current scene instead of above it.
This way, I can keep track of the nodes I'd like to update adding them to a list and calling them in the Autoload that is certain to be ran after everything else.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
In the editor, the project manager could also display the Scene as a non-removable "Autoload", and allow the user to place Autoloads below it.

GodotAutoloadOrder

Additionally, the API used by plugins to add/remove Autoloads could be updated to check and specify their order and the position of the Scene inside the list.

Describe implementation detail for your proposal (in code), if possible:
<>

If this enhancement will not be used often, can it be worked around with a few lines of script?:
Maybe, but they would require more boilerplate and more strict setups.

Is there a reason why this should be core and not an add-on in the asset library?:
It is a feature better added as a core one as it can give more control to Autoloads and plugin creators.

@willnationsdev
Copy link
Contributor

I'd like to have a way to globally update or call functions in nodes that are scattered across the SceneTree.
I want to update the positions of those objects only after everything else has been updated.

Just for arguments' sake, would a SceneTree.call_group() solve this alongside a signal emission/connection for the, "Everything is done. Now do this," callback?

I'd like to be able to define Autoloads that will be created below the current scene instead of above it.
This way, I can keep track of the nodes I'd like to update adding them to a list and calling them in the Autoload that is certain to be ran after everything else.

I'm really quite confused about what you are saying here, so some of the following may or may not be relevant:

Are these autoloads that would be moved whenever SceneTree.change_scene() is called? And are you expecting these nodes to always show up as children of the local root scene in the Scene dock? How would having non-global, child autoloaded nodes work with nested hierarchies of scenes? Does each generation of scene (parent/child/etc.) get its own unique copy of these non-singleton autoloads? If not, how do you configure which scenes they are always created in (might as well just add traits to GDScript and define a trait that lets your root node's script instantiate and use the "autoload" as a child - would be far cleaner).

You can already add scenes as autoloads, so the mockup doesn't really communicate to me what functional difference you are expecting.

Are you expecting the "Scene" in your example to be a node that is instantiated as a child of the "WorldManager" node? Is that what this is about?

@Calinou Calinou changed the title Allow Autoloads to be instanced below the user-ran scene Allow Autoloads to be instanced below the user-run scene Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants