[Bf-extensions-cvs] [665a82e1] master: glTF exporter: add an export identifier

Julien Duroure noreply at git.blender.org
Thu Dec 22 07:14:24 CET 2022


Commit: 665a82e17100e4560ea0ef55a51f8721c670c936
Author: Julien Duroure
Date:   Thu Dec 22 07:13:41 2022 +0100
Branches: master
https://developer.blender.org/rBA665a82e17100e4560ea0ef55a51f8721c670c936

glTF exporter: add an export identifier

Can be useful in case of other addons that call glTF exporter by code, and using some Extension.
To avoid having an impact on regular glTF exporter, dev can now call the glTF exporter with 'gltf_exporter_id',
and using it in export_settings to check if we are coming from an addon or, if empty, from a regular export

===================================================================

M	io_scene_gltf2/__init__.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index a643f31c..234926a2 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -4,7 +4,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (3, 5, 9),
+    "version": (3, 5, 10),
     'blender': (3, 4, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
@@ -121,6 +121,16 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
 
     bl_options = {'PRESET'}
 
+    # Don't use export_ prefix here, I don't want it to be saved with other export settings
+    gltf_export_id: StringProperty(
+        name='Identifier',
+        description=(
+            'Identifier of caller (in case of addon calling this exporter. '
+            'Can be useful in case of Extension added by other addons'
+        ),
+        default=''
+    )
+
     export_format: EnumProperty(
         name='Format',
         items=(('GLB', 'glTF Binary (.glb)',
@@ -568,7 +578,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
         export_settings = {}
 
         export_settings['timestamp'] = datetime.datetime.now()
-
+        export_settings['gltf_export_id'] = self.gltf_export_id
         export_settings['gltf_filepath'] = self.filepath
         export_settings['gltf_filedirectory'] = os.path.dirname(export_settings['gltf_filepath']) + '/'
         export_settings['gltf_texturedirectory'] = os.path.join(



More information about the Bf-extensions-cvs mailing list