Esempio n. 1
0
    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")
Esempio n. 2
0
    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)
Esempio n. 3
0
 def doCopy(self, reverse):
     with contexts.UndoChunk():
         self.copyWeights.copy(reverse)
Esempio n. 4
0
 def clusterLineOfAction(self):
     with contexts.UndoChunk():
         attach.clusterLineOfAction()
Esempio n. 5
0
 def createLineOfAction(self):
     with contexts.UndoChunk():
         create.createLineOfAction()
Esempio n. 6
0
 def doSelection(self):
     with contexts.UndoChunk():
         r = self.r.value()
         geometry.selectGeometryByProximity(r)
Esempio n. 7
0
 def mirrorLineOfAction(self):
     with contexts.UndoChunk():
         mirror.mirrorLineOfActionFromSelection()