def getShotCamera(): STORE_NODE = "tUtilities" CAMERA_ATTR = "cameraSelected" shotCamera = aToolsMod.loadInfoWithScene(STORE_NODE, CAMERA_ATTR) if not shotCamera: cameras = utilMod.getAllCameras() if cameras: aToolsMod.saveInfoWithScene(STORE_NODE, CAMERA_ATTR, cameras[0]) return cameras[0] return shotCamera
def populateMenu(self, menu, *args): uiMod.clearMenuItems(menu) cmds.radioMenuItemCollection(parent=menu) #populate list for loopCamera in utilMod.getAllCameras(): radioSelected = (animMod.getShotCamera() == loopCamera) cameraName = cmds.listRelatives(loopCamera, allParents=True)[0] cmds.menuItem("menu_%s"%loopCamera, label=str(cameraName), radioButton=radioSelected, parent=menu, command=lambda x, loopCamera=loopCamera, *args: aToolsMod.saveInfoWithScene(STORE_NODE, CAMERA_ATTR, loopCamera)) # last playblast menu cmds.menuItem(divider=True, parent=menu) checkBoxSelected = aToolsMod.getUserPref("saveAfterPlayblasting", default=True) cmds.menuItem("saveAfterPlayblastingMenu", label='Save Maya File After Playblasting', checkBox=checkBoxSelected, command=self.setSaveAfterPlayblastingPref, parent=menu) cmds.menuItem(divider=True, parent=menu) cmds.menuItem (label="Duplicate Selected Camera", command=self.duplicateCamera, parent=menu) cmds.menuItem (label="Playblast Viewport", command=self.playblastViewport, parent=menu) cmds.menuItem (label="Play Last Playblast", command=self.playLastPlayblast, parent=menu)
def populateMenu(self, menu, *args): uiMod.clearMenuItems(menu) cmds.radioMenuItemCollection(parent=menu) #populate list for loopCamera in utilMod.getAllCameras(): radioSelected = (animMod.getShotCamera() == loopCamera) cameraName = cmds.listRelatives(loopCamera, allParents=True)[0] cmds.menuItem( "menu_%s" % loopCamera, label=str(cameraName), radioButton=radioSelected, parent=menu, command=lambda x, loopCamera=loopCamera, *args: aToolsMod. saveInfoWithScene(STORE_NODE, CAMERA_ATTR, loopCamera)) # last playblast menu cmds.menuItem(divider=True, parent=menu) checkBoxSelected = aToolsMod.getUserPref("saveAfterPlayblasting", default=True) cmds.menuItem("saveAfterPlayblastingMenu", label='Save Maya File After Playblasting', checkBox=checkBoxSelected, command=self.setSaveAfterPlayblastingPref, parent=menu) cmds.menuItem(divider=True, parent=menu) cmds.menuItem(label="Duplicate Selected Camera", command=self.duplicateCamera, parent=menu) cmds.menuItem(label="Playblast Viewport", command=self.playblastViewport, parent=menu) cmds.menuItem(label="Play Last Playblast", command=self.playLastPlayblast, parent=menu)