Exporting GLTF/GLB With Extra Data

Hello!

I am currently working on a project that requires my team and I to insert some metadata into the "extras" section of the GLTF. We were able to find a way to do this by altering the RWGltfCafWriter.cxx file but we know that's not a scalable solution.

Our solution utilized the RWGltf_GltfOStreamWriter myWriter to insert keys and values into the extra data.

Is there a way to do this without altering core files?

We have searched for functionality that would allow us to intercept the GLTF conversion process but have not found such functionality. Since the myWriter is protected, we also can't access the RapidJson stream.

Where we could post-modify the file, our solution becomes much cleaner when we have access to the writer at execution.

Our process takes a Step file and converts it into a GLTF, there is valuable data in the step files that we need available in the GLTF, thus the above request.

Thank you!

gkv311 n's picture

For the moment, RWGltf_CafWriter will write "extras" within "asset" section of the file (e.g. as metadata for entire file) when 'file info' string-string map is passed to Perform() method.

For writing some metadata within node elements (if this is what you are talking about), the glTF writer has to be improved. Note that XCAF document stores such metadata in form of 'named data' attributes, so that glTF writer would better fetch information from there.

The way how to store metadata within glTF file is unclear, though. "extras" sections looks like the most simplest approach, but with unclear compatibility across readers and writers. There are also cumbersome extensions like KHR_xmp and its successor KHR_xmp_json_ld, which are rather more complex to implement.

Dmitrii Pasukhin's picture

Hello, gltf metadata export is planned for 7.9 release. But it will be available in one of the master version.
Best regards, Dmitrii.

Jonathyn Major's picture

Thank you for your response. Do you know when this will be available in master version?

Regards,
Jonathyn

Dmitrii Pasukhin's picture

It depends on a lot of factors. But estimated date is 2 quarter. We plan to start that after 7.8.1 release.

Best regards, Dmitrii.

Dmitrii Pasukhin's picture

If you have another needs, please share with us:

https://dev.opencascade.org/content/shape-future-occt-your-opinion-matters

Best regards, Dmitrii.

Dmitrii Pasukhin's picture

Currently I can't help with partial implementation of metadata export/import. 7.8. OCCT doesn't support gltf metadata processing. STep will support metadata importbin 7.8.1

Best regards, Dmitrii.