-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Allow WriteImageDataFunction() callback to be called with empty images #496
Conversation
Please create PR for each issues(if issues are orthogonal) |
66e9fae
to
a83a16f
Compare
a83a16f
to
fe3cfbe
Compare
@@ -2767,6 +2767,12 @@ bool WriteImageData(const std::string *basepath, const std::string *filename, | |||
const Image *image, bool embedImages, | |||
const FsCallbacks* fs_cb, const URICallbacks *uri_cb, | |||
std::string *out_uri, void *) { | |||
// Early out on empty images, report the original uri if the image was not written. | |||
if (image->image.empty()) { |
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.
With this we keep the previous behaviour, although the callback is now invoked for empty images.
bool imageWritten = false; | ||
if (WriteImageData != nullptr && !filename.empty() && !image.image.empty()) { | ||
if (WriteImageData != nullptr && !filename.empty()) { |
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.
Invoke the callback for empty images
I tailored this branch now to the specific issue, nothing more. Please review. |
You should describe the summary of what this PR is. |
Is it ok to merge now, or am I still missing something? @syoyo ? |
Good! Merged! The description become clear. |
Allow WriteImageDataFunction() callback to be called with empty images.
The motivation on our side is that we want to avoid to load any image data into memory at all, as we have to deal with models that use multiple Gigabytes (compressed size) of textures. Thus we are looking to employ a custom image loader and writer, where the first does not load/decode any image data, and the second is still called for those empty images.