Skip to content

Instantly share code, notes, and snippets.

@PeterDrakeNichols
Created September 12, 2017 08:33
Show Gist options
  • Save PeterDrakeNichols/b758533481dada96ef37ca3efef38e2e to your computer and use it in GitHub Desktop.
Save PeterDrakeNichols/b758533481dada96ef37ca3efef38e2e to your computer and use it in GitHub Desktop.
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'
windowSize = (300,200)
if mc.window(windowName, exists=1):
mc.deleteUI(windowName)
window = mc.window(windowName, t=windowName, wh = windowSize)
mc.columnLayout("mainColumn", adjustableColumn = 1)
mc.textFieldGrp( label='Source', text = selSource, ed=1, cl2=('left','left'),adj=1)
mc.textFieldGrp( label='Target', text = selTarget, ed=1, cl2=('left','left'),adj=1)
mc.separator(h=10)
mc.text(l= ' Translate', al = 'left', bgc = (.4, .4, .4), h=20)
mc.gridLayout("tGrid", numberOfRowsColumns = (1,3), cellWidthHeight = (80,20), parent = "mainColumn")
trBoxes = [
mc.checkBox("trx", label = "X ", value = 0, parent = "tGrid"),
mc.checkBox("try", label = "Y ", value = 0, parent = "tGrid"),
mc.checkBox("trz", label = "Z ", value = 0, parent = "tGrid")
]
mc.text(l= ' Rotate', al = 'left', bgc = (.4, .4, .4), h=20, p= 'mainColumn')
mc.gridLayout("rGrid", numberOfRowsColumns = (1,3), cellWidthHeight = (80,20), parent = "mainColumn")
roBoxes = [
mc.checkBox("rox", label = "X ", value = 1, parent = "rGrid"),
mc.checkBox("roy", label = "Y ", value = 1, parent = "rGrid"),
mc.checkBox("roz", label = "Z ", value = 1, parent = "rGrid")
]
mc.separator(h=5, p= 'mainColumn')
mc.button(label = "Connect Driver", p= 'mainColumn', c=partial(getCheckBoxVal,trBoxes,roBoxes))
gMainWindow = maya.mel.eval('$tmpVar=$gMainWindow')
mc.showWindow( window )
def connectVals(*args):
print args
for arg in args:
if isinstance(arg,list):
for cb in range(len(arg)):
print mc.checkBox(arg[cb], q=1, value=1)
else:
continue
createWindow()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment