From d861989b0a45cf4d18cbcf796f72668262adf80d Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Tue, 15 Oct 2024 21:23:23 +0200 Subject: [PATCH] Fix #2374 - fix wrong indentation --- .../blender/exp/animation/scene_animation.py | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 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 f47f383d1..b4b68916c 100644 --- a/addons/io_scene_gltf2/blender/exp/animation/scene_animation.py +++ b/addons/io_scene_gltf2/blender/exp/animation/scene_animation.py @@ -155,82 +155,82 @@ 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 + # 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] + 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} + 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) + 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) - channels = gather_data_sampled_channels('lights', light, light, None, export_settings) - if channels is not None: - total_channels.extend(channels) + channels = gather_data_sampled_channels('lights', light, light, None, export_settings) + if channels is not None: + total_channels.extend(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_light, export_settings), - name=blender_light.name, - samplers=[] - ) - link_samplers(animation, export_settings) - animations.append(animation) + 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 = [] + 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 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 - blender_camera = [l for l in bpy.data.cameras if id(l) == cam][0] + blender_camera = [l for l in bpy.data.cameras if id(l) == cam][0] - export_settings['ranges'][id(blender_camera)] = {} - export_settings['ranges'][id(blender_camera)][id(blender_camera)] = {'start': start_frame, 'end': end_frame} + export_settings['ranges'][id(blender_camera)] = {} + export_settings['ranges'][id(blender_camera)][id(blender_camera)] = {'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, cam, cam, export_settings, add_drivers=False) + 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) - channels = gather_data_sampled_channels('cameras', cam, cam, None, export_settings) - if channels is not None: - total_channels.extend(channels) + 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_scene_split_object'] is True: + 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: animation = gltf2_io.Animation( channels=total_channels, extensions=None, - extras=__gather_extras(blender_camera, export_settings), - name=blender_camera.name, + extras=__gather_extras(bpy.context.scene, export_settings), + name=bpy.context.scene.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: - animation = gltf2_io.Animation( - channels=total_channels, - extensions=None, - extras=__gather_extras(bpy.context.scene, export_settings), - name=bpy.context.scene.name, - samplers=[] - ) - link_samplers(animation, export_settings) - animations.append(animation) - return animations def __gather_extras(blender_asset, export_settings):