-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Make InstancePlaceholders in charge of resolving node references in instances #90306
Conversation
@AThousandShips appreciate the review 🙌 I would just like to try and write some actual tests as well, seems there are no tests for instance placeholders and it might be cool to get some coverage on all this new code. |
Sounds great! |
@AThousandShips I've added some tests for the new behavior. There are still a couple of test cases that might be good to cover, specifically concerning properties that should contain Node's but their NodePath is overridden with the same value, so they reference an internal node after creation. This happens quite often now in the editor, since the editor seems to like setting the same value on the properties which is then stored as override in the PackedScene resource, as seen here: But it would be good to get some eyes with testing experience to tell me if my current approach is actually good or not 🙌 |
I'll try take a look soon |
There we go 😁 bda230e is a test that will fail on the current Is there an official/best practice way of creating and deleting temporary files created during tests? |
I'm not sure if there's any good practice for the creation or deletion, I'd suggest checking some of the other tests, like Code looks good I believe, wasn't able to do a functional evaluation at the moment though |
Seems like the I don't know where more to take this, so I would say it's as ready as it will get until further reviews are done 👍 |
Merged the latest master into the branch 👍 |
In the future please use rebasing to update your branch, see here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! This mostly looks good, but could you examine one issue I raised in regards to the editor losing direct node references. Also could you squash this PR into a single commit? This is generally the preferred way to merge PRs in Godot.
@SaracenOne thank you for the review. Added the fix, squashed into one commit, rebased on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not that familiar with InstancePlaceholder, but the code seems fine.
Is there an official/best practice way of creating and deleting temporary files created during tests?
The official practice seems to be polluting a "cache" directory 🙃
#92097
Thank for the review, I'll remove the comment and push a new version. Concerning #92097 I noticed OS seems to lack a temporary directory method, so I'm thinking about making a PR later adding support for it and seeing what happens to the tests if they use that instead. |
As I noted in the issue, it'd be fine if there was a test-specific helper method that returns a fixed sub-directory, so at least the files are isolated. |
Thanks! And congrats for your first merged Godot contribution 🎉 |
This is my attempt at resolving #88662
From what I could figure out with my limited understanding of the codebase, the issue seems deeper than just the suspected PR #83343
I have created an even bigger repro project that tries to really abuse node properties, arrays and their resolutions during the instantiation process.
PlaceholderInstanceRepro.zip
This project not only fails in versions 4.3-dev.X, but also in 4.2.1, where arrays of external and mixed node references hit the error here
godot/scene/resources/packed_scene.cpp
Line 493 in b09f793
I am not nearly comfortable enough with the system to truly say that this is the correct solution, but I hope it can through reviews and discussion serve as a base of finding one.
Bugsquad edit: