Skip to content

Instantly share code, notes, and snippets.

@Onefabis
Last active June 28, 2018 23:29
Show Gist options
  • Save Onefabis/2bee4b415ac2849fbf90d30e57b0b117 to your computer and use it in GitHub Desktop.
Save Onefabis/2bee4b415ac2849fbf90d30e57b0b117 to your computer and use it in GitHub Desktop.
'''
To launch the script run the code:
import pickWalker
reload(pickWalker)
pickWalker.pW().ui()
Assign hotkey to walk in up direction
import pickWalker
pickWalker.pW().pickWalk( 'up' )
Assign hotkey to walk in down direction
import pickWalker
pickWalker.pW().pickWalk( 'dn' )
Assign hotkey to walk in left direction
import pickWalker
pickWalker.pW().pickWalk( 'lt' )
Assign hotkey to walk in right direction
import pickWalker
pickWalker.pW().pickWalk( 'rt' )
Assign hotkey to the next pickwalk list
import pickWalker
pickWalker.pW().swintchToNewxList( 'up' )
Assign hotkey to the previous pickwalk list
import pickWalker
pickWalker.pW().swintchToNewxList( 'down' )
'''
import maya.cmds as mc
import re
import json
class pW(object):
def __init__( self ):
pass
#######################################
## UI ##
#######################################
def ui( self ):
global pwDict
self.winName = 'PickWalker'
if mc.window( self.winName, ex=1 ):
mc.deleteUI( self.winName )
pwData = self.getPickWalkInfo()
mainWin = mc.window( self.winName, s=0 )
# Set ui elements
mainLayout = mc.formLayout( p=mainWin )
# Data operate list fields
self.pickWalkDataList = mc.optionMenu( acc=1, cc=lambda *args: self.setCurrentPWData(), h=26, p=mainLayout )
# Set list of all PW names
for k in pwData:
mc.menuItem(l=k)
self.pickCurrentDataListName = mc.textField( ec=lambda *args: self.pwList( 'rename' ), h=27, ebg=1, aie=1, p=mainLayout )
# Data operate list buttons
self.addPWList = mc.button( l='+', bgc=( 0.4, 0.4, 0.4 ), w=25, h=25, ann='Add new pick walk list', c=lambda *args: self.pwList( 'add' ), p=mainLayout )
self.remPWList = mc.button( l='-', bgc=( 0.4, 0.4, 0.4 ), w=25, h=25, ann='Remove new pick walk list', c=lambda *args: self.pwList( 'remove' ), p=mainLayout )
self.dupPWList = mc.button( l='>>', bgc=( 0.4, 0.4, 0.4 ), w=25, h=25, ann='Duplicate new pick walk list', c=lambda *args: self.pwList( 'duplicate' ), p=mainLayout )
# Controller assign/navigate buttons
self.upPW = mc.button( l='Up', bgc=( 0.074, 0.54, 1 ), w=25, h=25, ann='Up pick walk', c=lambda *args: self.pickWalk( 'up' ), p=mainLayout )
self.dnPW = mc.button( l='Dn', bgc=( 0.074, 0.54, 1 ), w=25, h=25, ann='Down pick walk', c=lambda *args: self.pickWalk( 'dn' ), p=mainLayout )
self.ltPW = mc.button( l='Lt', bgc=( 0.074, 0.54, 1 ), w=25, h=25, ann='Left pick walk', c=lambda *args: self.pickWalk( 'lt' ), p=mainLayout )
self.rtPW = mc.button( l='Rt', bgc=( 0.074, 0.54, 1 ), w=25, h=25, ann='Right pick walk', c=lambda *args: self.pickWalk( 'rt' ), p=mainLayout )
# Record mode button
self.recPWMode = mc.button( l='N', bgc=( 0.074, 0.54, 1 ), w=14, h=14, ann='Add new pick walk list', c=lambda *args: self.pickWalkMode( 'rec' ), p=mainLayout )
# Controller assign/navigate buttons
self.exportPW = mc.button( l='E', bgc=( 0.4, 0.4, 0.4 ), w=25, h=25, ann='Export pickwalk data', c=lambda *args: self.exportImport( 'export' ), p=mainLayout )
self.importPW = mc.button( l='I', bgc=( 0.4, 0.4, 0.4 ), w=25, h=25, ann='Import pickwalk data', c=lambda *args: self.exportImport( 'import' ), p=mainLayout )
self.mirrorText = mc.text( l='<|>', h=27, p=mainLayout )
self.mirrorLeftTF = mc.textField( w=42, h=28, cc=lambda *args: self.storeMirror(), ebg=1, aie=1, p=mainLayout )
self.mirrorRightTF = mc.textField( w=42, h=28, cc=lambda *args: self.storeMirror(), ebg=1, aie=1, p=mainLayout )
mc.scriptJob( e=[ "SelectionChanged", self.conctrolCheck ], p='PickWalker' )
# Pick walk elements layout
mc.formLayout( mainLayout, e=1, af=( self.recPWMode, "top", 10 ) )
mc.formLayout( mainLayout, e=1, af=( self.recPWMode, "left", 10 ) )
mc.formLayout( mainLayout, e=1, af=( self.upPW, "top", 10 ) )
mc.formLayout( mainLayout, e=1, ac=( self.upPW, "left", 5, self.ltPW ) )
mc.formLayout( mainLayout, e=1, ac=( self.dnPW, "top", 34, self.upPW ) )
mc.formLayout( mainLayout, e=1, ac=( self.dnPW, "left", 5, self.ltPW ) )
mc.formLayout( mainLayout, e=1, af=( self.ltPW, "top", 40 ) )
mc.formLayout( mainLayout, e=1, af=( self.ltPW, "left", 10 ) )
mc.formLayout( mainLayout, e=1, af=( self.rtPW, "top", 40 ) )
mc.formLayout( mainLayout, e=1, ac=( self.rtPW, "left", 5, self.upPW ) )
mc.formLayout( mainLayout, e=1, af=( self.pickCurrentDataListName, "top", 9 ) )
mc.formLayout( mainLayout, e=1, ac=( self.pickCurrentDataListName, "left", 10, self.rtPW ) )
mc.formLayout( mainLayout, e=1, ac=( self.pickCurrentDataListName, "right", 5, self.addPWList ) )
mc.formLayout( mainLayout, e=1, af=( self.addPWList, "top", 10 ) )
mc.formLayout( mainLayout, e=1, ac=( self.addPWList, "right", 5, self.remPWList ) )
mc.formLayout( mainLayout, e=1, af=( self.remPWList, "top", 10 ) )
mc.formLayout( mainLayout, e=1, ac=( self.remPWList, "right", 5, self.dupPWList ) )
mc.formLayout( mainLayout, e=1, af=( self.dupPWList, "top", 10 ) )
mc.formLayout( mainLayout, e=1, af=( self.dupPWList, "right", 10 ) )
mc.formLayout( mainLayout, e=1, ac=( self.pickWalkDataList, "top", 5, self.pickCurrentDataListName ) )
mc.formLayout( mainLayout, e=1, ac=( self.pickWalkDataList, "left", 9, self.rtPW ) )
mc.formLayout( mainLayout, e=1, af=( self.pickWalkDataList, "right", 10 ) )
mc.formLayout( mainLayout, e=1, ac=( self.exportPW, "top", 5, self.pickWalkDataList ) )
mc.formLayout( mainLayout, e=1, af=( self.exportPW, "right", 10 ) )
mc.formLayout( mainLayout, e=1, ac=( self.importPW, "top", 5, self.pickWalkDataList ) )
mc.formLayout( mainLayout, e=1, ac=( self.importPW, "right", 5, self.exportPW ) )
mc.formLayout( mainLayout, e=1, ac=( self.mirrorLeftTF, "top", 4, self.pickWalkDataList ) )
mc.formLayout( mainLayout, e=1, ac=( self.mirrorLeftTF, "left", 10, self.rtPW) )
mc.formLayout( mainLayout, e=1, ac=( self.mirrorText, "top", 3, self.pickWalkDataList ) )
mc.formLayout( mainLayout, e=1, ac=( self.mirrorText, "left", 5, self.mirrorLeftTF ) )
mc.formLayout( mainLayout, e=1, ac=( self.mirrorRightTF, "top", 4, self.pickWalkDataList ) )
mc.formLayout( mainLayout, e=1, ac=( self.mirrorRightTF, "left", 5, self.mirrorText ) )
mc.showWindow(mainWin)
mc.window( mainWin, e=1, wh=( 287, 108 ) )
if mc.optionVar( ex='pickWalkCurrentList' ):
currentList = mc.optionVar( q='pickWalkCurrentList' )
else:
currentList = None
if mc.optionVar( ex='pickWalkPrefixes' ):
prefixes = mc.optionVar( q='pickWalkPrefixes' )
mc.textField( self.mirrorLeftTF, e=1, tx=prefixes.split( ' ' )[0] )
mc.textField( self.mirrorRightTF, e=1, tx=prefixes.split( ' ' )[-1] )
self.getPickWalkInfo()
if pwDict:
if currentList:
if mc.menuItem( mc.optionMenu( self.pickWalkDataList, q=1, ill=1 )[0], q=1, l=1 ) == '':
mc.deleteUI(mc.optionMenu( self.pickWalkDataList, q=1, ill=1 )[0])
allOptItems = mc.optionMenu( self.pickWalkDataList, q=1, ill=1 )
for i in xrange( len( allOptItems ) ):
if mc.menuItem( allOptItems[i], q=1, l=1 ) == currentList:
mc.optionMenu( self.pickWalkDataList, e=1, sl=i + 1 )
mc.textField( self.pickCurrentDataListName, e=1, tx=currentList )
# Store mirror prefixes
def storeMirror( self ):
prefL = mc.textField( self.mirrorLeftTF, q=1, tx=1 )
prefR = mc.textField( self.mirrorRightTF, q=1, tx=1 )
mc.optionVar( sv=( 'pickWalkPrefixes', prefL + ' ' + prefR ) )
# Store current Pick walk list
def setCurrentPWData( self ):
global cPickWalkDict
val = mc.optionMenu( self.pickWalkDataList, q=1, v=1 )
mc.textField( self.pickCurrentDataListName, e=1, tx=val )
mc.optionVar( sv=( 'pickWalkCurrentList', val ) )
cPickWalkDict = {}
# Get Pick walk data from fileInfo and return it as dictionary
def getPickWalkInfo(self):
global pwDict
pwInfo = mc.fileInfo( "pickWalkData", q=1 )
if pwInfo:
pwDict = json.loads( pwInfo[ 0 ].replace( '\\"', '"') )
else:
pwDict = dict()
return pwDict
# Store current Pick walk set in global variable
def currentPWDict( self ):
global cPickWalkDict
global pwDict
if 'pwDict' not in globals() or not pwDict:
pwDict = self.getPickWalkInfo()
currentPW = mc.optionVar( q='pickWalkCurrentList' )
for k, v in pwDict.iteritems():
if k == currentPW:
cPickWalkDict = pwDict[k]
# Store initial selected objects that needs to be assigned as the main point
# From which pick walker will go to four different directions
def initialController(self):
global initSelObjs
sel = mc.ls(sl=1)
initSelObjs = [ s.rsplit( ':', 1 )[-1] for s in sel ]
def finishSelection( self, direction ):
global cPickWalkDict
global initSelObjs
global pwDict
if 'cPickWalkDict' not in globals() or not cPickWalkDict:
self.currentPWDict()
if 'pwDict' not in globals() or not pwDict:
pwDict = self.getPickWalkInfo()
sel = mc.ls( sl=1 )
selFiltered = [ s.rsplit( ':', 1 )[-1] for s in sel ]
currKey = ' '.join( sorted( set( initSelObjs ) ) )
prefixes = mc.optionVar( q='pickWalkPrefixes' )
mirrCurrKey = None
if mc.optionVar( ex='pickWalkPrefixes' ):
if prefixes.split( ' ' )[0] and prefixes.split( ' ' )[-1]:
mirrInitObjs = self.mirrorNames( initSelObjs )
mirrSelFiltered = self.mirrorNames( selFiltered )
mirrCurrKey = ' '.join( sorted( set( mirrInitObjs ) ) )
matchCount = 0
mirrMatchCount = 0
for k in cPickWalkDict:
if currKey == k:
matchCount += 1
for m in cPickWalkDict:
if mirrCurrKey == m:
mirrMatchCount += 1
if matchCount == 0:
cPickWalkDict[ currKey ] = [ [], [], [], [] ]
if mirrMatchCount == 0:
cPickWalkDict[ mirrCurrKey ] = [ [], [], [], [] ]
if direction == 'up':
cPickWalkDict[ currKey ][0] = selFiltered
if prefixes:
cPickWalkDict[ mirrCurrKey ][0] = mirrSelFiltered
elif direction == 'dn':
cPickWalkDict[ currKey ][1] = selFiltered
if prefixes:
cPickWalkDict[ mirrCurrKey ][1] = mirrSelFiltered
elif direction == 'lt':
cPickWalkDict[ currKey ][2] = selFiltered
if prefixes:
cPickWalkDict[ mirrCurrKey ][2] = mirrSelFiltered
elif direction == 'rt':
cPickWalkDict[ currKey ][3] = selFiltered
if prefixes:
cPickWalkDict[ mirrCurrKey ][3] = mirrSelFiltered
initSelObjs = []
encodedData = json.dumps( pwDict )
mc.fileInfo( "pickWalkData", encodedData )
# Create new script context that will wait untill 'Enter' or 'Escape' button will be pressed
# Firstly it run initialController function that remember initial selected objects that will be main
# Controller to which the other controllers wiil be assigned to
# After that finishSelection involved to handle all final assignment
def getPWSelectionContext( self, direction ):
if int( mc.about( v=1 )[3] ) < 8:
ctx = mc.scriptCtx(
n='PickWalkSelectContext',
title='Assign Pick Walk Controller',
ts="python(\"import pickWalker;pickWalker.pW().initialController()\")",
toolCursorType = 'fleur',
setAutoToggleSelection = 0,
setAutoComplete = 0,
fcs="python(\"import pickWalker;pickWalker.pW().finishSelection('%s')\")" %direction,
tss=1,
ssh='Select Controllers' )
else:
ctx = mc.scriptCtx(
n='PickWalkSelectContext',
title='Assign Pick Walk Controller',
ts="python(\"import pickWalker;pickWalker.pW().initialController()\")",
toolCursorType = 'fleur',
esc = 1,
setAutoToggleSelection = 0,
setAutoComplete = 0,
fcs="python(\"import pickWalker;pickWalker.pW().finishSelection('%s')\")" %direction,
tss=1,
ssh='Select Controllers' )
return ctx
# This function run new assignment script context and
# Clear global variables in order to force the main pickWalk function to update them
def assignController( self, direction ):
global pwDict
global cPickWalkDict
ctx = self.getPWSelectionContext( direction )
mc.setToolTo(ctx)
cPickWalkDict = {}
pwDict = {}
def mirrorNames( self, listN ):
prefixes = mc.optionVar( q='pickWalkPrefixes' )
prefL = prefixes.split( ' ' )[0]
prefR = prefixes.split( ' ' )[-1]
names = []
k = ''
for l in listN:
if prefL[0] == '*' and prefR[0] == '*' and prefL.count('*') == 1 and prefR.count('*') == 1:
if l.endswith( prefL[1:] ):
k=l.replace( prefL[1:], prefR[1:] )
elif l.endswith( prefR[1:] ):
k=l.replace( prefR[1:], prefL[1:] )
elif prefL[0] == '*' and prefL[-1] == '*' and prefR[0] == '*' and prefR[-1] == '*' and prefL.count('*') == 2 and prefR.count('*') == 2:
if prefL[1:-1] in l:
k=l.replace( prefL[1:-1], prefR[1:-1] )
elif prefR[1:-1] in l:
k=l.replace( prefR[1:-1], prefL[1:-1] )
elif prefL[-1] == '*' and prefR[-1] == '*' and prefL.count('*') == 1 and prefR.count('*') == 1:
if l.startswith( prefL[1:] ):
k=l.replace( prefL[:-1], prefR[:-1] )
elif l.startswith( prefR[1:] ):
k=l.replace( prefR[:-1], prefL[:-1] )
else:
break
names.append( k )
return names
# Change the color and command of the main navigation keys from assigning to navigation and back
def pickWalkMode( self, mode ):
if mode == 'rec':
mc.button( self.recPWMode, e=1, l='R', bgc=( 1, 0.2, 0 ), c=lambda *args: self.pickWalkMode( 'nav' ) )
mc.button( self.upPW, e=1, bgc=( 1, 0.5, 0 ), c=lambda *args: self.assignController( 'up' ) )
mc.button( self.dnPW, e=1, bgc=( 1, 0.5, 0 ), c=lambda *args: self.assignController( 'dn' ) )
mc.button( self.ltPW, e=1, bgc=( 1, 0.5, 0 ), c=lambda *args: self.assignController( 'lt' ) )
mc.button( self.rtPW, e=1, bgc=( 1, 0.5, 0 ), c=lambda *args: self.assignController( 'rt' ) )
self.conctrolCheck()
else:
mc.button( self.recPWMode, e=1, l='N', bgc=( 0.074, 0.54, 1 ), c=lambda *args: self.pickWalkMode( 'rec' ) )
mc.button( self.upPW, e=1, bgc=( 0.074, 0.54, 1 ), c=lambda *args: self.pickWalk( 'up' ) )
mc.button( self.dnPW, e=1, bgc=( 0.074, 0.54, 1 ), c=lambda *args: self.pickWalk( 'dn' ) )
mc.button( self.ltPW, e=1, bgc=( 0.074, 0.54, 1 ), c=lambda *args: self.pickWalk( 'lt' ) )
mc.button( self.rtPW, e=1, bgc=( 0.074, 0.54, 1 ), c=lambda *args: self.pickWalk( 'rt' ) )
def pickWalk( self, direction ):
# Declare global
global cPickWalkDict
if 'cPickWalkDict' not in globals() or not cPickWalkDict:
self.currentPWDict()
# If there is no info in the main dict constructed from fileInfo stop to execute
try:
cPickWalkDict
except:
return
sel = mc.ls( sl=1 )
# If there is no selection stop to execute
if not sel:
return
# Extract namespace from selection
# There is only first element involved just for faster computing
nspList = sel[0].rsplit( ':', 1 )
if len(nspList) == 2:
nsp = '%s:' %nspList[0]
else:
nsp = ''
# Remove all namespaces from selection and convert is to the sorted list
# in order to compare it with the current Pickwalk dict keys
fJoin = ' '.join( sorted( [ s.rsplit( ':', 1 )[-1] for s in sel ] ) )
for k, v in cPickWalkDict.iteritems():
if fJoin == k:
if direction == 'up' and v[0]:
mc.select( [ nsp + vo for vo in v[0] ], r=1 )
break
elif direction == 'dn' and v[1]:
mc.select( [ nsp + vo for vo in v[1] ], r=1 )
break
elif direction == 'lt' and v[2]:
mc.select( [ nsp + vo for vo in v[2] ], r=1 )
break
elif direction == 'rt' and v[3]:
mc.select( [ nsp + vo for vo in v[3] ], r=1 )
break
# Add, remove, copy and rename PW list
def pwList( self, task ):
global cPickWalkDict
global pwDict
val = mc.textField( self.pickCurrentDataListName, q=1, tx=1 )
if 'pwDict' not in globals() or not pwDict:
pwDict = self.getPickWalkInfo()
# Remove selected list to the Pick walk data
if task == 'remove':
valOpt = mc.optionMenu( self.pickWalkDataList, q=1, sl=1 )
if valOpt:
mItems = mc.optionMenu( self.pickWalkDataList, q=1, ill=1 )
mc.optionMenu( self.pickWalkDataList, q=1, ill=1 )
del pwDict[mc.menuItem( mItems[valOpt - 1], q=1, l=1 )]
mc.deleteUI( mItems[ valOpt - 1 ] )
newValOpt = mc.optionMenu( self.pickWalkDataList, q=1, sl=1 )
newMItems = mc.optionMenu( self.pickWalkDataList, q=1, ill=1 )
if newValOpt:
pwName = mc.menuItem( newMItems[newValOpt - 1], q=1, l=1 )
else:
pwName = ''
# Rename selected Pick walk list
elif task == 'rename':
valOpt = mc.optionMenu( self.pickWalkDataList, q=1, sl=1 )
mItems = mc.optionMenu( self.pickWalkDataList, q=1, ill=1 )
oldName = mc.menuItem( mItems[valOpt - 1], q=1, l=1 )
mc.menuItem( mItems[valOpt - 1], e=1, l=val )
pwName = val
pwDict[pwName] = pwDict.pop(oldName)
# Add/duplicate new list to the Pick walk data
else:
intV = re.search(r'\d+$', val)
if intV is not None:
clVal = val[0:-len(intV.group())]
else:
clVal = val
checkmatch = []
for k in pwDict:
if clVal in k:
intN = re.search(r'\d+$', k)
if intN is not None:
if clVal == k[0:-len(intN.group())]:
checkmatch.append(k)
else:
if clVal == k:
checkmatch = [k]
if checkmatch:
intN = re.search(r'\d+$', max(checkmatch))
if intN is not None:
pwName = max(checkmatch)[0:-len(intN.group())] + str( int( intN.group() ) + 1 )
else:
pwName = val + '1'
else:
pwName = val
if task == 'add':
pwDict[pwName] = {}
elif task == 'duplicate':
pwDict[pwName] = pwDict[val].copy()
mc.menuItem(l=pwName, p=self.pickWalkDataList)
numItems = mc.optionMenu( self.pickWalkDataList, q=1, ni=1 )
mc.optionMenu( self.pickWalkDataList, e=1, sl=numItems )
cPickWalkDict = {}
mc.textField( self.pickCurrentDataListName, e=1, tx=pwName )
mc.optionVar( sv=( 'pickWalkCurrentList', pwName ) )
encodedData = json.dumps( pwDict )
mc.fileInfo( "pickWalkData", encodedData )
# Export all dicts into the text file
def exportImport( self, mode ):
currDir = mc.file( q=1, exn=1 ).rsplit( '/', 1 )[0]
if mode == 'export':
data = mc.fileInfo( "pickWalkData", q=1 )
if data:
path = mc.fileDialog2( ds=1, dir=currDir, ff=( "Text file (*.txt)" ) )
if path:
textFile = open(path[0], "w")
try:
textFile.write(data[ 0 ].replace( '\\"', '"'))
finally:
textFile.close()
elif mode == 'import':
path = mc.fileDialog( t='Import pickwalk data', dm=currDir + '/*.txt' )
if path:
textFile = open(path, "r")
textData = ''
try:
textData = textFile.read()
finally:
textFile.close()
if textData:
mc.fileInfo( "pickWalkData", textData )
self.ui()
# Switch to the next/prexious pickwalk list
# without opening the UI
def swintchToNewxList( self, direction ):
global pwDict
global cPickWalkDict
if 'pwDict' not in globals():
if not pwDict:
pwDict = self.getPickWalkInfo()
if 'cPickWalkDict' not in globals() or not cPickWalkDict:
self.currentPWDict()
data = mc.fileInfo( "pickWalkData", q=1 )
if data:
currentPW = mc.optionVar( q='pickWalkCurrentList' )
allPWLists = [ k for k in pwDict ]
cIndex = allPWLists.index( currentPW )
if direction == 'down':
finalList = allPWLists[ cIndex - 1 ]
else:
if cIndex == len( allPWLists ) - 1:
finalList = allPWLists[0]
else:
finalList = allPWLists[ cIndex + 1 ]
mc.optionVar( sv=( 'pickWalkCurrentList', finalList ) )
mc.inViewMessage( amg='Current pickwalk is <hl>%s</hl>.' %finalList, pos='topCenter', fade=1 )
pwDict = {}
cPickWalkDict = {}
# Check if assigned controllers exists in the current one
def conctrolCheck( self ):
global cPickWalkDict
if 'cPickWalkDict' not in globals() or not cPickWalkDict:
self.currentPWDict()
recMode = mc.button( self.recPWMode, q=1, l=1 )
if recMode == 'R':
sel = mc.ls( sl=1 )
selFiltered = [ s.rsplit( ':', 1 )[-1] for s in sel ]
currKey = ' '.join( sorted( set( selFiltered ) ) )
matchCount = 0
for k in cPickWalkDict:
if currKey and currKey == k:
matchCount += 1
if matchCount > 0:
if len( cPickWalkDict[currKey][0] ) > 0:
mc.button( self.upPW, e=1, bgc=( 0.298, 0.823, 0.443 ), ann=', '.join( cPickWalkDict[currKey][0] ) )
else:
mc.button( self.upPW, e=1, bgc=( 1, 0.5, 0 ), ann='Up pick walk' )
if len( cPickWalkDict[currKey][1] ) > 0:
mc.button( self.dnPW, e=1, bgc=( 0.298, 0.823, 0.443 ), ann=', '.join( cPickWalkDict[currKey][1] ) )
else:
mc.button( self.dnPW, e=1, bgc=( 1, 0.5, 0 ), ann='Down pick walk' )
if len( cPickWalkDict[currKey][2] ) > 0:
mc.button( self.ltPW, e=1, bgc=( 0.298, 0.823, 0.443 ), ann=', '.join( cPickWalkDict[currKey][2] ) )
else:
mc.button( self.ltPW, e=1, bgc=( 1, 0.5, 0 ), ann='Left pick walk' )
if len( cPickWalkDict[currKey][3] ) > 0:
mc.button( self.rtPW, e=1, bgc=( 0.298, 0.823, 0.443 ), ann=', '.join( cPickWalkDict[currKey][3] ) )
else:
mc.button( self.rtPW, e=1, bgc=( 1, 0.5, 0 ), ann='Right pick walk' )
elif matchCount == 0:
mc.button( self.upPW, e=1, bgc=( 1, 0.5, 0 ), ann='Up pick walk' )
mc.button( self.dnPW, e=1, bgc=( 1, 0.5, 0 ), ann='Down pick walk' )
mc.button( self.ltPW, e=1, bgc=( 1, 0.5, 0 ), ann='Left pick walk' )
mc.button( self.rtPW, e=1, bgc=( 1, 0.5, 0 ), ann='Right pick walk' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment