FTI - Camera2D accepts resets only after entering tree#112810
Merged
Repiteo merged 1 commit intogodotengine:masterfrom Nov 25, 2025
Merged
FTI - Camera2D accepts resets only after entering tree#112810Repiteo merged 1 commit intogodotengine:masterfrom
FTI - Camera2D accepts resets only after entering tree#112810Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
akien-mga
approved these changes
Nov 25, 2025
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #112689
#111384 introduced a warning when calling
Camera2D::get_camera_transform()before the camera viewports had been set up inNOTIFICATION_ENTER_TREE.This flagged a benign warning when using physics interpolation on
Camera2D, because it inherits a standard reset fromCanvasItemwhich is called beforeCamera2DNOTIFICATION_ENTER_TREE.Here we use a simple approach to fix the warning, by adding a state flag of whether to accept resets, and set to true after setup, and set to false when exiting the tree.
Notes
Camera2Dwhen using a custom viewport #111384. Although it's fairly easy to workaround here, and it is possible the warning might catch bugs.Camera2Dat the end ofNOTIFICATION_ENTER_TREE(and a comment to that effect), so this warning is purely cosmetic.Discussion
As noted in the issue, this is caused by the
CanvasItemNOTIFICATION_ENTER_TREEbeing called before theCamera2D, so the resets can't depend on any state set up in derived classes, which isn't ideal, but thus far this hasn't been a significant problem - most classes xforms are up to date by this point.An alternative we sometimes use is to defer resets, but this has the potential to cause knock on bugs particularly with moving and standing starts with manual resets from script, so on balance it would be nice to avoid this bug potential and keep a local solution, at least for now. If we get any later similar issues we can re-evaluate this.