syoyo/tinygltf

Allow saving/serializing a const Model

pknowlesnv opened this issue · 2 comments

TinyGLTF::WriteGltfSceneToFile currently take a non-const Model.

It looks trivially scattering a few 'const' keywords will almost allow a const Model to be saved.

In doing so, see #393, there are a couple of places that cause problems.

  1. The WriteImageDataFunction callback takes a non-const Image and
  2. the default implementation expects to be able to write the written URI back to the source.

This might not be possible to do as it'd break the feature of being able to inspect the image URIs after saving. Is this worth persuing or would it break too much? (feel free to close the pull request if so)

syoyo commented

@pknowlesnv Thanks! Let me give some time to review PR.

The WriteImageDataFunction callback takes a non-const Image

I think I(or contributor) simply forget to add 'const', so const should be added to Image. This won't break the app which uses WriteImageDataFunction so much.

syoyo commented

Closed via #393