-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
USDZExporter: Throw exception when processing textures with no image data. #25093
Conversation
This is worse than before now. Without knowing what data that single pixel should contain it's very easy to get entirely broken results and no way for users to see that. Either correct results should be exported or nothing, not knowingly broken results. |
If @mrdoob is okay then I just throw an exception when no image data are available (which of course aborts the export). |
I've added a new commit so the exporter throws an exception now. There is now one commit for each approach (warning or abort) so it's easier to review the PR. |
Throwing an error sounds good to me 👍 |
I suggest to reconsider this in favor of just logging a warning -- because missing image data isn't an error of such kind that should abort export and forbid it. |
The app has full access on the asset before it is being exported so a comparison to how loaders work isn't valid. The issue is that problems in the asset like invalid texture data should be fixed before the export happens and throwing an error is the most effective way to ensure proper exported data. |
Of the two choices, I would also prefer throwing an error. Applications cannot see console warnings, but may need to handle this case. Some libraries balance these needs by allowing the user to provide a logger. For example: exporter.setLogger({
warn: (message) => {
throw new Error(message);
},
...
}); This can be helpful to increase error severity, to display the errors somewhere other than a JS console, etc. |
Related issue: #25022 (comment)
Description
USDZExporter
reports a warning now when users try to export an asset with textures holding no image data (image=null
).