[Bf-extensions-cvs] [946ad9c4] master: curve_assign_shapekey: Fix for condition where target has existing shapekeys and basis shape key is different than curve
Shrinivas Kulkarni
noreply at git.blender.org
Fri Jan 17 15:56:15 CET 2020
Commit: 946ad9c4fa5c0351b5cf1d7733cd28410513b97e
Author: Shrinivas Kulkarni
Date: Fri Jan 17 20:25:19 2020 +0530
Branches: master
https://developer.blender.org/rBA946ad9c4fa5c0351b5cf1d7733cd28410513b97e
curve_assign_shapekey: Fix for condition where target has existing shapekeys and basis shape key is different than curve
===================================================================
M curve_assign_shapekey.py
===================================================================
diff --git a/curve_assign_shapekey.py b/curve_assign_shapekey.py
index f6f18500..f9d8b501 100644
--- a/curve_assign_shapekey.py
+++ b/curve_assign_shapekey.py
@@ -407,7 +407,8 @@ def main(targetObj, shapekeyObjs, removeOriginal, space, matchParts, \
shapekeys = [Path(c) for c in shapekeyObjs]
- shapekeys = getExistingShapeKeyPaths(target) + shapekeys
+ existingKeys = getExistingShapeKeyPaths(target)
+ shapekeys = existingKeys + shapekeys
userSel = [target] + shapekeys
for path in userSel:
@@ -431,13 +432,10 @@ def main(targetObj, shapekeyObjs, removeOriginal, space, matchParts, \
for j, part in enumerate(path.parts):
part.toClose = allToClose[j]
- if(targetObj.data.shape_keys != None):
- skName = targetObj.data.shape_keys.key_blocks[0].name
- else:
- skName = 'Basis'
-
target.updateCurve()
- target.curve.shape_key_add(name = skName)
+
+ if(len(existingKeys) == 0):
+ target.curve.shape_key_add(name = 'Basis')
addShapeKeys(target.curve, shapekeys, space)
@@ -714,7 +712,7 @@ def getExistingShapeKeyPaths(path):
paths = []
if(obj.data.shape_keys != None):
- keyblocks = obj.data.shape_keys.key_blocks[1:]#Skip basis
+ keyblocks = obj.data.shape_keys.key_blocks[:]
for key in keyblocks:
datacopy = obj.data.copy()
i = 0
More information about the Bf-extensions-cvs
mailing list