def paint(mesh, influence): """ Initialize the remove influence context. Once this command is run the context will be set as the active tool. :param str mesh: :param str influence: """ # initialize paint tool cmds.paintRemoveInfluenceCtxInitialize(mesh, influence) # initialize context if not cmds.artSelectCtx(CONTEXT, query=True, exists=True): cmds.artSelectCtx(CONTEXT) cmds.artSelectCtx(CONTEXT, edit=True, beforeStrokeCmd=CONTEXT_BEFORE, afterStrokeCmd=CONTEXT_AFTER, selectop="unselect", outwhilepaint=True, brushfeedback=False) # set tool cmds.setToolTo(CONTEXT)
def selectTool(self): selectAttributes = [ ('Normal', 'options = 4'), ('Reflection', '.options = 4') ] paintAttributes = [ ('Select', 'options = 4'), ('Soft Select', '.options = 4'), ('Brush Size', '.options = 4') ] try: if Cache.keyOffset == 0: cmds.selectContext('mySelect', edit = True) Cache.currentContext = 'mySelect' self.setAttributes ( selectAttributes ) elif Cache.keyOffset == 1: cmds.artSelectCtx('myPaintSelect', edit = True) Cache.currentContext = 'myPaintSelect' self.setAttributes ( paintAttributes ) elif Cache.keyOffset == 2: Cache.currentContext = 'selectDragger' self.primitiveTool() except: if Cache.keyOffset == 0: cmds.selectContext ( 'mySelect' ) Cache.currentContext = 'mySelect' self.setAttributes ( selectAttributes ) elif Cache.keyOffset == 1: cmds.artSelectCtx ( 'myPaintSelect' ) Cache.currentContext = 'myPaintSelect' self.setAttributes ( paintAttributes ) elif Cache.keyOffset == 2: Cache.currentContext = 'selectDragger' self.primitiveTool() if Cache.currentContext != 'selectDragger': cmds.setToolTo( Cache.currentContext )
def selectTool(self): selectAttributes = [('Normal', 'options = 4'), ('Reflection', '.options = 4')] paintAttributes = [('Select', 'options = 4'), ('Soft Select', '.options = 4'), ('Brush Size', '.options = 4')] try: if Cache.keyOffset == 0: cmds.selectContext('mySelect', edit=True) Cache.currentContext = 'mySelect' self.setAttributes(selectAttributes) elif Cache.keyOffset == 1: cmds.artSelectCtx('myPaintSelect', edit=True) Cache.currentContext = 'myPaintSelect' self.setAttributes(paintAttributes) elif Cache.keyOffset == 2: Cache.currentContext = 'selectDragger' self.primitiveTool() except: if Cache.keyOffset == 0: cmds.selectContext('mySelect') Cache.currentContext = 'mySelect' self.setAttributes(selectAttributes) elif Cache.keyOffset == 1: cmds.artSelectCtx('myPaintSelect') Cache.currentContext = 'myPaintSelect' self.setAttributes(paintAttributes) elif Cache.keyOffset == 2: Cache.currentContext = 'selectDragger' self.primitiveTool() if Cache.currentContext != 'selectDragger': cmds.setToolTo(Cache.currentContext)