-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
fix: Bug in loading SVG though a spritesheet #10604
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6b41d1e:
|
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.
Would it be possible to add a simple test for this?
asset.data = asset.data ?? this.config; | ||
if (asset.data.parseAsGraphicsContext) |
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.
Small suggestion to keep asset immutable.
asset.data = asset.data ?? this.config; | |
if (asset.data.parseAsGraphicsContext) | |
const data = asset.data ?? this.config; | |
if (data.parseAsGraphicsContext) |
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.
then if would fail in loadAsTexture()
line 124 same file. For some reason asset.data
is not set when loading an svg through a spritesheet (if i load the same svg file using await Asset.load("svgfile.svg")
asset.data is there). I dont think adding this would break anything (it's just meta data).
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.
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.
then if would fail in
loadAsTexture()
line 124 same file. For some reasonasset.data
is not set when loading an svg through a spritesheet (if i load the same svg file usingawait Asset.load("svgfile.svg")
asset.data is there). I dont think adding this would break anything (it's just meta data).
pixijs/src/assets/loader/Loader.ts
Line 111 in 54029ce
asset = await parser.load(url, data, this); |
this line does not add data to asset for some reason
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.
If we need to reassign asset.data
it means there's likely some other problem upstream from this.
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.
Small suggestion to keep asset immutable.
done
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.
@bigtimebuddy let me know if this looks good
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.
@bigtimebuddy added a test case, but i can't run them so not sure if it's correct (it looks like it should pass)
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 34276d7:
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 150deeb:
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ab07198:
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 29c3727:
|
Thanks for the test case. I talked with @Zyie about this earlier and we agreed that there is something upstream that needs to be fixed. |
I think we just need to call this at some point upstream (maybe right before the parser.load??). This is from |
any updates on this @bigtimebuddy @Zyie |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit dbdf200:
|
@bigtimebuddy @Zyie fixed upsteam |
Closing this in favor of #10694 as it more directly fixes the issue, but thank you for pointing me in the right direction! |
Description of change
Fixed a bug where
asset.data
was undefined when loading a spritesheet which links to an svg as such(spritessheet.json)
Pre-Merge Checklist
npm run lint
)npm run test
)