diff options
author | Peter Kim <pk15950@gmail.com> | 2022-02-23 10:49:58 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2022-02-23 10:49:58 +0300 |
commit | a481fe51927258b391eb37f1847ab8ef4a175d3c (patch) | |
tree | b35679cec5e94c1b653b315877126a471b124ca1 | |
parent | 43b98b1c5fcd36355c00d75a27dc8bdb23ad285f (diff) | |
parent | 593c699b2a50213263e706d34753a9e25ac1a26f (diff) |
Merge branch 'master' into xr-dev
-rw-r--r-- | add_curve_sapling/__init__.py | 5 | ||||
-rwxr-xr-x | io_scene_gltf2/__init__.py | 14 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py | 1 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py | 3 |
4 files changed, 21 insertions, 2 deletions
diff --git a/add_curve_sapling/__init__.py b/add_curve_sapling/__init__.py index 585bd50e..bead5ee7 100644 --- a/add_curve_sapling/__init__.py +++ b/add_curve_sapling/__init__.py @@ -182,7 +182,10 @@ class ImportData(Operator): f = open(os.path.join(getPresetpaths()[0], self.filename), 'r') except (FileNotFoundError, IOError): f = open(os.path.join(getPresetpaths()[1], self.filename), 'r') - settings = f.readline() + # Find the first non-comment, non-blank line, this must contain preset text (all on one line). + for settings in f: + if settings and (not settings.startswith("#")): + break f.close() # print(settings) settings = ast.literal_eval(settings) diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index 1c717016..a672be22 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, 2, 6), + "version": (3, 2, 7), 'blender': (3, 1, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', @@ -379,6 +379,15 @@ class ExportGLTF2_Base: default=False ) + optimize_animation_size: BoolProperty( + name='Optimize Animation Size', + description=( + "Reduces exported filesize by removing duplicate keyframes" + "Can cause problems with stepped animation" + ), + default=True + ) + export_current_frame: BoolProperty( name='Use Current Frame', description='Export the scene in the current animation frame', @@ -571,11 +580,13 @@ class ExportGLTF2_Base: else: export_settings['gltf_def_bones'] = False export_settings['gltf_nla_strips'] = self.export_nla_strips + export_settings['gltf_optimize_animation'] = self.optimize_animation_size else: export_settings['gltf_frame_range'] = False export_settings['gltf_move_keyframes'] = False export_settings['gltf_force_sampling'] = False export_settings['gltf_def_bones'] = False + export_settings['gltf_optimize_animation'] = False export_settings['gltf_skins'] = self.export_skins if self.export_skins: export_settings['gltf_all_vertex_influences'] = self.export_all_influences @@ -863,6 +874,7 @@ class GLTF_PT_export_animation_export(bpy.types.Panel): layout.prop(operator, 'export_frame_step') layout.prop(operator, 'export_force_sampling') layout.prop(operator, 'export_nla_strips') + layout.prop(operator, 'optimize_animation_size') row = layout.row() row.active = operator.export_force_sampling diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py b/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py index 732d77e6..61a9f5bf 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py @@ -46,6 +46,7 @@ EMBED_IMAGES = 'gltf_embed_images' BINARY = 'gltf_binary' EMBED_BUFFERS = 'gltf_embed_buffers' USE_NO_COLOR = 'gltf_use_no_color' +OPTIMIZE_ANIMS = 'gltf_optimize_animation' METALLIC_ROUGHNESS_IMAGE = "metallic_roughness_image" GROUP_INDEX = 'group_index' diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py index e138e26a..d24db395 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py @@ -306,6 +306,9 @@ def gather_keyframes(blender_object_if_armature: typing.Optional[bpy.types.Objec keyframes.append(key) + if not export_settings[gltf2_blender_export_keys.OPTIMIZE_ANIMS]: + return keyframes + # For armature only # Check if all values are the same # In that case, if there is no real keyframe on this channel for this given bone, |