here's the script i wrote in blender 2.79 to animate the shapes:
"""
import bpy
import sys
#example if wanted to test script without addon part. change to your path here
sys.path.append('/Users/Nathaniel/Documents/src_blender/python/riggingTools/faces')
import milesFace as mod
import imp
imp.reload(mod)
mod.animateShapes(bpy.context.object)
#mod.clearAnimationShapes(bpy.context.object)
"""
def animateShapes(meshObj = None):
"""
each shape in 10 frames turns on then off
#first shape use frame 10. 10*1 + 10*0
#0 left
#10 mid on
#20 right
#second shape use frame 30. 10*2 + 10*1
#20 left
#30 mid on
#40 right
#50 10*3+ 10*2
#40 l
#60 r
"""
lenShapeOn = 10
#loop shape keys
for b in range(1,len(meshObj.data.shape_keys.key_blocks)):
cf = 10*b + 10*(b-1)
lf = cf-lenShapeOn
rf = cf+lenShapeOn
keyObj = meshObj.data.shape_keys.key_blocks[b]
#left
keyObj.value = 0
keyObj.keyframe_insert("value",frame=lf)
#right
keyObj.value = 0
keyObj.keyframe_insert("value",frame=rf)
#center
keyObj.value = 1
keyObj.keyframe_insert("value",frame=cf)
def clearAnimationShapes(meshObj = None):
"""clears all keyframes on shapes
"""
meshObj.data.shape_keys.animation_data_clear()
for b in range(1,len(meshObj.data.shape_keys.key_blocks)):
keyObj = meshObj.data.shape_keys.key_blocks[b]
keyObj.value = 0
#inspired by
#https://blenderartists.org/t/deleting-all-keyframes-in-script/514422/2