Skip to content

Instantly share code, notes, and snippets.

View PeterDrakeNichols's full-sized avatar

Pete PeterDrakeNichols

View GitHub Profile
@PeterDrakeNichols
PeterDrakeNichols / jntInterpWdgt.py
Created September 12, 2017 08:33
WIP joint interpolater driver widget
import maya.cmds as mc
from functools import partial
def createWindow():
if len(mc.ls(sl=1)) is 2:
selSource = mc.ls(sl=1)[0]
selTarget = mc.ls(sl=1)[1]
else:
selSource = selTarget = 'nothing selected'
windowName = 'Pose Driver Widget'
@PeterDrakeNichols
PeterDrakeNichols / makeSplineStretchy.py
Last active October 31, 2017 04:51
makes a spline ik setup stretchy
import maya.cmds as mc
def makeSplineStretchy(chainJoints,chainCurve,stretchAxis = 'X'):
chainCurveShape = mc.listRelatives(chainCurve, shapes=1)[0]
lengthNode = mc.createNode('curveInfo', n = chainCurve + '_length')
mc.connectAttr(chainCurveShape + '.worldSpace[0]', lengthNode + '.inputCurve')
restLength = mc.getAttr(lengthNode + '.arcLength')
multiNode = mc.createNode('multiplyDivide', n= chainCurve + '_multiDiv' )
mc.connectAttr(lengthNode + '.arcLength', multiNode + '.input1X')
mc.setAttr(multiNode + '.input2X', restLength)
mc.setAttr(multiNode + '.operation', 2)
"""
curves @ utils
parses paths to curve.mb's from assets/crvSrc folder
EXAMPLES:
#imports the first curve in crvSrc folder
mc.file(rigLib.utils.curves.curvesList[0], i=1)
#prints a list of curves in crvSrc folder