def getMainWindowInfo(): info = Duck() mw = pm.getMelGlobal('string', 'gMainWindow') ui = pm.PyUI(mw) setattr(info, 'mainWindowName', mw) setattr(info, 'mainWindow', ui) return info
def cleanup(): try: layerchannelui = pm.PyUI('MainChannelsLayersLayout') qt_layerchannelui = layerchannelui.asQtObject() c = pm.FormLayout('th_layerchannel') if (layerchannelui.parent() == c): qt_layerchannelui.setParent(None) except: print 'Could not cleanup layer channel box'
def create(layout): print 'Creating ChannelBox and Layer Editor' pm.runtime.DisplayLayerEditorWindow() pm.refresh(f=True) container = pm.verticalLayout('th_layerchannel', p=layout) qt_container = container.asQtObject() layerchannelui = pm.PyUI('MainChannelsLayersLayout') qt_layerchannelui = layerchannelui.asQtObject() if (not qt_layerchannelui): layerchannelui = pm.PyUI('MainChannelsLayersLayout').parent() qt_layerchannelui = layerchannelui.asQtObject() qt_layerchannelui.setParent(qt_container) container.redistribute(0) pm.mel.eval('setChannelsLayersVisible( 0 )') return container
def splitSelection() : __st(0) workingList, sel = getMeshesRecursivelyFromSelection() gMainProgressBar = pm.PyUI(pm.mel.eval( '$tmp = $gMainProgressBar' )) gMainProgressBar.setMaxValue( len(workingList) ) if( len(workingList) > 0 ) : try : outputGrp = pm.PyNode(OUTPUT_GRP_NAME) except (pm.MayaNodeError) : outputGrp = pm.group(name=OUTPUT_GRP_NAME, world=True, empty=True) outputContents = outputGrp.getChildren() for child in outputContents : pm.delete(child) pm.uitypes.ProgressBar.beginProgress( gMainProgressBar, status="Splitting meshes..." ) gMainProgressBar.step(0) pm.refresh() for mesh in workingList : splitByMaterials(mesh, outputGrp) gMainProgressBar.step(1) pm.refresh() materialGroups = outputGrp.getChildren() for group in materialGroups : mergeGroup(group) else : pm.warning( 'No meshes found in selection' ) gMainProgressBar.endProgress() # pm.select(sel) pm.select(outputGrp) print 'Splitting mesh by material COMPLETE' __et(0, 'Total')
## core imports
import Ik_Spline_Setup_Ui Ik_Spline_Setup_Ui.spline_ik_setup_UI() return None def curve_points(): import CustomScripts CustomScripts.curve_through_points() return None def insert_joints(): import insertJointsUI insertJointsUI.insert_joints_UI() return None menuName = "Custom_Menu" mainMenu = pm.PyUI( pm.getMelGlobal('string', 'gMainWindow') ) try: if pm.menu(Custom_Tools, query=True, exists=True): pm.deleteUI(Custom_Tools) except: print "Creating New Menu" with mainMenu: if pm.menu(menuName, query=True, exists = True): pm.menu(menuName, edit=True, deleteAllItems=True) #Custom_Tools = pm.menu( label=menuName, tearOff=True ) Custom_Tools = pm.menu(label=menuName) with Custom_Tools: obj_cr_btn = pm.menuItem( label="Object creator",command=lambda x: obj_creat()) cus_tls_btn = pm.menuItem( label="Custom Tools",command=lambda x: cus_tls())