but I was adding more features to it today I added a button that creates a new camera, and I made it so the delete button will work on the list. the problem is that it doesn't show the changes in the list without a relaunch. I tried the refresh() command but it doesn't seem to work, or I don't know where to put it.
Can anyone help me out? I want the list to update when I add, delete, or rename a camera
here is the full script I have so far. I just added the checkbox with the intent later to turn on/off ortho cameras.
##### # This script makes a GUI with a list of # your Cameras that allows you to select # the camera from the GUI and you can # also look through the selected camera ##### import maya.cmds as mc camListBox = "camList" def selectChanged(): #query selection in list #then do select command with selected item in list selectCam = mc.textScrollList(camListBox, q=True, selectItem=True) mc.select(selectCam) def delSelected(): #query selection in list #then do select command with selected item in list #then delete it selectCam = mc.textScrollList(camListBox, q=True, selectItem=True) mc.delete(selectCam) def newCam(): mc.camera() def camLook(): selectLook = mc.textScrollList(camListBox, q=True, selectItem=True) mc.lookThru(selectLook) # looks through the camera I specify def initGui(): #here we will add all cameras in scene to list box allCams = mc.listCameras(p=True) # p=True is grabbing the perspective cameras only. for aCam in allCams: mc.textScrollList(camListBox, edit=True, append=aCam) if len(mc.textScrollList(camListBox, q=True, allItems=True)): mc.textScrollList(camListBox, edit=True, selectIndexedItem=1) def makeWindow(winName): if mc.window(winName, exists=True): mc.deleteUI(winName) mc.window( winName, width=150 ) mc.columnLayout( adjustableColumn=True ) mc.checkBox( label='Show Ortho Cameras' ) mc.textScrollList(camListBox, deleteKeyCommand="delSelected()", allowMultiSelection=False, selectCommand="selectChanged()") mc.button( label='View', command="camLook()" ) mc.button( label='New', command="newCam()" ) mc.button( label='Refresh', command="makeWindow(\"CamWindow\")" ) mc.showWindow() #fill gui with cameras initGui() makeWindow("CamWindow")