本文整理汇总了Python中kraken.core.objects.operators.kl_operator.KLOperator.setInput方法的典型用法代码示例。如果您正苦于以下问题:Python KLOperator.setInput方法的具体用法?Python KLOperator.setInput怎么用?Python KLOperator.setInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.objects.operators.kl_operator.KLOperator
的用法示例。
在下文中一共展示了KLOperator.setInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [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()
示例2: addFinger
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [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
示例3: TentacleComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
class TentacleComponentRig(TentacleComponent):
"""Insect Leg Rig"""
def __init__(self, name='Tentacle', parent=None):
Profiler.getInstance().push("Construct Tentacle Rig Component:" + name)
super(TentacleComponentRig, self).__init__(name, parent)
# =========
# Controls
# =========
# Chain Base
self.chainBase = Locator('ChainBase', parent=self.ctrlCmpGrp)
self.chainBase.setShapeVisibility(False)
# FK
self.fkCtrlSpaces = []
self.fkCtrls = []
self.setNumControls(2)
# IK Control
self.tentacleIKCtrlSpace = CtrlSpace('IK', parent=self.ctrlCmpGrp)
self.tentacleIKCtrl = Control('IK', parent=self.tentacleIKCtrlSpace, shape="sphere")
self.tentacleIKCtrl.scalePoints(Vec3(0.25, 0.25, 0.25))
self.tentacleIKCtrl.lockScale(x=True, y=True, z=True)
self.tentacleIKCtrl.lockRotation(x=True, y=True, z=True)
# Add Component Params to IK control
tentacleSettingsAttrGrp = AttributeGroup("DisplayInfo_LegSettings", parent=self.tentacleIKCtrl)
tentacledrawDebugInputAttr = BoolAttribute('drawDebug', value=False, parent=tentacleSettingsAttrGrp)
fkikInputAttr = ScalarAttribute('fkik', value=0.0, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
waveLength_YInputAttr = ScalarAttribute('waveLength_Y', value=1.0, minValue=0.0, maxValue=5.0, parent=tentacleSettingsAttrGrp)
waveAmplitude_YInputAttr = ScalarAttribute('waveAmplitude_Y', value=0.0, minValue=-3.0, maxValue=3.0, parent=tentacleSettingsAttrGrp)
waveFrequency_YInputAttr = ScalarAttribute('waveFrequency_Y', value=2.0, minValue=0.0, maxValue=10.0, parent=tentacleSettingsAttrGrp)
waveLength_ZInputAttr = ScalarAttribute('waveLength_Z', value=2.329, minValue=0.0, maxValue=5.0, parent=tentacleSettingsAttrGrp)
waveAmplitude_ZInputAttr = ScalarAttribute('waveAmplitude_Z', value=0.0, minValue=-3.0, maxValue=3.0, parent=tentacleSettingsAttrGrp)
waveFrequency_ZInputAttr = ScalarAttribute('waveFrequency_Z', value=3.354, minValue=0.0, maxValue=10.0, parent=tentacleSettingsAttrGrp)
tipBiasInputAttr = ScalarAttribute('tipBias', value=1.0, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
springStrengthInputAttr = ScalarAttribute('springStrength', value=0.3, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
dampeningInputAttr = ScalarAttribute('dampening', value=0.03, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
simulationWeightInputAttr = ScalarAttribute('simulationWeight', value=1.0, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
softLimitBoundsInputAttr = ScalarAttribute('softLimitBounds', value=5.0, minValue=0.0, maxValue=10.0, parent=tentacleSettingsAttrGrp)
# Connect IO to controls
self.drawDebugInputAttr.connect(tentacledrawDebugInputAttr)
# ==========
# Deformers
# ==========
deformersLayer = self.getOrCreateLayer('deformers')
self.defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
self.deformerJoints = []
self.boneOutputsTgt = []
self.setNumDeformers(4)
# =====================
# Create Component I/O
# =====================
# Set IO Targets
self.boneOutputs.setTarget(self.boneOutputsTgt)
# ==============
# Constrain I/O
# ==============
# Constraint inputs
tentacleRootInputConstraint = PoseConstraint('_'.join([self.fkCtrlSpaces[0].getName(), 'To', self.rootInputTgt.getName()]))
tentacleRootInputConstraint.setMaintainOffset(True)
tentacleRootInputConstraint.addConstrainer(self.rootInputTgt)
self.fkCtrlSpaces[0].addConstraint(tentacleRootInputConstraint)
tentacleRootInputConstraint = PoseConstraint('_'.join([self.tentacleIKCtrlSpace.getName(), 'To', self.rootInputTgt.getName()]))
tentacleRootInputConstraint.setMaintainOffset(True)
tentacleRootInputConstraint.addConstrainer(self.rootInputTgt)
self.tentacleIKCtrlSpace.addConstraint(tentacleRootInputConstraint)
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.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)
#.........这里部分代码省略.........
示例4: ArmComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
#.........这里部分代码省略.........
self.armIKCtrlSpaceInputConstraint.setMaintainOffset(True)
self.armIKCtrlSpaceInputConstraint.addConstrainer(self.globalSRTInputTgt)
self.armIKCtrlSpace.addConstraint(self.armIKCtrlSpaceInputConstraint)
self.armUpVCtrlSpaceInputConstraint = PoseConstraint('_'.join([self.armUpVCtrlSpace.getName(), 'To', self.globalSRTInputTgt.getName()]))
self.armUpVCtrlSpaceInputConstraint.setMaintainOffset(True)
self.armUpVCtrlSpaceInputConstraint.addConstrainer(self.globalSRTInputTgt)
self.armUpVCtrlSpace.addConstraint(self.armUpVCtrlSpaceInputConstraint)
self.armRootInputConstraint = PoseConstraint('_'.join([self.bicepFKCtrlSpace.getName(), 'To', self.clavicleEndInputTgt.getName()]))
self.armRootInputConstraint.setMaintainOffset(True)
self.armRootInputConstraint.addConstrainer(self.clavicleEndInputTgt)
self.bicepFKCtrlSpace.addConstraint(self.armRootInputConstraint)
# Constraint outputs
self.handConstraint = PoseConstraint('_'.join([self.handOutputTgt.getName(), 'To', self.handCtrl.getName()]))
self.handConstraint.addConstrainer(self.handCtrl)
self.handOutputTgt.addConstraint(self.handConstraint)
self.handCtrlSpaceConstraint = PoseConstraint('_'.join([self.handCtrlSpace.getName(), 'To', self.armEndXfoOutputTgt.getName()]))
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)
示例5: __init__
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [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()
示例6: LegComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
#.........这里部分代码省略.........
self.legUpVCtrlSpaceInputConstraint = PoseConstraint('_'.join([self.legUpVCtrlSpace.getName(), 'To', self.globalSRTInputTgt.getName()]))
self.legUpVCtrlSpaceInputConstraint.setMaintainOffset(True)
self.legUpVCtrlSpaceInputConstraint.addConstrainer(self.globalSRTInputTgt)
self.legUpVCtrlSpace.addConstraint(self.legUpVCtrlSpaceInputConstraint)
self.legRootInputConstraint = PoseConstraint('_'.join([self.legIKCtrl.getName(), 'To', self.legPelvisInputTgt.getName()]))
self.legRootInputConstraint.setMaintainOffset(True)
self.legRootInputConstraint.addConstrainer(self.legPelvisInputTgt)
self.femurFKCtrlSpace.addConstraint(self.legRootInputConstraint)
# Constraint outputs
self.footOutputConstraint = PoseConstraint('_'.join([self.footOutputTgt.getName(), 'To', self.footCtrl.getName()]))
self.footOutputConstraint.addConstrainer(self.footCtrl)
self.footOutputTgt.addConstraint(self.footOutputConstraint)
self.footCtrlSpaceConstraint = PoseConstraint('_'.join([self.footCtrlSpace.getName(), 'To', self.legEndXfoOutputTgt.getName()]))
self.footCtrlSpaceConstraint.setMaintainOffset(True)
self.footCtrlSpaceConstraint.addConstrainer(self.legEndXfoOutputTgt)
self.footCtrlSpace.addConstraint(self.footCtrlSpaceConstraint)
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)
示例7: HeadComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
#.........这里部分代码省略.........
# ==============
# Constrain I/O
# ==============
# Constraint inputs
self.headInputConstraint = PoseConstraint('_'.join([self.headCtrlSpace.getName(), 'To', self.neckRefInputTgt.getName()]))
self.headInputConstraint.setMaintainOffset(True)
self.headInputConstraint.addConstrainer(self.neckRefInputTgt)
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
示例8: SpineComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
#.........这里部分代码省略.........
# ==============
# Constraint inputs
self.spineSrtInputConstraint = PoseConstraint('_'.join([self.cogCtrlSpace.getName(), 'To', self.globalSRTInputTgt.getName()]))
self.spineSrtInputConstraint.addConstrainer(self.globalSRTInputTgt)
self.spineSrtInputConstraint.setMaintainOffset(True)
self.cogCtrlSpace.addConstraint(self.spineSrtInputConstraint)
# Constraint outputs
self.spineCogOutputConstraint = PoseConstraint('_'.join([self.spineCogOutputTgt.getName(), 'To', self.cogCtrl.getName()]))
self.spineCogOutputConstraint.addConstrainer(self.cogCtrl)
self.spineCogOutputTgt.addConstraint(self.spineCogOutputConstraint)
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)
示例9: FabriceHeadRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [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)
#.........这里部分代码省略.........
示例10: FabriceTailRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [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)
#.........这里部分代码省略.........
示例11: NeckComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [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()
示例12: InsectLegComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
class InsectLegComponentRig(InsectLegComponent):
"""Insect Leg Rig"""
def __init__(self, name="InsectLeg", parent=None):
Profiler.getInstance().push("Construct InsectLeg Rig Component:" + name)
super(InsectLegComponentRig, self).__init__(name, parent)
# =========
# Controls
# =========
# Chain Base
self.chainBase = Locator("ChainBase", parent=self.ctrlCmpGrp)
self.chainBase.setShapeVisibility(False)
# FK
self.fkCtrlSpaces = []
self.fkCtrls = []
self.setNumControls(4)
# IK Control
self.legIKCtrlSpace = CtrlSpace("IK", parent=self.ctrlCmpGrp)
self.legIKCtrl = Control("IK", parent=self.legIKCtrlSpace, shape="pin")
if self.getLocation() == "R":
self.legIKCtrl.rotatePoints(0, 90, 0)
self.legIKCtrl.translatePoints(Vec3(-1.0, 0.0, 0.0))
else:
self.legIKCtrl.rotatePoints(0, -90, 0)
self.legIKCtrl.translatePoints(Vec3(1.0, 0.0, 0.0))
# Add Component Params to IK control
legSettingsAttrGrp = AttributeGroup("DisplayInfo_LegSettings", parent=self.legIKCtrl)
legdrawDebugInputAttr = BoolAttribute("drawDebug", value=False, parent=legSettingsAttrGrp)
legUseInitPoseInputAttr = BoolAttribute("useInitPose", value=True, parent=legSettingsAttrGrp)
self.rootIndexInputAttr = IntegerAttribute("rootIndex", value=0, parent=legSettingsAttrGrp)
legFkikInputAttr = ScalarAttribute("fkik", value=1.0, minValue=0.0, maxValue=1.0, parent=legSettingsAttrGrp)
# Connect IO to controls
self.drawDebugInputAttr.connect(legdrawDebugInputAttr)
# UpV
self.legUpVCtrlSpace = CtrlSpace("UpV", parent=self.ctrlCmpGrp)
self.legUpVCtrl = Control("UpV", parent=self.legUpVCtrlSpace, shape="triangle")
self.legUpVCtrl.alignOnZAxis()
self.legUpVCtrl.rotatePoints(0, 90, 0)
# ==========
# Deformers
# ==========
deformersLayer = self.getOrCreateLayer("deformers")
self.defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
self.deformerJoints = []
self.boneOutputsTgt = []
self.setNumDeformers(4)
# =====================
# Create Component I/O
# =====================
# Set IO Targets
self.boneOutputs.setTarget(self.boneOutputsTgt)
# ==============
# Constrain I/O
# ==============
# Constraint inputs
legRootInputConstraint = PoseConstraint(
"_".join([self.fkCtrlSpaces[0].getName(), "To", self.rootInputTgt.getName()])
)
legRootInputConstraint.setMaintainOffset(True)
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)
#.........这里部分代码省略.........
示例13: StretchyLimbComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
class StretchyLimbComponentRig(StretchyLimbComponent):
"""StretchyLimb Component"""
def __init__(self, name='limb', parent=None):
Profiler.getInstance().push("Construct StretchyLimb Rig Component:" + name)
super(StretchyLimbComponentRig, self).__init__(name, parent)
# =========
# Controls
# =========
# Upper (FK)
self.upperFKCtrlSpace = CtrlSpace('upperFK', parent=self.ctrlCmpGrp)
self.upperFKCtrl = Control('upperFK', parent=self.upperFKCtrlSpace, shape="cube")
self.upperFKCtrl.alignOnXAxis()
# Lower (FK)
self.lowerFKCtrlSpace = CtrlSpace('lowerFK', parent=self.upperFKCtrl)
self.lowerFKCtrl = Control('lowerFK', parent=self.lowerFKCtrlSpace, shape="cube")
self.lowerFKCtrl.alignOnXAxis()
# End (IK)
self.limbIKCtrlSpace = CtrlSpace('IK', parent=self.ctrlCmpGrp)
self.limbIKCtrl = Control('IK', parent=self.limbIKCtrlSpace, shape="pin")
# Add Component Params to IK control
# TODO: Move these separate control
limbSettingsAttrGrp = AttributeGroup("DisplayInfo_StretchyLimbSettings", parent=self.limbIKCtrl)
limbDrawDebugInputAttr = BoolAttribute('drawDebug', value=False, parent=limbSettingsAttrGrp)
self.limbBone0LenInputAttr = ScalarAttribute('bone0Len', value=1.0, parent=limbSettingsAttrGrp)
self.limbBone1LenInputAttr = ScalarAttribute('bone1Len', value=1.0, parent=limbSettingsAttrGrp)
limbIKBlendInputAttr = ScalarAttribute('ikblend', value=1.0, minValue=0.0, maxValue=1.0, parent=limbSettingsAttrGrp)
limbSoftIKInputAttr = BoolAttribute('softIK', value=True, parent=limbSettingsAttrGrp)
limbSoftRatioInputAttr = ScalarAttribute('softRatio', value=0.0, minValue=0.0, maxValue=1.0, parent=limbSettingsAttrGrp)
limbStretchInputAttr = BoolAttribute('stretch', value=True, parent=limbSettingsAttrGrp)
limbStretchBlendInputAttr = ScalarAttribute('stretchBlend', value=0.0, minValue=0.0, maxValue=1.0, parent=limbSettingsAttrGrp)
limbSlideInputAttr = ScalarAttribute('slide', value=0.0, minValue=-1.0, maxValue=1.0, parent=limbSettingsAttrGrp)
limbPinInputAttr = ScalarAttribute('pin', value=0.0, minValue=0.0, maxValue=1.0, parent=limbSettingsAttrGrp)
self.rightSideInputAttr = BoolAttribute('rightSide', value=False, parent=limbSettingsAttrGrp)
self.drawDebugInputAttr.connect(limbDrawDebugInputAttr)
# UpV (IK Pole Vector)
self.limbUpVCtrlSpace = CtrlSpace('UpV', parent=self.ctrlCmpGrp)
self.limbUpVCtrl = Control('UpV', parent=self.limbUpVCtrlSpace, shape="triangle")
self.limbUpVCtrl.alignOnZAxis()
# ==========
# Deformers
# ==========
deformersLayer = self.getOrCreateLayer('deformers')
self.defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
self.addItem('defCmpGrp', self.defCmpGrp)
upperDef = Joint('upper', parent=self.defCmpGrp)
upperDef.setComponent(self)
lowerDef = Joint('lower', parent=self.defCmpGrp)
lowerDef.setComponent(self)
endDef = Joint('end', parent=self.defCmpGrp)
endDef.setComponent(self)
# ==============
# Constrain I/O
# ==============
# Constraint inputs
self.limbIKCtrlSpaceInputConstraint = PoseConstraint('_'.join([self.limbIKCtrlSpace.getName(), 'To', self.globalSRTInputTgt.getName()]))
self.limbIKCtrlSpaceInputConstraint.setMaintainOffset(True)
self.limbIKCtrlSpaceInputConstraint.addConstrainer(self.globalSRTInputTgt)
self.limbIKCtrlSpace.addConstraint(self.limbIKCtrlSpaceInputConstraint)
self.limbUpVCtrlSpaceInputConstraint = PoseConstraint('_'.join([self.limbUpVCtrlSpace.getName(), 'To', self.globalSRTInputTgt.getName()]))
self.limbUpVCtrlSpaceInputConstraint.setMaintainOffset(True)
self.limbUpVCtrlSpaceInputConstraint.addConstrainer(self.globalSRTInputTgt)
self.limbUpVCtrlSpace.addConstraint(self.limbUpVCtrlSpaceInputConstraint)
self.limbRootInputConstraint = PoseConstraint('_'.join([self.limbIKCtrl.getName(), 'To', self.limbParentInputTgt.getName()]))
self.limbRootInputConstraint.setMaintainOffset(True)
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)
#.........这里部分代码省略.........
示例14: FootComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [as 别名]
#.........这里部分代码省略.........
self.toeDef.setComponent(self)
# ==============
# Constrain I/O
# ==============
# Constraint to inputs
self.pivotAllInputConstraint = PoseConstraint('_'.join([self.pivotAll.getName(), 'To', self.ikHandleInputTgt.getName()]))
self.pivotAllInputConstraint.setMaintainOffset(True)
self.pivotAllInputConstraint.addConstrainer(self.ikHandleInputTgt)
self.pivotAll.addConstraint(self.pivotAllInputConstraint)
self.ankleFKInputConstraint = PoseConstraint('_'.join([self.ankleFKCtrlSpace.getName(), 'To', self.legEndFKInputTgt.getName()]))
self.ankleFKInputConstraint.setMaintainOffset(True)
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)
示例15: MainSrtComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import setInput [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"]