[3.x] Sprite3D
/AnimatedSprite3D
Fix drawing AtlasTexture
s with vertical margins differently than in 2D
#66063
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 #63520.
The actual fix is a single line of code added in the second commit, I've explained it in the comments. Exactly what I suggested in #63520 (comment) (took me that long as I somehow forgot about it).
The first commit is moving common/duplicated drawing code from
Sprite3D
/AnimatedSprite3D
toSpriteBase3D
. DrawingSprite3D
/AnimatedSprite3D
is the same besides the part determining what texture and rects to use.If doing so is not desired I guess I can instead just add the exact same changes from the second commit to the
Sprite3D
/AnimatedSprite3D
separately (making the duplicated code even longer). Or if separate PRs are desired I could split that too.BTW currently drawing nested AtlasTextures (an
AtlasTexture
having itsatlas
set to anotherAtlasTexture
) doesn't work forSprite3D
/AnimatedSprite3D
(works for 2D counterparts) so the fix was obviously not tested for such cases. Supporting such nesting is for potential future PRs.Some examples for animated sprites 2D/3D (didn't bother about texture import settings):
SpriteBase3DVerticalMarginBug.zip
(3.5.stable)
(this PR)
MRP from #63520.zip
(3.5.stable)
(this PR)
offset = (30, 150)
(debug border drawn in script)
offset = (30, 150)
(debug border drawn in script)
offset = (30, 100)
(changed by the user to visually match 2D case)
offset = (30, 150)
offset = (30, 150)