KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.46k stars 308 forks source link

glTF export removes XMP extension #2149

Open madjin opened 4 months ago

madjin commented 4 months ago

Describe the bug When I import a glTF file with metadata provided by KHR_xmp_json_ld, then export without changing anything else, the model loses the metadata information

To Reproduce Steps to reproduce the behavior:

  1. Import 1.glb to blender (model that has XMP metadata information encoded inside)
  2. Export 1.glb from blender
  3. Test with https://madjin.github.io/glTF-Compressor/ or https://gltf-viewer.donmccurdy.com/
  4. See error (no XMP information)

Expected behavior Metadata information does not get lost between import / export

Screenshots image

.blend file/ .gltf (mandatory) 1.glb.zip Model with xmp information

Version

Additional context There's no way to even inspect metadata for imported glTF files either

donmccurdy commented 4 months ago

Note that Blender itself has no concept of XMP metadata, and importing a GLB does not retain the entire GLB — it simply "imports" compatible parts of the model into Blender's internal representation, and that is all. The easiest workaround here would be to map XMP metadata into Blender's Custom Properties , but it's definitely not a perfect mapping. Not all XMP metadata will fit, and certainly it would be inconvenient for most users to to edit or inspect XMP metadata jammed into string fields. This also gets tricky if multiple GLBs are imported, and then exported as one GLB... what happens then?

My feeling is that solving this well would require some concept of XMP metadata to exist in Blender itself, which I think is both outside the scope of this addon and unlikely to happen.