def selectPaintWeightsInfluence(self,infl): ''' tries to select influence (provided as string) in current maya's paint weights context and UI if skin paint context is not available, nothing happens ''' if not Utils.isCurrentlyPaintingWeights(): return # influence name can come in any form ('joint3', 'joint2|joint3', 'joint1|joint2|joint3') # get the absolute shortest possible (but still unique) and longest try: longName = cmds.ls(infl,l=True)[0] shortName = cmds.ls(longName,l=False)[0] log.info("selecting in paint weights: influence %s" % str(infl)) # try to work around with the mess in the earlier versions of # maya's paint weights UI: if Utils.getMayaVersion()<Utils.MAYA2011: itemName = Utils.mel('artAttrSkinShortName("%s")'%shortName) Utils.mel('artSkinSelectInfluence("artAttrSkinPaintCtx","%s","%s");' % (shortName,itemName)); else: Utils.mel('artSkinSelectInfluence("artAttrSkinPaintCtx","%s");' % shortName); # show paint weights interface cmds.toolPropertyWindow() except: # problems listing given influence.. just die here Utils.displayError('problem selecting influence %s' % infl)
def selectPaintWeightsInfluence(self, infl): ''' tries to select influence (provided as string) in current maya's paint weights context and UI if skin paint context is not available, nothing happens ''' if not Utils.isCurrentlyPaintingWeights(): return # influence name can come in any form ('joint3', 'joint2|joint3', 'joint1|joint2|joint3') # get the absolute shortest possible (but still unique) and longest try: longName = cmds.ls(infl, l=True)[0] shortName = cmds.ls(longName, l=False)[0] log.info("selecting in paint weights: influence %s" % str(infl)) # try to work around with the mess in the earlier versions of # maya's paint weights UI: if Utils.getMayaVersion() < Utils.MAYA2011: itemName = Utils.mel('artAttrSkinShortName("%s")' % shortName) Utils.mel( 'artSkinSelectInfluence("artAttrSkinPaintCtx","%s","%s");' % (shortName, itemName)) else: Utils.mel( 'artSkinSelectInfluence("artAttrSkinPaintCtx","%s");' % shortName) # show paint weights interface cmds.toolPropertyWindow() except: # problems listing given influence.. just die here Utils.displayError('problem selecting influence %s' % infl)
def startDraw(): sel = cmds.ls(sl=1, o=1) sel = sel[0] cmds.select(sel, r=True) mel.eval('MakePaintable;') vers = int(cmds.about(version=True)) if not cmds.currentCtx() == 'dynWireCtx1': mainPath = mel.eval('getenv "MAYA_LOCATION"') if vers > 2016: brushLoc = mainPath + '/Examples/Paint_Effects/Pens/ballpointRough.mel' else: brushLoc = mainPath + '/brushes/pens/ballpointRough.mel' mel.eval('copyBrushToSelected "' + brushLoc + '"') cmds.select(cl=True) loc = cmds.toolPropertyWindow(q=True, loc=True) if loc: mel.eval('ToggleToolSettings;') cmds.scriptJob(event=['DagObjectCreated', 'ldmt_pfxToCurves()'], compressUndo=True) cmds.scriptJob(event=['ToolChanged', 'ldmt_killPFXJob()'], runOnce=True)
def set_active(self): prop = cmds.toolPropertyWindow(q=True, loc=True) cmds.tabLayout(prop, e=True, selectTab=self.name)
def set_ui_parent(self): prop = cmds.toolPropertyWindow(q=True, loc=True) cmds.setParent(prop) return prop