def leftrightdetection(mayaFalse): lis = [] #checking which slots are empty for i in pm.lsUI(type='textField'): if i.find('colleft') != -1: lis.append(i) for i in sorted(pm.lsUI(type='textField')): if i.find('colleft') != -1 and pm.textField(i, q=True, text=True): #print pm.textField(i, q=True, text=True) #print i.replace('left', 'right') for j in sorted(lis): if not pm.textField(j, q=True, text=True): pm.textField(j, edit=True, text=pm.textField(i, q=True, text=True).replace( 'Left', 'Right')) pm.textField(j.replace('left', 'right'), edit=True, text=pm.textField(i.replace('left', 'right'), q=True, text=True).replace( 'Left', 'Right')) break
def MEL_b153(self):#lsUI returns the names of UI objects windows = '{}\n{}\n{}\n'.format("Windows", "Windows created using ELF UI commands:", pm.lsUI (windows=True)) panels = '{}\n{}\n{}\n'.format("Panels", "All currently existing panels:", pm.lsUI (panels=True)) editors = '{}\n{}\n{}\n'.format("Editors", "All currently existing editors:", pm.lsUI (editors=True)) controls = '{}\n{}\n{}\n'.format("Controls", "Controls created using ELF UI commands: [e.g. buttons, checkboxes, etc]", pm.lsUI (controls=True)) control_layouts = '{}\n{}\n{}\n'.format("Control Layouts", "Control layouts created using ELF UI commands: [e.g. formLayouts, paneLayouts, etc.]", pm.lsUI (controlLayouts=True)) menus = '{}\n{}\n{}\n'.format("Menus", "Menus created using ELF UI commands:", pm.lsUI (menus=True)) menu_items = '{}\n{}\n{}\n'.format("Menu Items", "Menu items created using ELF UI commands:", pm.lsUI (menuItems=True)) contexts = '{}\n{}\n{}\n'.format("Tool Contexts", "Tool contexts created using ELF UI commands:", pm.lsUI (contexts=True)) output_text = '{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}'.format(windows, panels, editors, menus, menu_items, controls, control_layouts, contexts) print outputscrollField(output_text, "Ui Elements", 6.4, 0.85)
def HaMenu(): for n in pm.lsUI(l=True, menus=True): #if pm.objectTypeUI(n) == "menuBarLayout": # print "##############", n if ('Ha_mainMenu' in n) or ('HaMainMenu' in n): _addMenu(n) break
def install_rayvision(): if "MayaWindow|Rayvision" not in pm.lsUI(type="menu"): pm.menu("Rayvision", parent='MayaWindow') pm.menuItem( "SubmitMayaRenderTask", command= "import Rayvision.submit_maya;Rayvision.submit_maya.submit_maya()")
def bakeHIK(self): #bake whip if present #if pm.objExists('ikJoint_Weapon2'): # pm.bakeResults(pm.listRelatives('Helper_Weapon1'), time = (animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation = True, sampleBy = 1, oversamplingRate = 1, disableImplicitControl = True, preserveOutsideKeys = True, sparseAnimCurveBake = False, removeBakedAttributeFromLayer = False, removeBakedAnimFromLayer = False, bakeOnOverrideLayer = False, minimizeRotation = True, controlPoints = False, shape = True) #re-setting bake settings mel.eval('performBakeSimulation 1;') #open bake settings list = [ i for i in pm.lsUI(cl=True, long=True) if 'OptionBoxWindow' in i ] #list down UIs list.sort(key=len) #sort list by length mel.eval('bakeSimulationSetup %s animationList 1 "-1.0" "-1.0";' % list[6]) #resetting bake settings pm.deleteUI('OptionBoxWindow') #close bake window mel.eval('HIKCharacterControlsTool') #command to open humanIK pm.mel.mayaHIKsetRigInput("Character1") #setting back to humanIK pm.mel.hikUpdateContextualUI() #updating the humanIK UI pm.mel.hikUpdateSourceList() pm.mel.hikSetCurrentCharacter("Character1") #selecting character pm.mel.hikUpdateCurrentCharacterFromScene() pm.mel.hikUpdateContextualUI() pm.mel.hikBakeCharacter(0) #this is the bake to skeleton command
def reset_floating_window(): '''reset floating window position''' window_list = pm.lsUI(windows=True) for window in window_list: if window != "MayaWindow" and window != "scriptEditorPanel1Window": pm.deleteUI(window) pm.windowPref(window, remove=True) print window, " reset"
def update_model_editors(cls, *args, **kwargs): ''' ''' model_panel_list = pm.lsUI(editors=True) for model_panel in model_panel_list: if 'modelPanel' in model_panel: try: pm.modelEditor(model_panel, edit=True, **kwargs) except: Utility.lc_print_exception()
def remove_ui_item_menu(name_list): """ It removes command menu items from maya UI. :param name_list: list with the name of UI items to remove. """ for name in name_list: for item in pm.lsUI(): if item.endswith(name): pm.deleteUI(item)
def delete_menu(menu_name=MENU_NAME): """ This is not used anywhere, but is being kept for posterity """ menu_map = {} for m in pm.lsUI(m=True): if m.getLabel(): menu_map[m.getLabel()] = m pm.deleteUI(menu_map.get(menu_name))
def closeWindows( toggle=True ): """Close all open windows.""" uiList = pm.lsUI( windows=True ) for win in uiList: if win in ( 'CommandWindow', 'ColorEditor' ): try: pm.window( win, edit=True, visible=False ) except: pass elif win not in ( 'progressWindow', 'MayaWindow' ): try: pm.deleteUI( win ) except: pass
def toggleRenderer(self): modelPanelList = [] modelEditorList = pm.lsUI(editors=True) # find all model panels for myModelPanel in modelEditorList: if myModelPanel.find('modelPanel') != -1: modelPanelList.append(myModelPanel) onionPanel = None # if any of those is already set to onion skin renderer for modelPanel in modelPanelList: if pm.uitypes.ModelEditor(modelPanel).getRendererOverrideName( ) == 'onionSkinRenderer': onionPanel = pm.uitypes.ModelEditor(modelPanel) break # if there is a panel with the onion skin renderer # deactivate it and save the panel if onionPanel: try: # Always better to try in the case of active panel operations # as the active panel might not be a viewport. onionPanel.setRendererOverrideName('') self.mActiveEditor = onionPanel except Exception as e: # Handle exception print e else: # if there is a saved editor panel activate the renderer on it if self.mActiveEditor: self.mActiveEditor.setRendererOverrideName('onionSkinRenderer') # else toggle the active one else: for modelPanel in modelPanelList: if pm.uitypes.ModelEditor(modelPanel).getActiveView(): try: if pm.uitypes.ModelEditor( modelPanel).getRendererOverrideName( ) == '': pm.uitypes.ModelEditor( modelPanel).setRendererOverrideName( 'onionSkinRenderer') else: pm.uitypes.ModelEditor( modelPanel).setRendererOverrideName('') except Exception as e: # Handle exception print e
def animExpButton(self): try: #combined export button self.saveFileName = pm.saveAs(pm.sceneName()[:-3] + '_temp.ma') #saving as a backup before exporting if self.ingameExport.isChecked() == True:#motion export self.animExport_1() self.animExport_2() elif self.camExport.isChecked() == True: #camera export self.cameraExport() ''' DELETE LATER elif self.cutsceneExport.isChecked() == True: #self.cutSceneExport() pm.confirmDialog(title = 'SER 出力ツール', message = u'Not yet implemented /nまだ書いていません') pass ''' pm.openFile(self.saveFileName, force = True) #opening original file pm.renameFile(self.saveFileName.replace('_temp', '')) #renames the file back to the original name before it was os.remove(self.saveFileName) try: #spamming delete entry in case there are entries before already mel.eval('gameExp_DeleteAnimationClipLayout 0;') except: pass for i in pm.lsUI(windows = True):#closing the game exporter window if 'gameExporterWindow' in i: pm.deleteUI(i) #copy pasta part if self.camExport.isChecked() == True: #camera export copy2(self.exportPath.text() + r'/' + self.exportName.text() + '_cam.fbx', r'D:/SER/GIT/Assets/AssetBundle/Resources' + self.exportPath.text()[39:]) #r'D:\SER\GIT/Assets/AssetBundle/Resources' + print self.exportPath.text() + r'/' + self.exportName.text() + '_cam.fbx', r'D:/SER/GIT/Assets/AssetBundle/Resources' + self.exportPath.text()[39:] else: copy2(self.exportPath.text() + r'/' + self.exportName.text() + '.fbx', r'D:/SER/GIT/Assets/AssetBundle/Resources' + self.exportPath.text()[39:]) #r'D:\SER\GIT/Assets/AssetBundle/Resources' + print self.exportPath.text() + r'/' + self.exportName.text() + '.fbx', r'D:/SER/GIT/Assets/AssetBundle/Resources' + self.exportPath.text()[39:] pm.confirmDialog(title = 'SER 出力ツール', message = u'モーションは出力しました') print('SER Export complete!') except: pm.confirmDialog(title = 'SER 出力ツール', message = u'エラーが発生しました。早速チューまで連絡してください。') pm.openFile(self.saveFileName, force = True)#re-open the save file pm.renameFile(self.saveFileName.replace('_temp', '')) #renames the file back to the original name before it was os.remove(self.saveFileName)
def check(cls): """ Check if a viewport is using Viewport 2.0 and asks to switch it to the legacy viewport. """ model_panels = [o for o in pmc.lsUI(editors=1) if 'modelPanel' in o] for panel in model_panels: try: v = pmc.uitypes.ModelEditor(panel) if v.getActiveView() and v.getRendererName() == 'vp2Renderer': return cls._trigger(v) except RuntimeError: pass # No viewport 2.0 return True
def main(): global panel_hyperShd #// collect hyperShade Window win_hyperShd = [ win for win in pm.lsUI( type='window' ) if win.find('hyperShade') != -1 ] #// test if hyershade is open if len(win_hyperShd) == 0: pm.runtime.HypershadeWindow() panel_hyperShd = pm.getPanel( scriptType='hyperShadePanel' )[0] print panel_hyperShd #// add button in hyperShade pm.setParent( panel_hyperShd + '|mainForm|hyperShadeToolbarForm' ) if( not(pm.button( 'grab', exists=True )) ): pm.button('grab', bgc=[0.5,0.5,0], c=pm.Callback( addMaterialinGraph ), width=50 )
def create(): for newmenu in menu_menu: menus = [m for m in pym.lsUI() if m.name() == "MayaWindow|" + newmenu] if menus: oMenu = menus[0] oMenu.deleteAllItems() else: oMenu = pym.menu( newmenu, label=menu_menu[newmenu]["label"], to=True, p='MayaWindow' ) oMenu.makeDefault() entries = menu_menu[newmenu]["entries"] for entrie in entries: label = entries[entrie]["label"] cmd = entries[entrie]["cmd"] pym.menuItem(entrie, label=label, c=cmd)
def widgetPath(windowName, widgetNames): """ @param windowName: Window instance name to search @param widgetNames: list of names to search for taken from http://www.chris-g.net/2011/06/24/maya-qt-interfaces-in-a-class/ """ returnDict = {} mayaWidgetList = pm.lsUI(dumpWidgets=True) for widget in widgetNames: for mayaWidget in mayaWidgetList: if windowName in mayaWidget: if mayaWidget.endswith(widget): returnDict[widget] = mayaWidget return returnDict
def get_current_camera(): ''' get the camera from the active viewport if able ''' current_camera = None modelEditorList = [] for modelEditor in pm.lsUI(editors=True): if modelEditor.find('modelPanel') != -1: modelEditorList.append(modelEditor) for modelEditor in [x for x in modelEditorList if x.getActiveView()]: try: current_camera = modelEditor.getCamera().getShape() except: lcUtility.Utility.lc_print_exception( "Problem getting the current camera") return current_camera
def cmd_txsnm_chk_bt(self): #check 贴图命名 u""" >>check 贴图命名 : 项目缩写为 前缀, 使用 数字 0-9 字母a-zA-Z 下划线 _ 点. 贴图文件命名及路径中 回避 中文 贴图文件命名及路径中 不能有 空格 - () 等 特殊字符 """ chk_labels = { 'noExists': u'贴图不存在', 'iffyName': u'贴图命名 应由 (字母/数字/_/.) 组成', 'seqIffyName': u'序列贴图序号存在异常 正常为 ***.0001.jpg', 'prefIffyName': u'贴图前缀与当前任务不匹配' } res = self.chk_txf_name() if not res: return olnps = [ ea for ea in pm.lsUI(panels=True) if ea.type() == 'ToutlinerEditor' ] if olnps: mc.outlinerEditor(olnps[0].name(), showSetMembers=True, e=True) res_str = u'>>>请检查列出的file节点 贴图命名 所描述的错误{}'.format(os.linesep) ck_cnt = 0 res_total_sets = None if pm.objExists('Check_Error_information_Sets'): res_total_sets = pm.PyNode('Check_Error_information_Sets') [ pm.delete(ea_sets) for ea_sets in res_total_sets.listConnections() ] res_total_sets = pm.sets(name='Check_Error_information_Sets', em=True) for ea_ck_lb in chk_labels: if res[ea_ck_lb]: res_sets = pm.sets(name="CheckRes_{}".format(ea_ck_lb)) res_total_sets.add(res_sets.name()) res_str += u'\t{}{}'.format(chk_labels[ea_ck_lb], os.linesep) for ea_fn in res[ea_ck_lb]: res_sets.add(ea_fn.name()) res_str += u"\t\t>>>File Node >> {:<32}\t>>>Texture File>> {:<120}\t 异常部分: {}{}".format( ea_fn.name(), res[ea_ck_lb][ea_fn].keys()[0], res[ea_ck_lb][ea_fn].values()[0], os.linesep) ck_cnt += 1 if ck_cnt: print res_str else: print(u">>>没有贴图节点被check")
def onModelChange3dc(): # Get all model editors in Maya and reset the editorChanged event for item in pm.lsUI(editors=True): if isinstance(item, pm.ui.ModelEditor): pm.modelEditor(item, edit=True, editorChanged="")
def fn_playblast(stereocam, file_name, layer_number, cut_in, cut_out, is_rear_layer=True, pb_offscreen=True, \ renderers='base_OpenGL_Renderer', display_elements={}, \ ext='png', widthHeight=[2048,858], enable_anim_floating_window=False): center = stereocam try: left = center.attr('leftCamera').get() right = center.attr('rightCamera').get() except: print 'Failed to get left and right camera from '+str(center) return [] # disable resolution try: center.attr('displayResolution').set(0) center.attr('displayGateMask').set(0) center.attr('displayFilmGate').set(0) except: pass # make sure that we play frames in every frame try: pm.playbackOptions(edit=True, by=1.0) except: pass #get user option before building model editor #opt_path = pm.internalVar(usd=True).replace('\\', '/') #if os.path.isfile(opt_path+'updatePreviewXmlUserOption.txt'): # initial vars before building model editor if renderers=='vp2Renderer': # if we use viewport2(vp2) render, the images contain alpha channel, # then we simply use imconvert to composite images instead of chrome keying in nuke # but imconvert can not recognize tif image, so we change the default tif to png ext = 'png' layer = 'main' if file_name.endswith('.near'): layer = 'near' elif file_name.endswith('.far'): layer = 'far' # floating window value fwv = scf.getFloatingWindowValues(center, cut_in, cut_out) add_float_window = True if not fwv['ll'] and not fwv['lr'] and not fwv['rl'] and not fwv['rr']: add_float_window = False cameras = {'center':center, 'left':left, 'right':right} deleteUselessHudExpression() # build the model editor global stereo_pb_window stereo_pb_window_exists = False for w in pm.lsUI(type='window'): try: if pm.window(w, ex=True) and w.getTitle()=='stereo_pb_window': stereo_pb_window_exists = True break except: pass if stereo_pb_window and stereo_pb_window['window'] and pm.window(stereo_pb_window['window'], ex=True): stereo_pb_window_exists = True ratio = float(widthHeight[0])/widthHeight[1] ui = {} if stereo_pb_window_exists: ui = stereo_pb_window else: ui = buildPlayblastWindow(cameras, layer, layer_number, add_float_window, renderers, is_rear_layer, ratio, display_elements) p_window = ui['window'] p_editor = ui['editor'] safearea = ui['safearea'] hud_stereo = ui['hud_stereo'] huds_current = ui['huds_current'] bgColor = ui['bgColor'] #global stereo_pb_continue #if enable_anim_floating_window and fwv['animated'] and not stereo_pb_continue: # stereo_pb_continue = True # return [] # playblast left eye first try: try: if safearea: safearea.attr('panScanRatio').set(ratio) safearea.attr('panScanOffset').set(0) except: pass if safearea and (fwv['ll'] or fwv['lr']): try: setPanScanValues(fwv, safearea, cut_in, cut_out, ratio, eye='left') except: print traceback.format_exc() try: left.attr('overscan').unlock() left.attr('overscan').set(1.0) except: print traceback.format_exc() # disable resolution display try: left.attr('displayResolution').unlock() left.attr('displayResolution').set(False) except: pass pm.modelEditor(p_editor, edit=True, camera=left, activeView=True) pm.lookThru(left) pm.refresh() except: print traceback.format_exc() left_img = pm.playblast( startTime=cut_in, endTime=cut_out, format='image', filename=file_name+'.left', \ forceOverwrite=True, sequenceTime=0, clearCache=False, viewer=False, showOrnaments=True, \ offScreen=True, fp=4, percent=100, compression=ext, widthHeight=(widthHeight[0],widthHeight[1]), quality=100) try: left.attr('overscan').lock() left.attr('displayResolution').lock() except: pass # right eye follows try: try: if safearea: safearea.attr('panScanRatio').set(ratio) safearea.attr('panScanOffset').set(0) except: pass if safearea and (fwv['rl'] or fwv['rr']): try: setPanScanValues(fwv, safearea, cut_in, cut_out, ratio, eye='right') except: print traceback.format_exc() try: right.attr('overscan').unlock() right.attr('overscan').set(1.0) except: print traceback.format_exc() # disable resolution display try: right.attr('displayResolution').unlock() right.attr('displayResolution').set(False) except: pass pm.modelEditor(p_editor, edit=True, camera=right, activeView=True) pm.lookThru(right) pm.refresh() except: print traceback.format_exc() right_img = pm.playblast( startTime=cut_in, endTime=cut_out, format='image', filename=file_name+'.right', \ forceOverwrite=True, sequenceTime=0, clearCache=False, viewer=False, showOrnaments=True, \ offScreen=True, fp=4, percent=100, compression=ext, widthHeight=(widthHeight[0],widthHeight[1]), quality=100) try: right.attr('overscan').lock() right.attr('displayResolution').lock() except: pass cleanPlayblastWindow(ui, renderers) #stereo_pb_continue = False print left_img print right_img # the returned filename is formated as path/image_name.####.ext return [cf.osPathConvert(left_img), cf.osPathConvert(right_img)]
import pymel.core as pm import pymel.core.uitypes as pmui modelPanelList = [] # all the editors, including hypershade and stuffs modelEditorList = pm.lsUI(editors=True) for editors in modelEditorList: print editors for myModelPanel in modelEditorList: if myModelPanel.find( 'modelPanel') != -1: # this will give only 4 viewports modelPanelList.append(myModelPanel) # get the last (perspective) viewport modelPanelList[-1].setRendererName('vp2Renderer') # get available renderers with getRendererList()
def solveOnModelChange3dc(): # 获取Maya中的所有编辑器,并重置editorChanged事件 for item in pm.lsUI(editors=True): if isinstance(item, pm.ui.ModelEditor): pm.modelEditor(item, edit=True, editorChanged="")
def get_all_wins(): all_windows = pm.lsUI(typ = 'window') window_remove = ['MayaWindow'] all_extra_windows = [_ for _ in all_windows if _ not in window_remove] return all_extra_windows
def init(): if capp.HOST == capp.MAYA or capp.HOST == capp.MAYA2: if pm.about(b=1): return cm = 'cerebroMenu1' for tmp in pm.lsUI(type='menu'): if cm in tmp: pm.deleteUI(tmp) root = pm.menu(cm, label='Cerebro', parent='MayaWindow', tearOff=True) pm.menuItem('cerebroTodoListMenu', label='Todo list', parent=root, image='', c=lambda *args: menu.todolist()) pm.menuItem('cerebroBrowserMenu', label='Link/Embed', parent=root, image='', c=lambda *args: menu.browser()) pm.menuItem('cerebroCreateReportNewMenu', label='Save as version', parent=root, image='', c=lambda *args: menu.createreport()) pm.menuItem('cerebroPublishMenu', label='Publish', parent=root, image='', c=lambda *args: menu.publish()) #pm.menuItem('cerebroVersionMenu', label='Add version', parent=root, image='', c=lambda *args: menu.version_silent()) pm.menuItem('cerebroSep2', parent=root, divider=True) pm.menuItem('cerebroLogoutMenu', label='Logout', parent=root, image='', c=lambda *args: menu.logout()) pm.menuItem('cerebroSep3', parent=root, divider=True) pm.menuItem('cerebroChangeWorkDir', label='Change working directory', parent=root, image='', c=lambda *args: menu.workdir()) pm.menuItem('cerebroSep4', parent=root, divider=True) pm.menuItem('cerebroOpenFolder', label='Open task folder', parent=root, image='', c=lambda *args: menu.open_folder()) pm.menuItem('cerebroOpenCerebro', label='Open task in Cerebro', parent=root, image='', c=lambda *args: menu.open_cerebro()) pm.menuItem('cerebroSep5', parent=root, divider=True) pm.menuItem('cerebroShowVer', label='About', parent=root, image='', c=lambda *args: menu.about()) if capp.DEBUG is True: m_reload = pm.menuItem('cerebroReload', label='Reload', parent=root, image='', c=lambda *args: menu.reload())
def HaMenu(): for n in pm.lsUI(l=True, menus=True): #if pm.objectTypeUI(n) == "menuBarLayout": if 'Ha_mainMenu' in n: _addMenu() break
def install_rayvision_menu(): if "MayaWindow|Rayvision" not in pm.lsUI(type="menu"): pm.menu("Rayvision", parent='MayaWindow') pm.menuItem("SubmitMayaRenderTask", command="execfile(r\"%s\")" % (submit_maya_py))
import pymel.core as pm # Get all model editors in Maya and reset the editorChanged event for item in pm.lsUI(editors=True): if isinstance(item, pm.ui.ModelEditor): pm.modelEditor(item, edit=True, editorChanged="")
def bakeHIK(self): # bake whip if present # if pm.objExists('ikJoint_Weapon2'): # pm.bakeResults(pm.listRelatives('Helper_Weapon1'), time = (animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation = True, sampleBy = 1, oversamplingRate = 1, disableImplicitControl = True, preserveOutsideKeys = True, sparseAnimCurveBake = False, removeBakedAttributeFromLayer = False, removeBakedAnimFromLayer = False, bakeOnOverrideLayer = False, minimizeRotation = True, controlPoints = False, shape = True) # re-setting bake settings mel.eval('performBakeSimulation 1;') # open bake settings list = [ i for i in pm.lsUI(cl=True, long=True) if 'OptionBoxWindow' in i ] # list down UIs list.sort(key=len) # sort list by length mel.eval('bakeSimulationSetup %s animationList 1 "-1.0" "-1.0";' % list[6]) # resetting bake settings pm.deleteUI('OptionBoxWindow') # close bake window mel.eval('HIKCharacterControlsTool') # command to open humanIK pm.mel.mayaHIKsetRigInput("Character1") # setting back to humanIK pm.mel.hikUpdateContextualUI() # updating the humanIK UI pm.mel.hikUpdateSourceList() pm.mel.hikSetCurrentCharacter("Character1") # selecting character pm.mel.hikUpdateCurrentCharacterFromScene() pm.mel.hikUpdateContextualUI() pm.mel.hikBakeCharacter(0) # this is the bake to skeleton command # pm.mel.hikBakeToControlRig(0) # this part bakes the weapon and helperweapon if pm.ls('Controller_Weapon_Global'): # for single handed weapons pm.bakeResults(pm.ls('*Joint_Weapon')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) helperToWeapon = pm.parentConstraint(pm.ls('*Joint_Weapon', type='joint')[0], pm.ls('*Helper_Weapon1')[0], mo=False) pm.bakeResults(pm.ls('*Helper_Weapon1')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) pm.delete(helperToWeapon) elif pm.ls('Controller_Weapon_Global_R') and pm.ls( 'Controller_Weapon_Global_L' ): # baking and constraints for dual swords etc pm.bakeResults(pm.ls('*Joint_Weapon')[0], pm.ls('*:Joint_Weapon')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) helperRToWeaponR = pm.parentConstraint(pm.ls('*Joint_Weapon', type='joint')[0], pm.ls('*Helper_Weapon1')[0], mo=False) helperLToWeaponL = pm.parentConstraint(pm.ls('*:Joint_Weapon', type='joint')[0], pm.ls('*Helper_Weapon2')[0], mo=False) pm.bakeResults(pm.ls('*Helper_Weapon1')[0], pm.ls('*Helper_Weapon2')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) pm.delete(helperRToWeaponR, helperLToWeaponL) elif pm.ls('Controller_Weapon_GlobalR') and pm.ls( 'Controller_Weapon_GlobalL' ): # baking and constraints for two hand that's being used in 110_n02 pm.bakeResults(pm.ls('*Joint_Weapon')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) helperRToWeaponR = pm.parentConstraint(pm.ls('*Joint_Weapon', type='joint')[0], pm.ls('*Helper_Weapon1')[0], mo=False) pm.bakeResults(pm.ls('*Helper_Weapon1')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) pm.delete(helperRToWeaponR) elif pm.ls('Controller_Weapon_RightHand') and pm.ls( 'Controller_Weapon_LeftHand' ): # baking and constraints for 110_n02 pm.bakeResults(pm.ls('*Joint_Weapon')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) helperRToWeaponR = pm.parentConstraint(pm.ls('*Joint_Weapon', type='joint')[0], pm.ls('*Helper_Weapon1')[0], mo=False) pm.bakeResults(pm.ls('*Helper_Weapon1')[0], t=(animAPI.MAnimControl.minTime().value(), animAPI.MAnimControl.maxTime().value()), simulation=True) pm.delete(helperRToWeaponR)
def get_shelf_layout(): for shelfPrLayout in pm.lsUI(type='tabLayout'): return shelfPrLayout.shortName() log.warning("no shelf layout found.") return None
def removeOnModelEditChange(): for item in pym.lsUI(editors=True): if isinstance(item, pym.ui.ModelEditor): pym.modelEditor(item, edit=True, editorChanged="")