- object.add_shape_key(name="Key", from_mix=True)
[blender.git] / release / scripts / op / object.py
index e093460ab3166a00b5c5f5d5bb5a0c5c45154a7f..5e261c18c237a242b93637b4a1e68c32934537b6 100644 (file)
@@ -170,7 +170,6 @@ class ShapeTransfer(bpy.types.Operator):
                 default=False)
 
     def _main(self, ob_act, objects, mode='OFFSET', use_clamp=False):
-
         def me_nos(verts):
             return [v.normal.copy() for v in verts]
 
@@ -178,11 +177,10 @@ class ShapeTransfer(bpy.types.Operator):
             return [v.co.copy() for v in verts]
 
         def ob_add_shape(ob):
-            C_tmp = {"object": ob}
             me = ob.data
-            if me.shape_keys is None: # add basis
-                bpy.ops.object.shape_key_add(C_tmp)
-            bpy.ops.object.shape_key_add(C_tmp)
+            ob.add_shape_key(from_mix=False)
+            if len(me.shape_keys.keys) == 1:
+                ob.add_shape_key(from_mix=False) # we need a rest
             ob.active_shape_key_index = len(me.shape_keys.keys) - 1
             ob.shape_key_lock = True