Don't redraw Sprite3D/AnimatedSprite3D outside the tree#112593
Merged
akien-mga merged 1 commit intogodotengine:masterfrom Nov 26, 2025
Merged
Don't redraw Sprite3D/AnimatedSprite3D outside the tree#112593akien-mga merged 1 commit intogodotengine:masterfrom
Sprite3D/AnimatedSprite3D outside the tree#112593akien-mga merged 1 commit intogodotengine:masterfrom
Conversation
da51142 to
96332f1
Compare
Sprite3D/AnimatedSprite3D redrawing when not inside the treeSprite3D/AnimatedSprite3D outside the tree
akien-mga
approved these changes
Nov 26, 2025
Member
|
Thanks! |
Member
|
Cherry-picked for 4.5.2. |
This was referenced Jan 16, 2026
Member
Author
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 #112566.
Ensures
SpriteBase3D::parent_spriteis set onNOTIFICATION_PARENTED/NOTIFICATION_UNPARENTEDinstead of onNOTIFICATION_ENTER_TREE/NOTIFICATION_EXIT_TREE. This was already enough to fix #112566 as the bug happened becauseSpriteBase3D::_draw()was called before the sprites entered the tree:MessageQueuewas flushed before entering the tree, during physics processing (it's irrelevant where exactly),MessageQueue/call_defferedcalls).Moreover, after the above there was another redraw triggered, as on
NOTIFICATION_ENTER_TREEit would update/redraw immediately in case no redraw is enqueued, which was the case when reloading the scene (the another redraw would use wrong cumulated-color for the child sprite).Redrawing being triggered when outside the tree seems pointless to me. 🤔
Hence I've made it not update when outside the tree, and update immediately on entering the tree. This makes e.g. on reloading the scene as in the MRP from #112566 the
SpriteBase3D::_draw()be called only once per Sprite3D (instead of twice, including the first one outside the tree).