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 doInflListPaintWeights(self,*args): ''' opens paint weights tool and paints on locally selected influence ''' if not Utils.isCurrentlyPaintingWeights(): cmds.ArtPaintSkinWeightsTool() self.doInfluenceListItemSelected()
def doInflListPaintWeights(self, *args): ''' opens paint weights tool and paints on locally selected influence ''' if not Utils.isCurrentlyPaintingWeights(): cmds.ArtPaintSkinWeightsTool() self.doInfluenceListItemSelected()