def copy(self, reverse=False): """ :param bool reverse: """ # validate source and target state, message = self.validate() if not state: raise ValueError(message) # get weights weights = self.weightsToList(cmds.getAttr(self.source)) # reverse weights if reverse: weights = [1-weight for weight in weights] # set weights based on weight type with contexts.UndoChunk(): if cmds.getAttr(self.target, type=True) == "doubleArray": # set weights cmds.setAttr(self.target, weights, type="doubleArray") elif cmds.getAttr(self.target, type=True) == "TdataCompound": # set weights weights = self.extendWeightsWithDefaultValues(weights, reverse) for i, weight in enumerate(weights): cmds.setAttr("{}[{}]".format(self.target, i), weight) else: raise ValueError("Weights cannot be set")
def setEnabledTissues(self, state): """ Loop all children of the container and set the zTissue node that is attached to the child nodes to the provided state. This function makes it easier to enable/disable large groups of tissues. :param bool state: """ with contexts.UndoChunk(): state = True if state == 2 else False num = self.childCount() for i in range(num): m = self.child(i) tissue = cmds.zQuery(m.widget.node, type="zTissue")[0] cmds.setAttr("{}.enable".format(tissue), state)
def doCopy(self, reverse): with contexts.UndoChunk(): self.copyWeights.copy(reverse)
def clusterLineOfAction(self): with contexts.UndoChunk(): attach.clusterLineOfAction()
def createLineOfAction(self): with contexts.UndoChunk(): create.createLineOfAction()
def doSelection(self): with contexts.UndoChunk(): r = self.r.value() geometry.selectGeometryByProximity(r)
def mirrorLineOfAction(self): with contexts.UndoChunk(): mirror.mirrorLineOfActionFromSelection()