[Bf-extensions-cvs] [4ef5cd10] blender-v2.83-release: glTF exporter: do not raise error when some not known properties are animated

Julien Duroure noreply at git.blender.org
Sat Apr 18 09:30:42 CEST 2020


Commit: 4ef5cd10f6895fbee5704d088fdbc493c0874dd9
Author: Julien Duroure
Date:   Sat Apr 18 09:29:51 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBA4ef5cd10f6895fbee5704d088fdbc493c0874dd9

glTF exporter: do not raise error when some not known properties are animated

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channel_target.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index df89d6e6..ea3aa8ae 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 2, 66),
+    "version": (1, 2, 67),
     'blender': (2, 83, 9),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channel_target.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channel_target.py
index 6edf52cc..488f09ea 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channel_target.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channel_target.py
@@ -122,6 +122,6 @@ def __gather_path(channels: typing.Tuple[bpy.types.FCurve],
     }.get(target)
 
     if target is None:
-        raise RuntimeError("Cannot export an animation with {} target".format(target))
+        return None
 
     return path
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
index 6868047e..cf23ead1 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
@@ -191,25 +191,28 @@ def __gather_animation_channel(channels: typing.Tuple[bpy.types.FCurve],
     if not __filter_animation_channel(channels, blender_object, export_settings):
         return None
 
-    animation_channel = gltf2_io.AnimationChannel(
-        extensions=__gather_extensions(channels, blender_object, export_settings, bake_bone),
-        extras=__gather_extras(channels, blender_object, export_settings, bake_bone),
-        sampler=__gather_sampler(channels, blender_object, export_settings, bake_bone, bake_channel, bake_range_start, bake_range_end, action_name, driver_obj),
-        target=__gather_target(channels, blender_object, export_settings, bake_bone, bake_channel, driver_obj)
-    )
+    __target= __gather_target(channels, blender_object, export_settings, bake_bone, bake_channel, driver_obj)
+    if __target.path is not None:
+        animation_channel = gltf2_io.AnimationChannel(
+            extensions=__gather_extensions(channels, blender_object, export_settings, bake_bone),
+            extras=__gather_extras(channels, blender_object, export_settings, bake_bone),
+            sampler=__gather_sampler(channels, blender_object, export_settings, bake_bone, bake_channel, bake_range_start, bake_range_end, action_name, driver_obj),
+            target=__target
+        )
+
+        export_user_extensions('gather_animation_channel_hook',
+                               export_settings,
+                               animation_channel,
+                               channels,
+                               blender_object,
+                               bake_bone,
+                               bake_channel,
+                               bake_range_start,
+                               bake_range_end,
+                               action_name)
 
-    export_user_extensions('gather_animation_channel_hook',
-                           export_settings,
-                           animation_channel,
-                           channels,
-                           blender_object,
-                           bake_bone,
-                           bake_channel,
-                           bake_range_start,
-                           bake_range_end,
-                           action_name)
-
-    return animation_channel
+        return animation_channel
+    return None
 
 
 def __filter_animation_channel(channels: typing.Tuple[bpy.types.FCurve],



More information about the Bf-extensions-cvs mailing list