Skip to content

Instantly share code, notes, and snippets.

@mclavan
Created June 13, 2021 00:36
Show Gist options
  • Save mclavan/da7336c3f6fe11aca5c36873f9134b97 to your computer and use it in GitHub Desktop.
Save mclavan/da7336c3f6fe11aca5c36873f9134b97 to your computer and use it in GitHub Desktop.
coding session 6/12/21 part 2
import pymel.core as pm
ori = ['lt', 'rt']
name = ['index', 'ring', 'middle', 'pinky']
finger_name = 'lt_index_01_bind'
hand_icon = 'lt_hand_icon'
ori = 'rt'
name = 'index'
# split "python string methods"
pieces = finger_name.split('_') # ['lt', 'index', '01', 'bind']
ori = pieces[0]
name = pieces[1]
curlValue = -80
defaultValue = 0
higherExtentValue = 30
minValue = -10
maxValue = 10
# setDrivenKeyframe -currentDriver lt_hand_icon.index_curl lt_index_01_bind.rotateZ;
pm.setDrivenKeyframe(['{0}_{1}_01_bind.rotateZ'.format(ori, name)], value=-80, currentDriver='lt_hand_icon.index_curl', driverValue=10)
pm.setDrivenKeyframe(['{0}_{1}_01_bind.rotateZ'.format(ori, name)], value=0, currentDriver='lt_hand_icon.index_curl', driverValue=0)
pm.setDrivenKeyframe(['{0}_{1}_01_bind.rotateZ'.format(ori, name)], value=30, currentDriver='lt_hand_icon.index_curl', driverValue=-10)
pm.setDrivenKeyframe(['{0}_{1}_02_bind.rotateZ'.format(ori, name)], value=-80, currentDriver='lt_hand_icon.index_curl', driverValue=10)
pm.setDrivenKeyframe(['{0}_{1}_02_bind.rotateZ'.format(ori, name)], value=0, currentDriver='lt_hand_icon.index_curl', driverValue=0)
pm.setDrivenKeyframe(['{0}_{1}_02_bind.rotateZ'.format(ori, name)], value=30, currentDriver='lt_hand_icon.index_curl', driverValue=-10)
pm.setDrivenKeyframe(['{0}_{1}_03_bind.rotateZ'.format(ori, name)], value=-80, currentDriver='lt_hand_icon.index_curl', driverValue=10)
pm.setDrivenKeyframe(['{0}_{1}_03_bind.rotateZ'.format(ori, name)], value=0, currentDriver='lt_hand_icon.index_curl', driverValue=0)
pm.setDrivenKeyframe(['{0}_{1}_03_bind.rotateZ'.format(ori, name)], value=30, currentDriver='lt_hand_icon.index_curl', driverValue=-10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment