FORUMS: list search recent posts

Maya Python - Update GUI list in respect to checkbox filter

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Dan Brookwell
Maya Python - Update GUI list in respect to checkbox filter
on Nov 12, 2014 at 10:54:52 pm

I'm looking to have four checkboxes enable/disable the visibility of menu items within a list within a python/mel GUI. The code I have so far is:


import maya.cmds as cmds

status=[0,0,0,0]

# Master GUI Window
masterWindow=cmds.window(title="Integrated Asset Library",resizeToFitChildren=True,menuBar=True)
cmds.rowColumnLayout()
cmds.text(label='Select Building Material')
x=cmds.checkBoxGrp(numberOfCheckBoxes=4, labelArray4=["Brick","Concrete","Windows","Wood"], valueArray4=[0,0,0,0], offCommand1='deselectBricks()', offCommand2='deselectConcrete()', offCommand3='deselectWindows()', offCommand4='deselectWood()', onCommand1='selectBricks()', onCommand2='selectConcrete()', onCommand3='selectWindows()', onCommand4='selectWood()')

#Asset List
cmds.text(label="Select Asset Below")
state0=cmds.menuBarLayout(visible=True)
liveList=cmds.textScrollList('objectList', allowMultiSelection=False, selectCommand='listSelected()', w=300, h=350)
queryList = ['Brick', 'Concrete', 'Windows', 'Wood']
cmds.button(label="Generate Asset Geometry")
cmds.showWindow(masterWindow)

#material selection
def selectBricks():
print "bricks selected"
queryList.append('Brick')
def selectConcrete():
print "concrete selected"
queryList.append('Concrete')
def selectWindows():
print "windows selected"
queryList.append('Windows')
def selectWood():
print "wood selected"
queryList.append('Wood')

#material deselection
def deselectBricks():
print "bricks deselected"
queryList.remove('Brick')
refreshTSL()
def deselectConcrete():
print "concrete deselected"
queryList.remove('Concrete')
refreshTSL()
def deselectWindows():
print "windows deselected"
queryList.remove('Windows')
refreshTSL()
def deselectWood():
print "wood deselected"
queryList.remove('Wood')
refreshTSL()

#list population
def listSelected():
alist=cmds.textScrollList(liveList, q=True, da=True, si=True)
cmds.select (alist)

def refreshTSL():
cmds.textScrollList(liveList, e=True, ra=True)
queryList2 = list(set(queryList))
for atype in queryList2:
alist= cmds.ls(type=atype)
for item in alist:
cmds.textScrollList(liveList, e=True, a=item)



I cannot seem to get anything to display in the textScrollList() and I honestly do not know where to go next. Any help would be amazing.

Dan


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]