Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2019-01-09 21:46:45 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-01-09 21:46:45 +0300
commitb410a70fa9ba09bf9c1091d87f38f0ed8dae4895 (patch)
tree1d29e31952f861dbf02f8433f6e6861f5607f587 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
parent52111c31d7d0d39893b11a5242cbfe2bfbda0d12 (diff)
glTF export: enhancement & fixes:
* implement KHR_materials_unlit export * Fix primitive restart values * Fix jpg uri/mime type * Fix bug when image has no color channels * Check animation has actions * Ignore meshes without primitives * Fix materials when not selected in export settings * Improve error message for invalid animation target type * Animation with errors are ignored, but export continues * Export of BaseColorFactor
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
index bfbc03ed..7a7cda02 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -17,6 +17,7 @@ import typing
from io_scene_gltf2.io.com import gltf2_io
from io_scene_gltf2.blender.exp import gltf2_blender_gather_animation_channels
+from io_scene_gltf2.io.com.gltf2_io_debug import print_console
def gather_animations(blender_object: bpy.types.Object, export_settings) -> typing.List[gltf2_io.Animation]:
@@ -48,13 +49,18 @@ def __gather_animation(blender_action: bpy.types.Action,
if not __filter_animation(blender_action, blender_object, export_settings):
return None
- animation = gltf2_io.Animation(
- channels=__gather_channels(blender_action, blender_object, export_settings),
- extensions=__gather_extensions(blender_action, blender_object, export_settings),
- extras=__gather_extras(blender_action, blender_object, export_settings),
- name=__gather_name(blender_action, blender_object, export_settings),
- samplers=__gather_samplers(blender_action, blender_object, export_settings)
- )
+ name = __gather_name(blender_action, blender_object, export_settings)
+ try:
+ animation = gltf2_io.Animation(
+ channels=__gather_channels(blender_action, blender_object, export_settings),
+ extensions=__gather_extensions(blender_action, blender_object, export_settings),
+ extras=__gather_extras(blender_action, blender_object, export_settings),
+ name=name,
+ samplers=__gather_samplers(blender_action, blender_object, export_settings)
+ )
+ except RuntimeError as error:
+ print_console("WARNING", "Animation '{}' could not be exported. Cause: {}".format(name, error))
+ return None
# To allow reuse of samplers in one animation,
__link_samplers(animation, export_settings)
@@ -159,7 +165,8 @@ def __get_blender_actions(blender_object: bpy.types.Object
if blender_object.type == "MESH" \
and blender_object.data is not None \
and blender_object.data.shape_keys is not None \
- and blender_object.data.shape_keys.animation_data is not None:
+ and blender_object.data.shape_keys.animation_data is not None \
+ and blender_object.data.shape_keys.animation_data.action is not None:
blender_actions.append(blender_object.data.shape_keys.animation_data.action)
# Remove duplicate actions.