コード例 #1
0
 def validate(self):
     if not self.ikfkControl:
         raise BuildActionError('ikfkControl must be set')
     if not self.follower:
         raise BuildActionError('follower must be set')
     if not self.ikLeader:
         raise BuildActionError('ikLeader must be set')
     if not self.fkLeader:
         raise BuildActionError('fkLeader must be set')
コード例 #2
0
    def run(self):
        ik_attr = self.ikfkControl.attr('ik')
        if not ik_attr:
            raise BuildActionError(
                f"ikfkControl has no IK attribute: {self.ikfkControl}")

        if self.preservePosition:
            follower_pm = self.follower.pm.get()
            fk_offset = follower_pm * self.fkLeader.wim.get()
            ik_offset = follower_pm * self.ikLeader.wim.get()
            fk_mtx = pulse.utilnodes.multMatrix(pm.dt.Matrix(fk_offset),
                                                self.fkLeader.wm)
            fk_mtx.node().rename(f"{self.follower.nodeName()}_ikfk_fk_offset")
            ik_mtx = pulse.utilnodes.multMatrix(pm.dt.Matrix(ik_offset),
                                                self.ikLeader.wm)
            ik_mtx.node().rename(f"{self.follower.nodeName()}_ikfk_ik_offset")
            mtx_choice = pulse.utilnodes.choice(ik_attr, fk_mtx, ik_mtx)
        else:
            mtx_choice = pulse.utilnodes.choice(ik_attr, self.fkLeader.wm,
                                                self.ikLeader.wm)

        mtx_choice.node().rename(f"{self.follower.nodeName()}_ikfk_choice")

        # don't preserve position here, because offsets have already been calculated above
        pulse.nodes.connectMatrix(mtx_choice, self.follower,
                                  pulse.nodes.ConnectMatrixMethod.SNAP)
コード例 #3
0
    def validate(self):
        if not self.function:
            raise BuildActionError("function name cannot be empty")
        blueprintFile = pm.sceneName()
        if not blueprintFile:
            raise BuildActionError(
                "File is not saved, could not determine scripts file path")
        moduleFilepath = os.path.splitext(blueprintFile)[0] + '_scripts.py'
        if not os.path.isfile(moduleFilepath):
            raise BuildActionError("Scripts file does not exist: %s" %
                                   moduleFilepath)

        func = self.importFunction(self.function, moduleFilepath)
        if func is None:
            raise BuildActionError(
                "function '%s' was not found in scripts file: %s" %
                (self.function, moduleFilepath))
コード例 #4
0
 def getSkinClusters(self):
     result = []
     for mesh in self.meshes:
         skin = pulse.skins.getSkinFromMesh(mesh)
         if not skin:
             raise BuildActionError(
                 f"No skin cluster found for mesh: {mesh}")
         result.append(skin)
     return result
コード例 #5
0
    def run(self):
        blueprintFile = self.builder.blueprintFile
        if not blueprintFile:
            raise BuildActionError(
                "Failed to get blueprint file name from builder")

        moduleFilepath = os.path.splitext(blueprintFile)[0] + '_scripts.py'
        func = self.importFunction(self.function, moduleFilepath)
        func(self)
コード例 #6
0
 def validate(self):
     if not self.ankleFollower:
         raise BuildActionError("ankleFollower is not set")
     if not self.toeFollower:
         raise BuildActionError("toeFollower is not set")
     if not self.control:
         raise BuildActionError("control is not set")
     if not self.toePivot:
         raise BuildActionError("toePivot is not set")
     if not self.ballPivot:
         raise BuildActionError("ballPivot is not set")
     if not self.outerTiltPivot:
         raise BuildActionError("outerTiltPivot is not set")
     if not self.innerTiltPivot:
         raise BuildActionError("innerTiltPivot is not set")
     if not self.heelPivot:
         raise BuildActionError("heelPivot is not set")
コード例 #7
0
 def validate(self):
     if not self.follower:
         raise BuildActionError("follower is not set")
     if not self.toeFollower:
         raise BuildActionError("toeFollower is not set")
     if not self.control:
         raise BuildActionError("control is not set")
     if not self.liftControl:
         raise BuildActionError("liftControl is not set")
     if not self.toePivot:
         raise BuildActionError("toePivot is not set")
     if not self.ballPivot:
         raise BuildActionError("ballPivot is not set")
     if not self.heelPivot:
         raise BuildActionError("heelPivot is not set")
コード例 #8
0
 def validate(self):
     if not self.endJoint:
         raise BuildActionError('endJoint must be set')
     if not self.rootCtl:
         raise BuildActionError('rootCtl must be set')
     if not self.midCtlIk:
         raise BuildActionError('midCtlIk must be set')
     if not self.midCtlFk:
         raise BuildActionError('midCtlFk must be set')
     if not self.endCtlIk:
         raise BuildActionError('endCtlIk must be set')
     if not self.endCtlFk:
         raise BuildActionError('endCtlFk must be set')
コード例 #9
0
    def getParentMatrix(self, node):
        """
        Return the parent world matrix to use for a node, checking first for inputs to offsetParentMatrix,
        then for a parent node if available. Does not support nodes that have a connection to offsetParentMatrix
        while also having inheritsTransform set to True.
        """
        # look for and use input to offsetParentMatrix if available
        offset_mtx_inputs = node.offsetParentMatrix.inputs(plugs=True)
        if offset_mtx_inputs:
            if node.inheritsTransform.get():
                raise BuildActionError(
                    f"{node} cannot have an offsetParentMatrix connection "
                    "while also having inheritsTransform set to True")
            return offset_mtx_inputs[0]

        # get matrix from parent node
        parent_node = node.getParent()
        if parent_node:
            return parent_node.wm

        # no parent, use identity matrix
        return pm.dt.Matrix()
コード例 #10
0
 def validate(self):
     if not self.node:
         raise BuildActionError("node must be set")
     if not self.spaces:
         raise BuildActionError("spaces must have at least one value")
コード例 #11
0
 def validate(self):
     if not self.leader:
         raise BuildActionError("leader must be set")
     if not self.follower:
         raise BuildActionError("follower must be set")
コード例 #12
0
 def validate(self):
     if not len(self.name):
         raise BuildActionError('name cannot be empty')
コード例 #13
0
 def validate(self):
     if not len(self.meshes):
         raise BuildActionError('meshes must have at least one value')
     filePath = self.getWeightsFilePath()
     if not os.path.isfile(filePath):
         raise BuildActionError('file not found: %s' % filePath)
コード例 #14
0
 def validate(self):
     if not self.twistJoint:
         raise BuildActionError('twistJoint must be set')
     if not self.alignJoint:
         raise BuildActionError('alignJoint must be set')
コード例 #15
0
 def validate(self):
     if not len(self.meshes):
         raise BuildActionError('meshes must have at least one value')
     bind_jnts = self.getBindJoints()
     if not len(bind_jnts):
         raise BuildActionError('no bind joints were set')
コード例 #16
0
 def validate(self):
     if not resetter:
         raise BuildActionError('resetter module is not installed')
コード例 #17
0
 def validate(self):
     if not self.ctl1 and not self.ctl2 and not self.ctl3 and not self.ctl4:
         raise BuildActionError("No controls were given")
コード例 #18
0
 def validate(self):
     if not self.rootJoint:
         raise BuildActionError('rootJoint must be set')
コード例 #19
0
 def validate(self):
     if not self.node:
         raise BuildActionError("node must be set")
     if not self.name:
         raise BuildActionError("name cannot be empty")
コード例 #20
0
 def validate(self):
     if not self.controlNode:
         raise BuildActionError('controlNode is not set')
コード例 #21
0
 def validate(self):
     if not self.filename:
         raise BuildActionError('Filename cannot be empty')