diff options
Diffstat (limited to 'io_scene_gltf2/blender')
-rw-r--r-- | io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py | 7 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_node.py | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py index ab324853..19723ed9 100644 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py @@ -83,3 +83,10 @@ class BlenderWeightAnim(): group_name="ShapeKeys", interpolation=animation.samplers[channel.sampler].interpolation, ) + + # Expand weight range if needed + kb = obj.data.shape_keys.key_blocks[kb_name] + min_weight = min(coords[1:2]) + max_weight = max(coords[1:2]) + if min_weight < kb.slider_min: kb.slider_min = min_weight + if max_weight > kb.slider_max: kb.slider_max = max_weight diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_node.py index df59cd06..ef410ad5 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_node.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_node.py @@ -225,7 +225,11 @@ class BlenderNode(): weights = pynode.weights or pymesh.weights or [] for i, weight in enumerate(weights): if pymesh.shapekey_names[i] is not None: - obj.data.shape_keys.key_blocks[pymesh.shapekey_names[i]].value = weight + kb = obj.data.shape_keys.key_blocks[pymesh.shapekey_names[i]] + # extend range if needed + if weight < kb.slider_min: kb.slider_min = weight + if weight > kb.slider_max: kb.slider_max = weight + kb.value = weight @staticmethod def setup_skinning(gltf, pynode, obj): |