-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Prevent errors when using ViewportTexture #75751
Prevent errors when using ViewportTexture #75751
Conversation
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.
Looks good to me. The change in control flow isn't a large as it appears from the size of the PR and overall it seems quite straightforward.
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.
The Node change likely needs a look by core?
Otherwise LGTM.
bool Node::is_ready() const { | ||
return !data.ready_first; | ||
} |
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.
Should we expose this to the bindings?
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.
It needs a different name, because RichTextLabel already has is_ready()
🙃
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.
Ouch... The RTL one should be named is_done_processing
or similar... but that would break compat.
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.
Ok exposed it as is_node_ready()
.
40d8c9c
to
1b9802f
Compare
Thanks! |
I note this has also fixed an (unticketed, to my knowledge) issue with a |
Cherry-picked for 4.0.3. |
setup_local_to_scene()
is called right when the texture is initializing. It often fails on the first attempt, because the scene is not fully initialized and the assigned node path is still not valid. This PR ensures that ViewportTexture will only try to setup when the scene is prepared. Also there is no way to reasonably expect the texture to immediately hold correct data (size etc.), so I silenced the errors until the texture is initialized. It was already working correctly with the errors, so this PR just changes it to "intended behavior" and removes error spam.Fixes #75740 and probably similar issues.
Ah I also had to add
is_ready()
method to Node, to reliably check if the node is ready. Maybe it could be exposed to scripting, because it's useful sometimes (althoughis_inside_tree()
is enough in most cases).