glTF importer: fix shapekey import with negative weight
This commit is contained in:
parent
7521a4e27b
commit
0dc2141207
|
@ -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": (1, 6, 12),
|
||||
"version": (1, 6, 13),
|
||||
'blender': (2, 91, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue