From 17b737d6c7df32f615c244856676ae0df68c0692 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Wed, 16 Oct 2024 17:48:41 +0200 Subject: [PATCH 1/2] Fix #2374 - fix indentation --- .../blender/exp/animation/scene_animation.py | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/addons/io_scene_gltf2/blender/exp/animation/scene_animation.py b/addons/io_scene_gltf2/blender/exp/animation/scene_animation.py index d1d00ad56..3976a906e 100644 --- a/addons/io_scene_gltf2/blender/exp/animation/scene_animation.py +++ b/addons/io_scene_gltf2/blender/exp/animation/scene_animation.py @@ -158,67 +158,67 @@ def gather_scene_animations(export_settings): total_channels = [] - # Export now KHR_animation_pointer for lights - for light in export_settings['KHR_animation_pointer']['lights'].keys(): - if len(export_settings['KHR_animation_pointer']['lights'][light]['paths']) == 0: - continue - - blender_light = [l for l in bpy.data.lights if id(l) == light][0] - - export_settings['ranges'][id(blender_light)] = {} - export_settings['ranges'][id(blender_light)][id(blender_light)] = {'start': start_frame, 'end': end_frame} - - if export_settings['gltf_anim_slide_to_zero'] is True and start_frame > 0: - add_slide_data(start_frame, light, light, export_settings, add_drivers=False) + # Export now KHR_animation_pointer for lights + for light in export_settings['KHR_animation_pointer']['lights'].keys(): + if len(export_settings['KHR_animation_pointer']['lights'][light]['paths']) == 0: + continue - channels = gather_data_sampled_channels('lights', light, light, None, export_settings) - if channels is not None: - total_channels.extend(channels) + blender_light = [l for l in bpy.data.lights if id(l) == light][0] - if export_settings['gltf_anim_scene_split_object'] is True: - if len(total_channels) > 0: - animation = gltf2_io.Animation( - channels=total_channels, - extensions=None, - extras=__gather_extras(blender_light, export_settings), - name=blender_light.name, - samplers=[] - ) - link_samplers(animation, export_settings) - animations.append(animation) + export_settings['ranges'][id(blender_light)] = {} + export_settings['ranges'][id(blender_light)][id(blender_light)] = {'start': start_frame, 'end': end_frame} - total_channels = [] + if export_settings['gltf_anim_slide_to_zero'] is True and start_frame > 0: + add_slide_data(start_frame, light, light, export_settings, add_drivers=False) - # Export now KHR_animation_pointer for cameras - for cam in export_settings['KHR_animation_pointer']['cameras'].keys(): - if len(export_settings['KHR_animation_pointer']['cameras'][cam]['paths']) == 0: - continue + channels = gather_data_sampled_channels('lights', light, light, None, export_settings) + if channels is not None: + total_channels.extend(channels) - blender_camera = [l for l in bpy.data.cameras if id(l) == cam][0] + if export_settings['gltf_anim_scene_split_object'] is True: + if len(total_channels) > 0: + animation = gltf2_io.Animation( + channels=total_channels, + extensions=None, + extras=__gather_extras(blender_light, export_settings), + name=blender_light.name, + samplers=[] + ) + link_samplers(animation, export_settings) + animations.append(animation) + + total_channels = [] + + # Export now KHR_animation_pointer for cameras + for cam in export_settings['KHR_animation_pointer']['cameras'].keys(): + if len(export_settings['KHR_animation_pointer']['cameras'][cam]['paths']) == 0: + continue - export_settings['ranges'][id(blender_camera)] = {} - export_settings['ranges'][id(blender_camera)][id(blender_camera)] = {'start': start_frame, 'end': end_frame} + blender_camera = [l for l in bpy.data.cameras if id(l) == cam][0] - if export_settings['gltf_anim_slide_to_zero'] is True and start_frame > 0: - add_slide_data(start_frame, cam, cam, export_settings, add_drivers=False) + export_settings['ranges'][id(blender_camera)] = {} + export_settings['ranges'][id(blender_camera)][id(blender_camera)] = {'start': start_frame, 'end': end_frame} - channels = gather_data_sampled_channels('cameras', cam, cam, None, export_settings) - if channels is not None: - total_channels.extend(channels) + if export_settings['gltf_anim_slide_to_zero'] is True and start_frame > 0: + add_slide_data(start_frame, cam, cam, export_settings, add_drivers=False) - if export_settings['gltf_anim_scene_split_object'] is True: - if len(total_channels) > 0: - animation = gltf2_io.Animation( - channels=total_channels, - extensions=None, - extras=__gather_extras(blender_camera, export_settings), - name=blender_camera.name, - samplers=[] - ) - link_samplers(animation, export_settings) - animations.append(animation) + channels = gather_data_sampled_channels('cameras', cam, cam, None, export_settings) + if channels is not None: + total_channels.extend(channels) - total_channels = [] + if export_settings['gltf_anim_scene_split_object'] is True: + if len(total_channels) > 0: + animation = gltf2_io.Animation( + channels=total_channels, + extensions=None, + extras=__gather_extras(blender_camera, export_settings), + name=blender_camera.name, + samplers=[] + ) + link_samplers(animation, export_settings) + animations.append(animation) + + total_channels = [] if export_settings['gltf_anim_scene_split_object'] is False: if len(total_channels) > 0: From 2a194b2258c88183507ab7487ef703c010570002 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Thu, 31 Oct 2024 14:16:06 +0100 Subject: [PATCH 2/2] Bump to 4.3.44 --- addons/io_scene_gltf2/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/io_scene_gltf2/__init__.py b/addons/io_scene_gltf2/__init__.py index 6efce0a85..0d3a3abb0 100644 --- a/addons/io_scene_gltf2/__init__.py +++ b/addons/io_scene_gltf2/__init__.py @@ -15,7 +15,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": (4, 3, 43), + "version": (4, 3, 44), 'blender': (4, 3, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0',