当前位置: 首页>>代码示例>>Python>>正文


Python KLOperator.setOutput方法代码示例

本文整理汇总了Python中kraken.core.objects.operators.kl_operator.KLOperator.setOutput方法的典型用法代码示例。如果您正苦于以下问题:Python KLOperator.setOutput方法的具体用法?Python KLOperator.setOutput怎么用?Python KLOperator.setOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kraken.core.objects.operators.kl_operator.KLOperator的用法示例。


在下文中一共展示了KLOperator.setOutput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]
    def __init__(self, name='Clavicle', parent=None):

        Profiler.getInstance().push("Construct Clavicle Rig Component:" + name)
        super(FabriceClavicleRig, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        # Clavicle
        self.clavicleCtrlSpace = CtrlSpace('clavicle', parent=self.ctrlCmpGrp)
        self.clavicleCtrl = Control('clavicle', parent=self.clavicleCtrlSpace, shape="cube")
        self.clavicleCtrl.alignOnXAxis()


        # ==========
        # Deformers
        # ==========
        deformersLayer = self.getOrCreateLayer('deformers')
        defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
        self.ctrlCmpGrp.setComponent(self)

        self.clavicleDef = Joint('clavicle', parent=defCmpGrp)
        self.clavicleDef.setComponent(self)


        # ==============
        # Constrain I/O
        # ==============
        # Constraint inputs
        clavicleInputConstraint = PoseConstraint('_'.join([self.clavicleCtrl.getName(), 'To', self.spineEndInputTgt.getName()]))
        clavicleInputConstraint.setMaintainOffset(True)
        clavicleInputConstraint.addConstrainer(self.spineEndInputTgt)
        self.clavicleCtrlSpace.addConstraint(clavicleInputConstraint)

        # Constraint outputs
        clavicleConstraint = PoseConstraint('_'.join([self.clavicleOutputTgt.getName(), 'To', self.clavicleCtrl.getName()]))
        clavicleConstraint.addConstrainer(self.clavicleCtrl)
        self.clavicleOutputTgt.addConstraint(clavicleConstraint)


        # ===============
        # Add Splice Ops
        # ===============
        # Add Deformer Splice Op
        spliceOp = KLOperator('clavicleDeformerKLOp', 'PoseConstraintSolver', 'Kraken')
        self.addOperator(spliceOp)

        # Add Att Inputs
        spliceOp.setInput('drawDebug', self.drawDebugInputAttr)
        spliceOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        spliceOp.setInput('constrainer', self.clavicleOutputTgt)

        # Add Xfo Outputs
        spliceOp.setOutput('constrainee', self.clavicleDef)

        Profiler.getInstance().pop()
开发者ID:Leopardob,项目名称:Kraken,代码行数:61,代码来源:fabrice_clavicle.py

示例2: addFinger

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]
    def addFinger(self, name, data):

        fingerCtrls = []
        fingerJoints = []

        parentCtrl = self.handCtrl
        for i, joint in enumerate(data):
            if i == 0:
                jointName = name + 'Meta'
            else:
                jointName = name + str(i).zfill(2)

            jointXfo = joint.get('xfo', Xfo())
            jointCrvData = joint.get('curveData')

            # Create Controls
            newJointCtrlSpace = CtrlSpace(jointName, parent=parentCtrl)
            newJointCtrl = Control(jointName, parent=newJointCtrlSpace, shape='square')
            newJointCtrl.lockScale(True, True, True)
            newJointCtrl.lockTranslation(True, True, True)

            if jointCrvData is not None:
                newJointCtrl.setCurveData(jointCrvData)

            fingerCtrls.append(newJointCtrl)

            # Create Deformers
            jointDef = Joint(jointName, parent=self.defCmpGrp)
            fingerJoints.append(jointDef)

            # Create Constraints

            # Set Xfos
            newJointCtrlSpace.xfo = jointXfo
            newJointCtrl.xfo = jointXfo

            parentCtrl = newJointCtrl


        # =================
        # Create Operators
        # =================
        # Add Deformer KL Op
        deformersToCtrlsKLOp = KLOperator(name + 'DeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(deformersToCtrlsKLOp)

        # Add Att Inputs
        deformersToCtrlsKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        deformersToCtrlsKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        deformersToCtrlsKLOp.setInput('constrainers', fingerCtrls)

        # Add Xfo Outputs
        deformersToCtrlsKLOp.setOutput('constrainees', fingerJoints)

        return deformersToCtrlsKLOp
开发者ID:AbedSHP,项目名称:Kraken,代码行数:59,代码来源:hand_component.py

示例3: TentacleComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
        # ===============
        # Add Splice Ops
        # ===============
        # Add Splice Op
        self.tentacleSolverKLOp = KLOperator('tentacleKLOp', 'TentacleSolver', 'Kraken')
        self.addOperator(self.tentacleSolverKLOp)

        # # Add Att Inputs
        self.tentacleSolverKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.tentacleSolverKLOp.setInput('rigScale', self.rigScaleInputAttr)
        self.tentacleSolverKLOp.setInput('ikblend', fkikInputAttr)
        self.tentacleSolverKLOp.setInput('waveLength_Y', waveLength_YInputAttr)
        self.tentacleSolverKLOp.setInput('waveAmplitude_Y', waveAmplitude_YInputAttr)
        self.tentacleSolverKLOp.setInput('waveFrequency_Y', waveFrequency_YInputAttr)
        self.tentacleSolverKLOp.setInput('waveLength_Z', waveLength_ZInputAttr)
        self.tentacleSolverKLOp.setInput('waveAmplitude_Z', waveAmplitude_ZInputAttr)
        self.tentacleSolverKLOp.setInput('waveFrequency_Z', waveFrequency_ZInputAttr)
        self.tentacleSolverKLOp.setInput('tipBias', tipBiasInputAttr)

        self.tentacleSolverKLOp.setInput('springStrength', springStrengthInputAttr)
        self.tentacleSolverKLOp.setInput('dampening', dampeningInputAttr)
        self.tentacleSolverKLOp.setInput('simulationWeight', simulationWeightInputAttr)
        self.tentacleSolverKLOp.setInput('softLimitBounds', softLimitBoundsInputAttr)

        self.tentacleSolverKLOp.setInput('tipBoneLen', self.tipBoneLenInputAttr)

        # Add Xfo Inputs
        self.tentacleSolverKLOp.setInput('chainBase', self.chainBase)
        self.tentacleSolverKLOp.setInput('ikgoal', self.tentacleIKCtrl)

        self.tentacleSolverKLOp.setInput('fkcontrols', self.fkCtrls)

        # Add Xfo Outputs
        self.tentacleSolverKLOp.setOutput('pose', self.boneOutputsTgt)

        self.tentacleSolverKLOp.setOutput('tentacleEnd', self.tentacleEndXfoOutputTgt)


        # Add Deformer Splice Op
        self.outputsToDeformersKLOp = KLOperator('TentacleDeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(self.outputsToDeformersKLOp)

        # Add Att Inputs
        self.outputsToDeformersKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.outputsToDeformersKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.outputsToDeformersKLOp.setInput('constrainers', self.boneOutputsTgt)

        # Add Xfo Outputs
        self.outputsToDeformersKLOp.setOutput('constrainees', self.deformerJoints)

        Profiler.getInstance().pop()


    def setNumControls(self, numControls):

        # Add new control spaces and controls
        for i in xrange(len(self.fkCtrlSpaces), numControls):
            if i==0:
                parent = self.ctrlCmpGrp
            else:
                parent = self.fkCtrls[i - 1]

            boneName = 'bone' + str(i + 1).zfill(2) + 'FK'
            fkCtrlSpace = CtrlSpace(boneName, parent=parent)
开发者ID:Leopardob,项目名称:Kraken,代码行数:70,代码来源:tentacle_component.py

示例4: ArmComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
        self.handCtrlSpaceConstraint.setMaintainOffset(True)
        self.handCtrlSpaceConstraint.addConstrainer(self.armEndXfoOutputTgt)
        self.handCtrlSpace.addConstraint(self.handCtrlSpaceConstraint)


        # ===============
        # Add Splice Ops
        # ===============
        # Add Splice Op
        self.spliceOp = KLOperator('armKLOp', 'TwoBoneIKSolver', 'Kraken')
        self.addOperator(self.spliceOp)

        # Add Att Inputs
        self.spliceOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.spliceOp.setInput('rigScale', self.rigScaleInputAttr)

        self.spliceOp.setInput('bone0Len', self.armBone0LenInputAttr)
        self.spliceOp.setInput('bone1Len', self.armBone1LenInputAttr)
        self.spliceOp.setInput('ikblend', armIKBlendInputAttr)
        self.spliceOp.setInput('softIK', armSoftIKInputAttr)
        self.spliceOp.setInput('softDist', armSoftDistInputAttr)
        self.spliceOp.setInput('stretch', armStretchInputAttr)
        self.spliceOp.setInput('stretchBlend', armStretchBlendInputAttr)
        self.spliceOp.setInput('rightSide', self.rightSideInputAttr)

        # Add Xfo Inputs
        self.spliceOp.setInput('root', self.clavicleEndInputTgt)
        self.spliceOp.setInput('bone0FK', self.bicepFKCtrl)
        self.spliceOp.setInput('bone1FK', self.forearmFKCtrl)
        self.spliceOp.setInput('ikHandle', self.armIKCtrl)
        self.spliceOp.setInput('upV', self.armUpVCtrl)

        # Add Xfo Outputs
        self.spliceOp.setOutput('bone0Out', self.bicepOutputTgt)
        self.spliceOp.setOutput('bone1Out', self.forearmOutputTgt)
        self.spliceOp.setOutput('bone2Out', self.armEndXfoOutputTgt)


        # Add Deformer Splice Op
        self.outputsToDeformersKLOp = KLOperator('armDeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(self.outputsToDeformersKLOp)

        # Add Att Inputs
        self.outputsToDeformersKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.outputsToDeformersKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.outputsToDeformersKLOp.setInput('constrainers', [self.bicepOutputTgt, self.forearmOutputTgt, self.armEndXfoOutputTgt, self.handOutputTgt])

        # Add Xfo Outputs
        self.outputsToDeformersKLOp.setOutput('constrainees', [bicepDef, forearmDef, wristDef, handDef])

        Profiler.getInstance().pop()


    def loadData(self, data=None):
        """Load a saved guide representation from persisted data.

        Arguments:
        data -- object, The JSON data object.

        Return:
        True if successful.

        """
开发者ID:Leopardob,项目名称:Kraken,代码行数:69,代码来源:arm_component.py

示例5: __init__

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]
    def __init__(self, name="neck", parent=None):

        Profiler.getInstance().push("Construct Neck Rig Component:" + name)
        super(NeckComponentRig, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        # Neck
        self.neckCtrlSpace = CtrlSpace('neck', parent=self.ctrlCmpGrp)
        self.neckCtrl = Control('neck', parent=self.neckCtrlSpace, shape="pin")
        self.neckCtrl.scalePoints(Vec3(1.25, 1.25, 1.25))
        self.neckCtrl.translatePoints(Vec3(0, 0, -0.5))
        self.neckCtrl.rotatePoints(90, 0, 90)
        self.neckCtrl.setColor("orange")


        # ==========
        # Deformers
        # ==========
        deformersLayer = self.getOrCreateLayer('deformers')
        defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)

        neckDef = Joint('neck', parent=defCmpGrp)
        neckDef.setComponent(self)


        # ==============
        # Constrain I/O
        # ==============
        # Constraint inputs
        clavicleInputConstraint = PoseConstraint('_'.join([self.neckCtrlSpace.getName(), 'To', self.neckBaseInputTgt.getName()]))
        clavicleInputConstraint.setMaintainOffset(True)
        clavicleInputConstraint.addConstrainer(self.neckBaseInputTgt)
        self.neckCtrlSpace.addConstraint(clavicleInputConstraint)

        # Constraint outputs
        neckOutputConstraint = PoseConstraint('_'.join([self.neckOutputTgt.getName(), 'To', self.neckCtrl.getName()]))
        neckOutputConstraint.addConstrainer(self.neckCtrl)
        self.neckOutputTgt.addConstraint(neckOutputConstraint)

        neckEndConstraint = PoseConstraint('_'.join([self.neckEndOutputTgt.getName(), 'To', self.neckCtrl.getName()]))
        neckEndConstraint.addConstrainer(self.neckCtrl)
        self.neckEndOutputTgt.addConstraint(neckEndConstraint)


        # ===============
        # Add Splice Ops
        # ===============
        #Add Deformer Splice Op
        spliceOp = KLOperator('neckDeformerKLOp', 'PoseConstraintSolver', 'Kraken')
        self.addOperator(spliceOp)

        # Add Att Inputs
        spliceOp.setInput('drawDebug', self.drawDebugInputAttr)
        spliceOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputstrl)
        spliceOp.setInput('constrainer', self.neckEndOutputTgt)

        # Add Xfo Outputs
        spliceOp.setOutput('constrainee', neckDef)

        Profiler.getInstance().pop()
开发者ID:Leopardob,项目名称:Kraken,代码行数:67,代码来源:neck_component.py

示例6: LegComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
        self.toeOutputConstraint = PoseConstraint('_'.join([self.toeOutputTgt.getName(), 'To', self.toeCtrl.getName()]))
        self.toeOutputConstraint.addConstrainer(self.toeCtrl)
        self.toeOutputTgt.addConstraint(self.toeOutputConstraint)


        # ===============
        # Add Splice Ops
        # ===============
        # Add Leg Splice Op
        self.legIKKLOp = KLOperator('legKLOp', 'TwoBoneIKSolver', 'Kraken')
        self.addOperator(self.legIKKLOp)

        # Add Att Inputs
        self.legIKKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.legIKKLOp.setInput('rigScale', self.rigScaleInputAttr)

        self.legIKKLOp.setInput('bone0Len', self.legBone0LenInputAttr)
        self.legIKKLOp.setInput('bone1Len', self.legBone1LenInputAttr)
        self.legIKKLOp.setInput('ikblend', legIKBlendInputAttr)
        self.legIKKLOp.setInput('softIK', legSoftIKInputAttr)
        self.legIKKLOp.setInput('softDist', legSoftDistInputAttr)
        self.legIKKLOp.setInput('stretch', legStretchInputAttr)
        self.legIKKLOp.setInput('stretchBlend', legStretchBlendInputAttr)
        self.legIKKLOp.setInput('rightSide', self.rightSideInputAttr)

        # Add Xfo Inputs
        self.legIKKLOp.setInput('root', self.legPelvisInputTgt)
        self.legIKKLOp.setInput('bone0FK', self.femurFKCtrl)
        self.legIKKLOp.setInput('bone1FK', self.shinFKCtrl)
        self.legIKKLOp.setInput('ikHandle', self.legIKCtrl)
        self.legIKKLOp.setInput('upV', self.legUpVCtrl)

        # Add Xfo Outputs
        self.legIKKLOp.setOutput('bone0Out', self.femurOutputTgt)
        self.legIKKLOp.setOutput('bone1Out', self.shinOutputTgt)
        self.legIKKLOp.setOutput('bone2Out', self.legEndXfoOutputTgt)


        # Add Leg Deformer Splice Op
        self.outputsToDeformersKLOp = KLOperator('legDeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(self.outputsToDeformersKLOp)

        # Add Att Inputs
        self.outputsToDeformersKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.outputsToDeformersKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.outputsToDeformersKLOp.setInput('constrainers', [self.femurOutputTgt, self.shinOutputTgt, self.legEndXfoOutputTgt])

        # Add Xfo Outputs
        self.outputsToDeformersKLOp.setOutput('constrainees', [femurDef, shinDef, ankleDef])

        # Add Foot Deformer Splice Op
        self.footDefKLOp = KLOperator('footDeformerKLOp', 'PoseConstraintSolver', 'Kraken')
        self.addOperator(self.footDefKLOp)

        # Add Att Inputs
        self.footDefKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.footDefKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs)
        self.footDefKLOp.setInput('constrainer', self.footOutputTgt)

        # Add Xfo Outputs
        self.footDefKLOp.setOutput('constrainee', self.footDef)
开发者ID:Leopardob,项目名称:Kraken,代码行数:69,代码来源:leg_component.py

示例7: HeadComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
        self.headCtrlSpace.addConstraint(self.headInputConstraint)

        # Constraint outputs
        self.headOutputConstraint = PoseConstraint('_'.join([self.headOutputTgt.getName(), 'To', self.headCtrl.getName()]))
        self.headOutputConstraint.addConstrainer(self.headCtrl)
        self.headOutputTgt.addConstraint(self.headOutputConstraint)

        self.jawOutputConstraint = PoseConstraint('_'.join([self.jawOutputTgt.getName(), 'To', self.jawCtrl.getName()]))
        self.jawOutputConstraint.addConstrainer(self.jawCtrl)
        self.jawOutputTgt.addConstraint(self.jawOutputConstraint)

        self.eyeLOutputConstraint = PoseConstraint('_'.join([self.eyeLOutputTgt.getName(), 'To', self.eyeLeftCtrl.getName()]))
        self.eyeLOutputConstraint.addConstrainer(self.eyeLeftCtrl)
        self.eyeLOutputTgt.addConstraint(self.eyeLOutputConstraint)

        self.eyeROutputConstraint = PoseConstraint('_'.join([self.eyeROutputTgt.getName(), 'To', self.eyeRightCtrl.getName()]))
        self.eyeROutputConstraint.addConstrainer(self.eyeRightCtrl)
        self.eyeROutputTgt.addConstraint(self.eyeROutputConstraint)

        # Add Eye Left Direction KL Op
        self.eyeLeftDirKLOp = KLOperator('eyeLeftDirKLOp', 'DirectionConstraintSolver', 'Kraken')
        self.addOperator(self.eyeLeftDirKLOp)

        # Add Att Inputs
        self.eyeLeftDirKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.eyeLeftDirKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.eyeLeftDirKLOp.setInput('position', self.eyeLeftBase)
        self.eyeLeftDirKLOp.setInput('upVector', self.eyeLeftUpV)
        self.eyeLeftDirKLOp.setInput('atVector', self.eyeLeftAtV)

        # Add Xfo Outputs
        self.eyeLeftDirKLOp.setOutput('constrainee', self.eyeLeftCtrlSpace)

        # Add Eye Right Direction KL Op
        self.eyeRightDirKLOp = KLOperator('eyeRightDirKLOp', 'DirectionConstraintSolver', 'Kraken')
        self.addOperator(self.eyeRightDirKLOp)

        # Add Att Inputs
        self.eyeRightDirKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.eyeRightDirKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.eyeRightDirKLOp.setInput('position', self.eyeRightBase)
        self.eyeRightDirKLOp.setInput('upVector', self.eyeRightUpV)
        self.eyeRightDirKLOp.setInput('atVector', self.eyeRightAtV)

        # Add Xfo Outputs
        self.eyeRightDirKLOp.setOutput('constrainee', self.eyeRightCtrlSpace)


        # Add Deformer Joints KL Op
        self.outputsToDeformersKLOp = KLOperator('headDeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(self.outputsToDeformersKLOp)

        # Add Att Inputs
        self.outputsToDeformersKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.outputsToDeformersKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.outputsToDeformersKLOp.setInput('constrainers', [self.headOutputTgt, self.jawOutputTgt, self.eyeROutputTgt, self.eyeLOutputTgt])

        # Add Xfo Outputs
        self.outputsToDeformersKLOp.setOutput('constrainees', [headDef, jawDef, eyeRightDef, eyeLeftDef])
开发者ID:AbedSHP,项目名称:Kraken,代码行数:69,代码来源:head_component.py

示例8: SpineComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........

        self.spineBaseOutputConstraint = PoseConstraint('_'.join([self.spineBaseOutputTgt.getName(), 'To', 'spineBase']))
        self.spineBaseOutputConstraint.addConstrainer(self.spineOutputs[0])
        self.spineBaseOutputTgt.addConstraint(self.spineBaseOutputConstraint)

        self.pelvisOutputConstraint = PoseConstraint('_'.join([self.pelvisOutputTgt.getName(), 'To', self.pelvisCtrl.getName()]))
        self.pelvisOutputConstraint.addConstrainer(self.pelvisCtrl)
        self.pelvisOutputTgt.addConstraint(self.pelvisOutputConstraint)

        self.spineEndOutputConstraint = PoseConstraint('_'.join([self.spineEndOutputTgt.getName(), 'To', 'spineEnd']))
        self.spineEndOutputConstraint.addConstrainer(self.spineOutputs[0])
        self.spineEndOutputTgt.addConstraint(self.spineEndOutputConstraint)


        # ===============
        # Add Splice Ops
        # ===============
        # Add Spine Splice Op
        self.bezierSpineKLOp = KLOperator('spineKLOp', 'BezierSpineSolver', 'Kraken')
        self.addOperator(self.bezierSpineKLOp)

        # Add Att Inputs
        self.bezierSpineKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.bezierSpineKLOp.setInput('rigScale', self.rigScaleInputAttr)
        self.bezierSpineKLOp.setInput('length', self.lengthInputAttr)

        # Add Xfo Inputs
        self.bezierSpineKLOp.setInput('base', self.spine01Ctrl)
        self.bezierSpineKLOp.setInput('baseHandle', self.spine02Ctrl)
        self.bezierSpineKLOp.setInput('tipHandle', self.spine03Ctrl)
        self.bezierSpineKLOp.setInput('tip', self.spine04Ctrl)

        # Add Xfo Outputs
        self.bezierSpineKLOp.setOutput('outputs', self.spineOutputs)

        # Add Deformer Splice Op
        self.deformersToOutputsKLOp = KLOperator('spineDeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(self.deformersToOutputsKLOp)

        # Add Att Inputs
        self.deformersToOutputsKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.deformersToOutputsKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Outputs
        self.deformersToOutputsKLOp.setInput('constrainers', self.spineOutputs)

        # Add Xfo Outputs
        self.deformersToOutputsKLOp.setOutput('constrainees', self.deformerJoints)

        # Add Pelvis Splice Op
        self.pelvisDefKLOp = KLOperator('pelvisDeformerKLOp', 'PoseConstraintSolver', 'Kraken')
        self.addOperator(self.pelvisDefKLOp)

        # Add Att Inputs
        self.pelvisDefKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.pelvisDefKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.pelvisDefKLOp.setInput('constrainer', self.pelvisOutputTgt)

        # Add Xfo Outputs
        self.pelvisDefKLOp.setOutput('constrainee', pelvisDef)


        Profiler.getInstance().pop()
开发者ID:AbedSHP,项目名称:Kraken,代码行数:69,代码来源:spine_component.py

示例9: FabriceHeadRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]
class FabriceHeadRig(FabriceHead):
    """Fabrice Head Component Rig"""

    def __init__(self, name='head', parent=None):

        Profiler.getInstance().push("Construct Head Rig Component:" + name)
        super(FabriceHeadRig, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        # Head Aim
        self.headAimCtrlSpace = CtrlSpace('headAim', parent=self.ctrlCmpGrp)
        self.headAimCtrl = Control('headAim', parent=self.headAimCtrlSpace, shape="sphere")
        self.headAimCtrl.scalePoints(Vec3(0.35, 0.35, 0.35))
        self.headAimCtrl.lockScale(x=True, y=True, z=True)

        self.headAimUpV = Locator('headAimUpV', parent=self.headAimCtrl)
        self.headAimUpV.setShapeVisibility(False)

        # Head
        self.headAim = Locator('headAim', parent=self.ctrlCmpGrp)
        self.headAim.setShapeVisibility(False)

        self.headCtrlSpace = CtrlSpace('head', parent=self.ctrlCmpGrp)
        self.headCtrl = Control('head', parent=self.headCtrlSpace, shape="circle")
        self.headCtrl.lockTranslation(x=True, y=True, z=True)
        self.headCtrl.lockScale(x=True, y=True, z=True)

        # Jaw
        self.jawCtrlSpace = CtrlSpace('jawCtrlSpace', parent=self.headCtrl)
        self.jawCtrl = Control('jaw', parent=self.jawCtrlSpace, shape="cube")
        self.jawCtrl.lockTranslation(x=True, y=True, z=True)
        self.jawCtrl.lockScale(x=True, y=True, z=True)
        self.jawCtrl.setColor("orange")

        # ==========
        # Deformers
        # ==========
        deformersLayer = self.getOrCreateLayer('deformers')
        defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
        self.addItem('defCmpGrp', self.defCmpGrp)

        headDef = Joint('head', parent=defCmpGrp)
        headDef.setComponent(self)

        jawDef = Joint('jaw', parent=defCmpGrp)
        jawDef.setComponent(self)


        # ==============
        # Constrain I/O
        # ==============
        self.headToAimConstraint = PoseConstraint('_'.join([self.headCtrlSpace.getName(), 'To', self.headAim.getName()]))
        self.headToAimConstraint.setMaintainOffset(True)
        self.headToAimConstraint.addConstrainer(self.headAim)
        self.headCtrlSpace.addConstraint(self.headToAimConstraint)

        # Constraint inputs
        self.headAimInputConstraint = PoseConstraint('_'.join([self.headAimCtrlSpace.getName(), 'To', self.headBaseInputTgt.getName()]))
        self.headAimInputConstraint.setMaintainOffset(True)
        self.headAimInputConstraint.addConstrainer(self.headBaseInputTgt)
        self.headAimCtrlSpace.addConstraint(self.headAimInputConstraint)

        # # Constraint outputs
        self.headOutputConstraint = PoseConstraint('_'.join([self.headOutputTgt.getName(), 'To', self.headCtrl.getName()]))
        self.headOutputConstraint.addConstrainer(self.headCtrl)
        self.headOutputTgt.addConstraint(self.headOutputConstraint)

        self.jawOutputConstraint = PoseConstraint('_'.join([self.jawOutputTgt.getName(), 'To', self.jawCtrl.getName()]))
        self.jawOutputConstraint.addConstrainer(self.jawCtrl)
        self.jawOutputTgt.addConstraint(self.jawOutputConstraint)

        # ==============
        # Add Operators
        # ==============

        # Add Aim Canvas Op
        # =================
        self.headAimCanvasOp = CanvasOperator('headAimCanvasOp', 'Kraken.Solvers.DirectionConstraintSolver')
        self.addOperator(self.headAimCanvasOp)

        # Add Att Inputs
        self.headAimCanvasOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.headAimCanvasOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.headAimCanvasOp.setInput('position', self.headBaseInputTgt)
        self.headAimCanvasOp.setInput('upVector', self.headAimUpV)
        self.headAimCanvasOp.setInput('atVector', self.headAimCtrl)

        # Add Xfo Outputs
        self.headAimCanvasOp.setOutput('constrainee', self.headAim)

        # Add Deformer KL Op
        # ==================
        self.deformersToOutputsKLOp = KLOperator('headDeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(self.deformersToOutputsKLOp)

#.........这里部分代码省略.........
开发者ID:AbedSHP,项目名称:Kraken,代码行数:103,代码来源:fabrice_head.py

示例10: FabriceTailRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]
class FabriceTailRig(FabriceTail):
    """Fabrice Tail Component"""

    def __init__(self, name="fabriceTail", parent=None):

        Profiler.getInstance().push("Construct Tail Rig Component:" + name)
        super(FabriceTailRig, self).__init__(name, parent)


        # =========
        # Controls
        # =========

        # Tail Base
        # self.tailBaseCtrlSpace = CtrlSpace('tailBase', parent=self.ctrlCmpGrp)
        # self.tailBaseCtrl = Control('tailBase', parent=self.tailBaseCtrlSpace, shape="circle")
        # self.tailBaseCtrl.rotatePoints(90, 0, 0)
        # self.tailBaseCtrl.scalePoints(Vec3(2.0, 2.0, 2.0))
        # self.tailBaseCtrl.setColor("greenBlue")

        # Tail Base Handle
        self.tailBaseHandleCtrlSpace = CtrlSpace('tailBaseHandle', parent=self.ctrlCmpGrp)
        self.tailBaseHandleCtrl = Control('tailBaseHandle', parent=self.tailBaseHandleCtrlSpace, shape="pin")
        self.tailBaseHandleCtrl.lockScale(x=True, y=True, z=True)
        self.tailBaseHandleCtrl.setColor("turqoise")

        # Tail End Handle
        self.tailEndHandleCtrlSpace = CtrlSpace('tailEndHandle', parent=self.ctrlCmpGrp)
        self.tailEndHandleCtrl = Control('tailEndHandle', parent=self.tailEndHandleCtrlSpace, shape="pin")
        self.tailEndHandleCtrl.lockScale(x=True, y=True, z=True)
        self.tailEndHandleCtrl.setColor("turqoise")

        # Tail End
        self.tailEndCtrlSpace = CtrlSpace('tailEnd', parent=self.tailEndHandleCtrl)
        self.tailEndCtrl = Control('tailEnd', parent=self.tailEndCtrlSpace, shape="pin")
        self.tailEndCtrl.lockScale(x=True, y=True, z=True)
        self.tailEndCtrl.setColor("greenBlue")


        # ==========
        # Deformers
        # ==========
        deformersLayer = self.getOrCreateLayer('deformers')
        self.defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
        self.deformerJoints = []
        self.tailOutputs = []
        self.setNumDeformers(1)


        # =====================
        # Create Component I/O
        # =====================
        # Setup component Xfo I/O's
        self.tailVertebraeOutput.setTarget(self.tailOutputs)


        # ==============
        # Constrain I/O
        # ==============
        # Constraint inputs
        self.tailBaseHandleInputConstraint = PoseConstraint('_'.join([self.tailBaseHandleCtrlSpace.getName(), 'To', self.spineEndCtrlInputTgt.getName()]))
        self.tailBaseHandleInputConstraint.addConstrainer(self.spineEndCtrlInputTgt)
        self.tailBaseHandleInputConstraint.setMaintainOffset(True)
        self.tailBaseHandleCtrlSpace.addConstraint(self.tailBaseHandleInputConstraint)

        self.tailEndHandleInputConstraint = PoseConstraint('_'.join([self.tailEndHandleCtrlSpace.getName(), 'To', self.cogInputTgt.getName()]))
        self.tailEndHandleInputConstraint.addConstrainer(self.cogInputTgt)
        self.tailEndHandleInputConstraint.setMaintainOffset(True)
        self.tailEndHandleCtrlSpace.addConstraint(self.tailEndHandleInputConstraint)

        # Constraint outputs
        self.tailBaseOutputConstraint = PoseConstraint('_'.join([self.tailBaseOutputTgt.getName(), 'To', 'spineBase']))
        self.tailBaseOutputConstraint.addConstrainer(self.tailOutputs[0])
        self.tailBaseOutputTgt.addConstraint(self.tailBaseOutputConstraint)

        self.tailEndOutputConstraint = PoseConstraint('_'.join([self.tailEndOutputTgt.getName(), 'To', 'spineEnd']))
        self.tailEndOutputConstraint.addConstrainer(self.tailOutputs[0])
        self.tailEndOutputTgt.addConstraint(self.tailEndOutputConstraint)


        # ===============
        # Add Splice Ops
        # ===============
        # Add Tail Splice Op
        self.bezierTailKLOp = KLOperator('tailKLOp', 'BezierSpineSolver', 'Kraken')
        self.addOperator(self.bezierTailKLOp)

        # Add Att Inputs
        self.bezierTailKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.bezierTailKLOp.setInput('rigScale', self.rigScaleInputAttr)
        self.bezierTailKLOp.setInput('length', self.lengthInputAttr)

        # Add Xfo Inputs
        self.bezierTailKLOp.setInput('base', self.spineEndInputTgt)
        self.bezierTailKLOp.setInput('baseHandle', self.tailBaseHandleCtrl)
        self.bezierTailKLOp.setInput('tipHandle', self.tailEndHandleCtrl)
        self.bezierTailKLOp.setInput('tip', self.tailEndCtrl)

        # Add Xfo Outputs
        self.bezierTailKLOp.setOutput('outputs', self.tailOutputs)
#.........这里部分代码省略.........
开发者ID:Leopardob,项目名称:Kraken,代码行数:103,代码来源:fabrice_tail.py

示例11: NeckComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
            name=neckInputConstraintName)


        # Constraint outputs
        neck01OutCnstrName = '_'.join([self.neck01OutputTgt.getName(),
                                       'To',
                                       self.neck01Ctrl.getName()])

        self.neck01OutCnstr = self.neck01OutputTgt.constrainTo(
            self.neck01Ctrl,
            'Pose',
            maintainOffset=False,
            name=neck01OutCnstrName)

        neck02OutCnstrName = '_'.join([self.neck02OutputTgt.getName(),
                                       'To',
                                       self.neck02Ctrl.getName()])

        self.neck02OutCnstr = self.neck02OutputTgt.constrainTo(
            self.neck02Ctrl,
            'Pose',
            maintainOffset=False,
            name=neck02OutCnstrName)

        neckEndCnstrName = '_'.join([self.neckEndOutputTgt.getName(),
                                     'To',
                                     self.neck02Ctrl.getName()])

        self.neckEndCnstr = self.neckEndOutputTgt.constrainTo(
            self.neck02Ctrl,
            'Pose',
            maintainOffset=True,
            name=neckEndCnstrName)


        # ==============
        # Add Operators
        # ==============
        # Add Deformer KL Op
        self.neckDeformerKLOp = KLOperator('neckDeformerKLOp',
                                           'MultiPoseConstraintSolver',
                                           'Kraken')

        self.addOperator(self.neckDeformerKLOp)

        # Add Att Inputs
        self.neckDeformerKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.neckDeformerKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputstrl)
        self.neckDeformerKLOp.setInput('constrainers',
                                       [self.neck01Ctrl, self.neck02Ctrl])

        # Add Xfo Outputs
        self.neckDeformerKLOp.setOutput('constrainees',
                                        [self.neck01Def, self.neck02Def])

        Profiler.getInstance().pop()


    def loadData(self, data=None):
        """Load a saved guide representation from persisted data.

        Arguments:
        data -- object, The JSON data object.

        Return:
        True if successful.

        """

        super(NeckComponentRig, self).loadData(data)
        neckXfo = data.get('neckXfo')
        neckCrvData = data.get('neckCrvData')
        neckMidXfo = data.get('neckMidXfo')
        neckMidCrvData = data.get('neckMidCrvData')
        neckEndXfo = data.get('neckEndXfo')

        self.neck01CtrlSpace.xfo = neckXfo
        self.neck01Ctrl.xfo = neckXfo
        self.neck01Ctrl.setCurveData(neckCrvData)

        self.neck02CtrlSpace.xfo = neckMidXfo
        self.neck02Ctrl.xfo = neckMidXfo
        self.neck02Ctrl.setCurveData(neckMidCrvData)


        # ============
        # Set IO Xfos
        # ============
        self.neckBaseInputTgt.xfo = neckXfo
        self.neck01OutputTgt.xfo = neckXfo
        self.neck02OutputTgt.xfo = neckMidXfo
        self.neckEndOutputTgt.xfo = neckEndXfo

        # Evaluate Constraints
        self.neckInputCnstr.evaluate()
        self.neck01OutCnstr.evaluate()
        self.neck02OutCnstr.evaluate()
        self.neckEndCnstr.evaluate()
开发者ID:AbedSHP,项目名称:Kraken,代码行数:104,代码来源:neck_component.py

示例12: InsectLegComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
        legRootInputConstraint.addConstrainer(self.rootInputTgt)
        self.fkCtrlSpaces[0].addConstraint(legRootInputConstraint)

        chainBaseInputConstraint = PoseConstraint(
            "_".join([self.chainBase.getName(), "To", self.rootInputTgt.getName()])
        )
        chainBaseInputConstraint.setMaintainOffset(True)
        chainBaseInputConstraint.addConstrainer(self.rootInputTgt)
        self.chainBase.addConstraint(chainBaseInputConstraint)

        # ===============
        # Add Splice Ops
        # ===============
        # Add Splice Op
        self.nBoneSolverKLOp = KLOperator("legKLOp", "NBoneIKSolver", "Kraken")
        self.addOperator(self.nBoneSolverKLOp)

        # # Add Att Inputs
        self.nBoneSolverKLOp.setInput("drawDebug", self.drawDebugInputAttr)
        self.nBoneSolverKLOp.setInput("rigScale", self.rigScaleInputAttr)
        self.nBoneSolverKLOp.setInput("useInitPose", legUseInitPoseInputAttr)
        self.nBoneSolverKLOp.setInput("ikblend", legFkikInputAttr)
        self.nBoneSolverKLOp.setInput("rootIndex", self.rootIndexInputAttr)
        self.nBoneSolverKLOp.setInput("tipBoneLen", self.tipBoneLenInputAttr)

        # Add Xfo Inputs
        self.nBoneSolverKLOp.setInput("chainBase", self.chainBase)
        self.nBoneSolverKLOp.setInput("ikgoal", self.legIKCtrl)
        self.nBoneSolverKLOp.setInput("upVector", self.legUpVCtrl)

        self.nBoneSolverKLOp.setInput("fkcontrols", self.fkCtrls)

        # Add Xfo Outputs
        self.nBoneSolverKLOp.setOutput("pose", self.boneOutputsTgt)

        self.nBoneSolverKLOp.setOutput("legEnd", self.legEndPosOutputTgt)

        # Add Deformer Splice Op
        self.outputsToDeformersKLOp = KLOperator("insectLegDeformerKLOp", "MultiPoseConstraintSolver", "Kraken")
        self.addOperator(self.outputsToDeformersKLOp)

        # Add Att Inputs
        self.outputsToDeformersKLOp.setInput("drawDebug", self.drawDebugInputAttr)
        self.outputsToDeformersKLOp.setInput("rigScale", self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.outputsToDeformersKLOp.setInput("constrainers", self.boneOutputsTgt)

        # Add Xfo Outputs
        self.outputsToDeformersKLOp.setOutput("constrainees", self.deformerJoints)

        Profiler.getInstance().pop()

    def setNumControls(self, numControls):

        # Add new control spaces and controls
        for i in xrange(len(self.fkCtrlSpaces), numControls):
            if i == 0:
                parent = self.ctrlCmpGrp
            else:
                parent = self.fkCtrls[i - 1]

            boneName = "bone" + str(i + 1).zfill(2) + "FK"
            fkCtrlSpace = CtrlSpace(boneName, parent=parent)

            fkCtrl = Control(boneName, parent=fkCtrlSpace, shape="cube")
开发者ID:Leopardob,项目名称:Kraken,代码行数:70,代码来源:insectleg_component.py

示例13: StretchyLimbComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
        self.limbRootInputConstraint.addConstrainer(self.limbParentInputTgt)
        self.upperFKCtrlSpace.addConstraint(self.limbRootInputConstraint)

        # ===============
        # Add Splice Ops
        # ===============
        # Add StretchyLimb Splice Op
        self.limbIKKLOp = KLOperator('limbKLOp', 'TwoBoneStretchyIKSolver', 'Kraken')
        self.addOperator(self.limbIKKLOp)

        # Add Att Inputs
        self.limbIKKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.limbIKKLOp.setInput('rigScale', self.rigScaleInputAttr)

        self.limbIKKLOp.setInput('bone0Len', self.limbBone0LenInputAttr)
        self.limbIKKLOp.setInput('bone1Len', self.limbBone1LenInputAttr)
        self.limbIKKLOp.setInput('ikblend', limbIKBlendInputAttr)
        self.limbIKKLOp.setInput('softIK', limbSoftIKInputAttr)
        self.limbIKKLOp.setInput('softRatio', limbSoftRatioInputAttr)
        self.limbIKKLOp.setInput('stretch', limbStretchInputAttr)
        self.limbIKKLOp.setInput('stretchBlend', limbStretchBlendInputAttr)
        self.limbIKKLOp.setInput('slide', limbSlideInputAttr)
        self.limbIKKLOp.setInput('pin', limbPinInputAttr)
        self.limbIKKLOp.setInput('rightSide', self.rightSideInputAttr)

        # Add Xfo Inputs
        self.limbIKKLOp.setInput('root', self.limbParentInputTgt)
        self.limbIKKLOp.setInput('bone0FK', self.upperFKCtrl)
        self.limbIKKLOp.setInput('bone1FK', self.lowerFKCtrl)
        self.limbIKKLOp.setInput('ikHandle', self.limbIKCtrl)
        self.limbIKKLOp.setInput('upV', self.limbUpVCtrl)

        # Add Xfo Outputs
        self.limbIKKLOp.setOutput('bone0Out', self.limbUpperOutputTgt)
        self.limbIKKLOp.setOutput('bone1Out', self.limbLowerOutputTgt)
        self.limbIKKLOp.setOutput('bone2Out', self.limbEndOutputTgt)

        # =====================
        # Connect the deformers
        # =====================

        # Add StretchyLimb Deformer Splice Op
        self.outputsToDeformersKLOp = KLOperator('limbDeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
        self.addOperator(self.outputsToDeformersKLOp)

        # Add Att Inputs
        self.outputsToDeformersKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.outputsToDeformersKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.outputsToDeformersKLOp.setInput('constrainers', [self.limbUpperOutputTgt, self.limbLowerOutputTgt, self.limbEndOutputTgt])

        # Add Xfo Outputs
        self.outputsToDeformersKLOp.setOutput('constrainees', [upperDef, lowerDef, endDef])

        Profiler.getInstance().pop()

    # =============
    # Data Methods
    # =============
    def loadData(self, data=None):
        """Load a saved guide representation from persisted data.

        Arguments:
        data -- object, The JSON data object.
开发者ID:AbedSHP,项目名称:Kraken,代码行数:69,代码来源:stretchyLimb_component.py

示例14: FootComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]

#.........这里部分代码省略.........
        self.ankleFKInputConstraint.addConstrainer(self.legEndFKInputTgt)
        self.ankleFKCtrlSpace.addConstraint(self.ankleFKInputConstraint)

        # Constraint outputs
        self.ikTargetOutputConstraint = PoseConstraint('_'.join([self.ikTargetOutputTgt.getName(), 'To', self.ankleIKCtrl.getName()]))
        self.ikTargetOutputConstraint.setMaintainOffset(True)
        self.ikTargetOutputConstraint.addConstrainer(self.ankleIKCtrl)
        self.ikTargetOutputTgt.addConstraint(self.ikTargetOutputConstraint)


        # =========================
        # Add Foot Pivot Canvas Op
        # =========================
        # self.footPivotCanvasOp = CanvasOperator('footPivotCanvasOp', 'Kraken.Solvers.Biped.BipedFootPivotSolver')
        self.footPivotCanvasOp = KLOperator('footPivotKLOp', 'BipedFootPivotSolver', 'Kraken')

        self.addOperator(self.footPivotCanvasOp)

        # Add Att Inputs
        self.footPivotCanvasOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.footPivotCanvasOp.setInput('rigScale', self.rigScaleInputAttr)
        self.footPivotCanvasOp.setInput('rightSide', self.rightSideInputAttr)
        self.footPivotCanvasOp.setInput('footRock', self.footRockInputAttr)
        self.footPivotCanvasOp.setInput('footBank', self.footBankInputAttr)

        # Add Xfo Inputs
        self.footPivotCanvasOp.setInput('pivotAll', self.pivotAll)
        self.footPivotCanvasOp.setInput('backPivot', self.backPivotCtrl)
        self.footPivotCanvasOp.setInput('frontPivot', self.frontPivotCtrl)
        self.footPivotCanvasOp.setInput('outerPivot', self.outerPivotCtrl)
        self.footPivotCanvasOp.setInput('innerPivot', self.innerPivotCtrl)

        # Add Xfo Outputs
        self.footPivotCanvasOp.setOutput('result', self.footAll)


        # =========================
        # Add Foot Solver Canvas Op
        # =========================
        # self.footSolverCanvasOp = CanvasOperator('footSolverCanvasOp', 'Kraken.Solvers.Biped.BipedFootSolver')
        self.footSolverCanvasOp = KLOperator('footSolverKLOp', 'BipedFootSolver', 'Kraken')
        self.addOperator(self.footSolverCanvasOp)

        # Add Att Inputs
        self.footSolverCanvasOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.footSolverCanvasOp.setInput('rigScale', self.rigScaleInputAttr)
        self.footSolverCanvasOp.setInput('ikBlend', self.ikBlendInputAttr)
        self.footSolverCanvasOp.setInput('ankleLen', self.ankleLenInputAttr)
        self.footSolverCanvasOp.setInput('toeLen', self.toeLenInputAttr)

        # Add Xfo Inputs
        self.footSolverCanvasOp.setInput('legEnd', self.legEndInputTgt)
        self.footSolverCanvasOp.setInput('ankleIK', self.ankleIKCtrl)
        self.footSolverCanvasOp.setInput('toeIK', self.toeIKCtrl)
        self.footSolverCanvasOp.setInput('ankleFK', self.ankleFKCtrl)
        self.footSolverCanvasOp.setInput('toeFK', self.toeFKCtrl)

        # Add Xfo Outputs
        self.footSolverCanvasOp.setOutput('ankle_result', self.ankleOutputTgt)
        self.footSolverCanvasOp.setOutput('toe_result', self.toeOutputTgt)


        # ===================
        # Add Deformer KL Op
        # ===================
        self.outputsToDeformersKLOp = KLOperator('foot' + self.getLocation() + 'DeformerKLOp', 'MultiPoseConstraintSolver', 'Kraken')
开发者ID:AbedSHP,项目名称:Kraken,代码行数:70,代码来源:foot_component.py

示例15: MainSrtComponentRig

# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setOutput [as 别名]
class MainSrtComponentRig(MainSrtComponent):
    """MainSrt Component Rig"""

    def __init__(self, name="mainSrt", parent=None):

        Profiler.getInstance().push("Construct MainSrt Rig Component:" + name)
        super(MainSrtComponentRig, self).__init__(name, parent)

        # =========
        # Controls
        # =========
        # Add Controls
        self.mainSRTCtrlSpace = CtrlSpace("SRT", parent=self.ctrlCmpGrp)
        self.mainSRTCtrl = Control("SRT", shape="circle", parent=self.mainSRTCtrlSpace)
        self.mainSRTCtrl.lockScale(x=True, y=True, z=True)

        self.offsetCtrlSpace = CtrlSpace("Offset", parent=self.mainSRTCtrl)
        self.offsetCtrl = Control("Offset", shape="circle", parent=self.offsetCtrlSpace)
        self.offsetCtrl.setColor("orange")
        self.offsetCtrl.lockScale(x=True, y=True, z=True)

        # Add Component Params to IK control
        mainSrtSettingsAttrGrp = AttributeGroup("DisplayInfo_MainSrtSettings", parent=self.mainSRTCtrl)
        self.rigScaleAttr = ScalarAttribute(
            "rigScale", value=1.0, parent=mainSrtSettingsAttrGrp, minValue=0.1, maxValue=100.0
        )

        self.rigScaleOutputAttr.connect(self.rigScaleAttr)

        # ==========
        # Deformers
        # ==========

        # ==============
        # Constrain I/O
        # ==============
        # Constraint inputs

        # Constraint outputs
        srtConstraint = PoseConstraint("_".join([self.srtOutputTgt.getName(), "To", self.mainSRTCtrl.getName()]))
        srtConstraint.addConstrainer(self.mainSRTCtrl)
        self.srtOutputTgt.addConstraint(srtConstraint)

        offsetConstraint = PoseConstraint("_".join([self.offsetOutputTgt.getName(), "To", self.mainSRTCtrl.getName()]))
        offsetConstraint.addConstrainer(self.offsetCtrl)
        self.offsetOutputTgt.addConstraint(offsetConstraint)

        # ===============
        # Add Splice Ops
        # ===============
        # Add Rig Scale Splice Op
        self.rigScaleKLOp = KLOperator("rigScaleKLOp", "RigScaleSolver", "Kraken")
        self.addOperator(self.rigScaleKLOp)

        # Add Att Inputs
        self.rigScaleKLOp.setInput("drawDebug", self.drawDebugInputAttr)
        self.rigScaleKLOp.setInput("rigScale", self.rigScaleOutputAttr)

        # Add Xfo Inputs

        # Add Xfo Outputs
        self.rigScaleKLOp.setOutput("target", self.mainSRTCtrlSpace)

        Profiler.getInstance().pop()

    def loadData(self, data=None):
        """Load a saved guide representation from persisted data.

        Arguments:
        data -- object, The JSON data object.

        Return:
        True if successful.

        """

        super(MainSrtComponentRig, self).loadData(data)

        # ================
        # Resize Controls
        # ================
        self.mainSRTCtrl.scalePoints(Vec3(data["mainSrtSize"], 1.0, data["mainSrtSize"]))
        self.offsetCtrl.scalePoints(Vec3(data["mainSrtSize"] - 0.5, 1.0, data["mainSrtSize"] - 0.5))

        # =======================
        # Set Control Transforms
        # =======================
        self.mainSRTCtrlSpace.xfo = data["mainSrtXfo"]
        self.mainSRTCtrl.xfo = data["mainSrtXfo"]
        self.offsetCtrlSpace.xfo = data["mainSrtXfo"]
        self.offsetCtrl.xfo = data["mainSrtXfo"]

        # ============
        # Set IO Xfos
        # ============
        self.srtOutputTgt = data["mainSrtXfo"]
        self.offsetOutputTgt = data["mainSrtXfo"]
开发者ID:Leopardob,项目名称:Kraken,代码行数:99,代码来源:mainSrt_component.py


注:本文中的kraken.core.objects.operators.kl_operator.KLOperator.setOutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。