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.48k stars 316 forks source link

Request for `post_gather_gltf_hook` #2284

Open marwie opened 1 month ago

marwie commented 1 month ago

Is your feature request related to a problem? Please describe. I'd like to be able to add extra materials to the exported glTF only if a material was not already exported. For this I need a hook that runs after all scenes have been exported to be able to call gather_material from my extension.

Calling gather_material earlier during the export process will possibly result in a material being exported multiple times if any other object in the scene is using the material

Describe the solution you'd like An extra hook (post_gather_gltf_hook) that would run at the end of __gather_gltf after all materials, images, nodes etc have been added

Another option/question: should maybe gather_materials keep track of the blender materials that have been exported before and return the already created gltf_material if it's called again? Is this not also an issue in the KHR_variants extension?

Describe alternatives you've considered

Additional context This is for the Needle Engine exporter addon