def doPlugin(self, File): if File == 'ngRelax': ver = int(cmds.about(v=1)) if ver<2017 or ver>2020: om.MGlobal.displayError(u'仅支持2017-2020') return if cmds.pluginInfo('ngSkinTools.mll', q=1, l=1): cmds.ngSkinRelax() return plugName = '%s%s.mll' %(File, ver) if not cmds.pluginInfo(plugName, q=1, l=1): cmds.loadPlugin('%s/MyToolBox/plugin/%s' %(os.getenv('ALLUSERSPROFILE'), plugName), qt=1) cmds.ngSkinRelax()
def execRelax(self,*args): ''' relax button click handler. this is where it actually executes skin relax, whoop-tee-doo. ''' try: args = {} args['numSteps']=self.controls.numSteps.getValue() args['stepSize']=self.controls.stepSize.getValue() # do we need soft selection? self.controls.softSelection.addToArgs(args) # do we need volume association? if self.controls.useVolumeAssociation.getValue(): args['abv']=1 args['avr']=self.controls.volumeAssociationRadius.getValue() # add selection+highlight as arguments # we need highlight as second argument because # other meshes for simulation might be included only through highlight. # # This will never be an empty list as we tested for vertex selection available earlier def makeList(listOrNull): if listOrNull is None: return [] return listOrNull objects = makeList(cmds.ls(sl=True))+makeList(cmds.ls(hl=True)) if len(objects)==0: raise MessageException("Nothing is selected") # execute stuff try: cmds.waitCursor(state=True) cmds.ngSkinRelax(objects,**args) finally: cmds.waitCursor(state=False) Utils.refreshPaintWeightsTool() except MessageException,err: raise err
def execRelax(self, *args): ''' relax button click handler. this is where it actually executes skin relax, whoop-tee-doo. ''' try: args = {} args['numSteps'] = self.controls.numSteps.getValue() args['stepSize'] = self.controls.stepSize.getValue() # do we need soft selection? self.controls.softSelection.addToArgs(args) # do we need volume association? if self.controls.useVolumeAssociation.getValue(): args['abv'] = 1 args['avr'] = self.controls.volumeAssociationRadius.getValue() # add selection+highlight as arguments # we need highlight as second argument because # other meshes for simulation might be included only through highlight. # # This will never be an empty list as we tested for vertex selection available earlier def makeList(listOrNull): if listOrNull is None: return [] return listOrNull objects = makeList(cmds.ls(sl=True)) + makeList(cmds.ls(hl=True)) if len(objects) == 0: raise MessageException("Nothing is selected") # execute stuff try: cmds.waitCursor(state=True) cmds.ngSkinRelax(objects, **args) finally: cmds.waitCursor(state=False) Utils.refreshPaintWeightsTool() except MessageException, err: raise err