Fix #137: Shape keys start with 1.0 value on PSK import
There was an undocumented change in 5.0 where the shape keys now start with a weight of 1.0 instead of 0.0 when created. I have added an assert in the shape key test to make sure that the values are set to `0.0`. This also fixes the assertion in the poll function (asserts should never be in poll functions).
This commit is contained in:
@@ -13,7 +13,8 @@ from ..reader import PsaReader
|
||||
|
||||
|
||||
def psa_import_poll(cls, context: Context):
|
||||
assert context.view_layer and context.view_layer.objects.active
|
||||
if context.view_layer is None or context.view_layer.objects.active is None:
|
||||
return False
|
||||
active_object = context.view_layer.objects.active
|
||||
if active_object is None or active_object.type != 'ARMATURE':
|
||||
cls.poll_message_set('The active object must be an armature')
|
||||
|
||||
@@ -275,6 +275,7 @@ def import_psk(psk: Psk, context: Context, name: str, options: PskImportOptions)
|
||||
|
||||
for morph_info in psk.morph_infos:
|
||||
shape_key = mesh_object.shape_key_add(name=morph_info.name.decode('windows-1252'), from_mix=False)
|
||||
shape_key.value = 0.0
|
||||
|
||||
for _ in range(morph_info.vertex_count):
|
||||
morph_data = next(morph_data_iterator)
|
||||
|
||||
Reference in New Issue
Block a user