本文整理汇总了Python中kraken.core.objects.operators.kl_operator.KLOperator.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Python KLOperator.evaluate方法的具体用法?Python KLOperator.evaluate怎么用?Python KLOperator.evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.objects.operators.kl_operator.KLOperator
的用法示例。
在下文中一共展示了KLOperator.evaluate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FabriceTailRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# Add Att Inputs
self.deformersToOutputsKLOp.setInput('drawDebug', self.drawDebugInputAttr)
self.deformersToOutputsKLOp.setInput('rigScale', self.rigScaleInputAttr)
# Add Xfo Outputs
self.deformersToOutputsKLOp.setInput('constrainers', self.tailOutputs)
# Add Xfo Outputs
self.deformersToOutputsKLOp.setOutput('constrainees', self.deformerJoints)
Profiler.getInstance().pop()
def setNumDeformers(self, numDeformers):
# Add new deformers and outputs
for i in xrange(len(self.tailOutputs), numDeformers):
name = 'tail' + str(i + 1).zfill(2)
tailOutput = ComponentOutput(name, parent=self.outputHrcGrp)
self.tailOutputs.append(tailOutput)
for i in xrange(len(self.deformerJoints), numDeformers):
name = 'tail' + str(i + 1).zfill(2)
tailDef = Joint(name, parent=self.defCmpGrp)
tailDef.setComponent(self)
self.deformerJoints.append(tailDef)
return True
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(FabriceTailRig, self).loadData( data )
tailBasePos = data['tailBasePos']
tailBaseHandlePos = data['tailBaseHandlePos']
tailBaseHandleCtrlCrvData = data['tailBaseHandleCtrlCrvData']
tailEndHandlePos = data['tailEndHandlePos']
tailEndHandleCtrlCrvData = data['tailEndHandleCtrlCrvData']
tailEndPos = data['tailEndPos']
tailEndCtrlCrvData = data['tailEndCtrlCrvData']
numDeformers = data['numDeformers']
# Set Xfos
self.spineEndInputTgt.xfo.tr = tailBasePos
self.spineEndCtrlInputTgt.xfo.tr = tailBasePos
self.tailBaseHandleCtrlSpace.xfo.tr = tailBaseHandlePos
self.tailBaseHandleCtrl.xfo.tr = tailBaseHandlePos
self.tailBaseHandleCtrl.setCurveData(tailBaseHandleCtrlCrvData)
self.tailEndHandleCtrlSpace.xfo.tr = tailEndHandlePos
self.tailEndHandleCtrl.xfo.tr = tailEndHandlePos
self.tailEndHandleCtrl.setCurveData(tailEndHandleCtrlCrvData)
self.tailEndCtrlSpace.xfo.tr = tailEndPos
self.tailEndCtrl.xfo.tr = tailEndPos
self.tailEndCtrl.setCurveData(tailEndCtrlCrvData)
length = tailBasePos.distanceTo(tailBaseHandlePos) + tailBaseHandlePos.distanceTo(tailEndHandlePos) + tailEndHandlePos.distanceTo(tailEndPos)
self.lengthInputAttr.setMax(length * 3.0)
self.lengthInputAttr.setValue(length)
# Update number of deformers and outputs
self.setNumDeformers(numDeformers)
# Updating constraint to use the updated last output.
self.tailEndOutputConstraint.setConstrainer(self.tailOutputs[-1], index=0)
# ============
# Set IO Xfos
# ============
# ====================
# Evaluate Splice Ops
# ====================
# evaluate the spine op so that all the output transforms are updated.
self.bezierTailKLOp.evaluate()
# evaluate the constraint op so that all the joint transforms are updated.
self.deformersToOutputsKLOp.evaluate()
# evaluate the constraints to ensure the outputs are now in the correct location.
self.tailBaseHandleInputConstraint.evaluate()
self.tailBaseOutputConstraint.evaluate()
self.tailEndOutputConstraint.evaluate()
示例2: FabriceTailGuide
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
data['tailBaseHandlePos'] = self.tailBaseHandleCtrl.xfo.tr
data['tailBaseHandleCtrlCrvData'] = self.tailBaseHandleCtrl.getCurveData()
data['tailEndHandlePos'] = self.tailEndHandleCtrl.xfo.tr
data['tailEndHandleCtrlCrvData'] = self.tailEndHandleCtrl.getCurveData()
data['tailEndPos'] = self.tailEndCtrl.xfo.tr
data['tailEndCtrlCrvData'] = self.tailEndCtrl.getCurveData()
data['numDeformers'] = self.numDeformersAttr.getValue()
return data
def loadData(self, data):
"""Load a saved guide representation from persisted data.
Arguments:
data -- object, The JSON data object.
Return:
True if successful.
"""
super(FabriceTailGuide, self).loadData( data )
self.tailBaseCtrl.xfo.tr = data["tailBasePos"]
self.tailBaseHandleCtrl.xfo.tr = data["tailBaseHandlePos"]
self.tailBaseHandleCtrl.setCurveData(data['tailBaseHandleCtrlCrvData'])
self.tailEndHandleCtrl.xfo.tr = data["tailEndHandlePos"]
self.tailEndHandleCtrl.setCurveData(data['tailEndHandleCtrlCrvData'])
self.tailEndCtrl.xfo.tr = data["tailEndPos"]
self.tailEndCtrl.setCurveData(data['tailEndCtrlCrvData'])
self.numDeformersAttr.setValue(data["numDeformers"])
length = data["tailBasePos"].distanceTo(data["tailBaseHandlePos"]) + data["tailBaseHandlePos"].distanceTo(data["tailEndHandlePos"]) + data["tailEndHandlePos"].distanceTo(data["tailEndPos"])
self.lengthInputAttr.setMax(length * 3.0)
self.lengthInputAttr.setValue(length)
self.bezierSpineKLOp.evaluate()
return True
def getRigBuildData(self):
"""Returns the Guide data used by the Rig Component to define the layout of the final rig.
Return:
The JSON rig data object.
"""
data = super(FabriceTailGuide, self).getRigBuildData()
data['tailBasePos'] = self.tailBaseCtrl.xfo.tr
data['tailBaseHandlePos'] = self.tailBaseHandleCtrl.xfo.tr
data['tailBaseHandleCtrlCrvData'] = self.tailBaseHandleCtrl.getCurveData()
data['tailEndHandlePos'] = self.tailEndHandleCtrl.xfo.tr
data['tailEndHandleCtrlCrvData'] = self.tailEndHandleCtrl.getCurveData()
data['tailEndPos'] = self.tailEndCtrl.xfo.tr
data['tailEndCtrlCrvData'] = self.tailEndCtrl.getCurveData()
data['numDeformers'] = self.numDeformersAttr.getValue()
return data
# ==============
# Class Methods
# ==============
@classmethod
def getComponentType(cls):
"""Enables introspection of the class prior to construction to determine if it is a guide component.
Return:
The true if this component is a guide component.
"""
return 'Guide'
@classmethod
def getRigComponentClass(cls):
"""Returns the corresponding rig component class for this guide component class
Return:
The rig component class.
"""
return FabriceTailRig
示例3: HeadComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# 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])
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(HeadComponentRig, self).loadData(data)
headXfo = data.get('headXfo')
headCrvData = data.get('headCrvData')
eyeLeftXfo = data.get('eyeLeftXfo')
eyeLeftCrvData = data.get('eyeLeftCrvData')
eyeRightXfo = data.get('eyeRightXfo')
eyeRightCrvData = data.get('eyeRightCrvData')
jawXfo = data.get('jawXfo')
jawCrvData = data.get('jawCrvData')
self.headCtrlSpace.xfo = headXfo
self.headCtrl.xfo = headXfo
self.headCtrl.setCurveData(headCrvData)
# self.eyeLeftCtrlSpace.xfo = eyeLeftXfo
# self.eyeLeftCtrl.xfo = eyeLeftXfo
self.eyeLeftCtrl.setCurveData(eyeLeftCrvData)
# self.eyeRightCtrlSpace.xfo = eyeRightXfo
# self.eyeRightCtrl.xfo = eyeRightXfo
self.eyeRightCtrl.setCurveData(eyeRightCrvData)
# LookAt
eyeLeftRelXfo = headXfo.inverse() * eyeLeftXfo
eyeRightRelXfo = headXfo.inverse() * eyeRightXfo
eyeMidRelPos = eyeLeftRelXfo.tr.linearInterpolate(eyeRightRelXfo.tr, 0.5)
eyeMidRelPos = eyeMidRelPos + Vec3(0.0, 0.0, 8.0)
eyeLen = eyeLeftRelXfo.tr.distanceTo(eyeRightRelXfo.tr)
self.eyeLeftBase.xfo = eyeLeftXfo
self.eyeRightBase.xfo = eyeRightXfo
self.eyeLeftUpV.xfo = eyeLeftXfo * Xfo(Vec3(0, 1, 0))
self.eyeRightUpV.xfo = eyeRightXfo * Xfo(Vec3(0, 1, 0))
self.eyeLeftAtV.xfo.tr = eyeLeftXfo.transformVector(Vec3(8.0, 0.0, 0.0))
self.eyeRightAtV.xfo.tr = eyeRightXfo.transformVector(Vec3(8.0, 0.0, 0.0))
lookAtXfo = headXfo.clone()
lookAtXfo.tr = headXfo.transformVector(eyeMidRelPos)
self.lookAtCtrl.scalePoints(Vec3(eyeLen * 1.6, eyeLen * 0.65, 1.0))
self.lookAtCtrl.xfo = lookAtXfo
self.lookAtCtrlSpace.xfo = lookAtXfo
self.jawCtrlSpace.xfo = jawXfo
self.jawCtrl.xfo = jawXfo
self.jawCtrl.setCurveData(jawCrvData)
# ============
# Set IO Xfos
# ============
self.neckRefInputTgt.xfo = headXfo
self.worldRefInputTgt.xfo = headXfo
self.headOutputTgt.xfo = headXfo
self.jawOutputTgt.xfo = jawXfo
self.eyeLOutputTgt.xfo = eyeLeftXfo
self.eyeROutputTgt.xfo = eyeRightXfo
# Eval Constraints
self.headInputConstraint.evaluate()
self.headOutputConstraint.evaluate()
self.jawOutputConstraint.evaluate()
self.eyeLOutputConstraint.evaluate()
self.eyeROutputConstraint.evaluate()
# Eval Operators
self.eyeLeftDirKLOp.evaluate()
self.eyeRightDirKLOp.evaluate()
self.outputsToDeformersKLOp.evaluate()
# Have to set the eye control xfos to match the evaluated xfos from
self.eyeLeftCtrl.xfo = self.eyeLeftCtrlSpace.xfo
self.eyeRightCtrl.xfo = self.eyeRightCtrlSpace.xfo
示例4: ArmComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
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.
"""
super(ArmComponentRig, self).loadData( data )
self.clavicleEndInputTgt.xfo.tr = data['bicepXfo'].tr
self.bicepFKCtrlSpace.xfo = data['bicepXfo']
self.bicepFKCtrl.xfo = data['bicepXfo']
self.bicepFKCtrl.scalePoints(Vec3(data['bicepLen'], data['bicepFKCtrlSize'], data['bicepFKCtrlSize']))
self.bicepOutputTgt.xfo = data['bicepXfo']
self.forearmOutputTgt.xfo = data['forearmXfo']
self.forearmFKCtrlSpace.xfo = data['forearmXfo']
self.forearmFKCtrl.xfo = data['forearmXfo']
self.forearmFKCtrl.scalePoints(Vec3(data['forearmLen'], data['forearmFKCtrlSize'], data['forearmFKCtrlSize']))
self.handCtrlSpace.xfo = data['handXfo']
self.handCtrl.xfo = data['handXfo']
self.armIKCtrlSpace.xfo.tr = data['armEndXfo'].tr
self.armIKCtrl.xfo.tr = data['armEndXfo'].tr
if self.getLocation() == "R":
self.armIKCtrl.rotatePoints(0, 90, 0)
else:
self.armIKCtrl.rotatePoints(0, -90, 0)
self.armUpVCtrlSpace.xfo = data['upVXfo']
self.armUpVCtrl.xfo = data['upVXfo']
self.rightSideInputAttr.setValue(self.getLocation() is 'R')
self.armBone0LenInputAttr.setMin(0.0)
self.armBone0LenInputAttr.setMax(data['bicepLen'] * 3.0)
self.armBone0LenInputAttr.setValue(data['bicepLen'])
self.armBone1LenInputAttr.setMin(0.0)
self.armBone1LenInputAttr.setMax(data['forearmLen'] * 3.0)
self.armBone1LenInputAttr.setValue(data['forearmLen'])
# Outputs
self.handOutputTgt.xfo = data['handXfo']
# Eval Constraints
self.armIKCtrlSpaceInputConstraint.evaluate()
self.armUpVCtrlSpaceInputConstraint.evaluate()
self.armRootInputConstraint.evaluate()
self.armRootInputConstraint.evaluate()
self.handConstraint.evaluate()
self.handCtrlSpaceConstraint.evaluate()
# Eval Operators
self.spliceOp.evaluate()
self.outputsToDeformersKLOp.evaluate()
示例5: FabriceHeadRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
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)
# Add Att Inputs
self.deformersToOutputsKLOp.setInput('drawDebug', self.drawDebugInputAttr)
self.deformersToOutputsKLOp.setInput('rigScale', self.rigScaleInputAttr)
# Add Xfo Outputs
self.deformersToOutputsKLOp.setInput('constrainers', [self.headOutputTgt, self.jawOutputTgt])
# Add Xfo Outputs
self.deformersToOutputsKLOp.setOutput('constrainees', [headDef, jawDef])
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(FabriceHeadRig, self).loadData( data )
headXfo = data['headXfo']
headCtrlCrvData = data['headCtrlCrvData']
jawPosition = data['jawPosition']
jawCtrlCrvData = data['jawCtrlCrvData']
self.headAimCtrlSpace.xfo.ori = headXfo.ori
self.headAimCtrlSpace.xfo.tr = headXfo.tr.add(Vec3(0, 0, 4))
self.headAimCtrl.xfo = self.headAimCtrlSpace.xfo
self.headAimUpV.xfo.ori = self.headAimCtrl.xfo.ori
self.headAimUpV.xfo.tr = self.headAimCtrl.xfo.tr.add(Vec3(0, 3, 0))
self.headAim.xfo = headXfo
self.headCtrlSpace.xfo = headXfo
self.headCtrl.xfo = headXfo
self.headCtrl.setCurveData(headCtrlCrvData)
self.jawCtrlSpace.xfo.tr = jawPosition
self.jawCtrl.xfo.tr = jawPosition
self.jawCtrl.setCurveData(jawCtrlCrvData)
# ============
# Set IO Xfos
# ============
self.headBaseInputTgt.xfo = headXfo
self.headOutputTgt.xfo = headXfo
self.jawOutputTgt.xfo.tr = jawPosition
# ====================
# Evaluate Splice Ops
# ====================
# evaluate the constraint op so that all the joint transforms are updated.
self.headAimCanvasOp.evaluate()
self.deformersToOutputsKLOp.evaluate()
# evaluate the constraints to ensure the outputs are now in the correct location.
self.headToAimConstraint.evaluate()
self.headAimInputConstraint.evaluate()
self.headOutputConstraint.evaluate()
self.jawOutputConstraint.evaluate()
示例6: LegComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# 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)
# Add Toe Deformer Splice Op
self.toeDefKLOp = KLOperator('toeDeformerKLOp', 'PoseConstraintSolver', 'Kraken')
self.addOperator(self.toeDefKLOp)
# Add Att Inputs
self.toeDefKLOp.setInput('drawDebug', self.drawDebugInputAttr)
self.toeDefKLOp.setInput('rigScale', self.rigScaleInputAttr)
# Add Xfo Inputs
self.toeDefKLOp.setInput('constrainer', self.toeOutputTgt)
# Add Xfo Outputs
self.toeDefKLOp.setOutput('constrainee', self.toeDef)
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.
Return:
True if successful.
"""
super(LegComponentRig, self).loadData( data )
self.femurFKCtrlSpace.xfo = data['femurXfo']
self.femurFKCtrl.xfo = data['femurXfo']
self.femurFKCtrl.scalePoints(Vec3(data['femurLen'], 1.75, 1.75))
self.femurOutputTgt.xfo = data['femurXfo']
self.shinOutputTgt.xfo = data['kneeXfo']
self.shinFKCtrlSpace.xfo = data['kneeXfo']
self.shinFKCtrl.xfo = data['kneeXfo']
self.shinFKCtrl.scalePoints(Vec3(data['shinLen'], 1.5, 1.5))
self.footCtrlSpace.xfo.tr = data['ankleXfo'].tr
self.footCtrl.xfo.tr = data['ankleXfo'].tr
self.toeCtrlSpace.xfo = data['toeXfo']
self.toeCtrl.xfo = data['toeXfo']
self.legIKCtrlSpace.xfo.tr = data['ankleXfo'].tr
self.legIKCtrl.xfo.tr = data['ankleXfo'].tr
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))
self.legUpVCtrlSpace.xfo = data['upVXfo']
self.legUpVCtrl.xfo = data['upVXfo']
self.rightSideInputAttr.setValue(self.getLocation() is 'R')
self.legBone0LenInputAttr.setMin(0.0)
self.legBone0LenInputAttr.setMax(data['femurLen'] * 3.0)
self.legBone0LenInputAttr.setValue(data['femurLen'])
self.legBone1LenInputAttr.setMin(0.0)
self.legBone1LenInputAttr.setMax(data['shinLen'] * 3.0)
self.legBone1LenInputAttr.setValue(data['shinLen'])
self.legPelvisInputTgt.xfo = data['femurXfo']
# Eval Constraints
self.legIKCtrlSpaceInputConstraint.evaluate()
self.legUpVCtrlSpaceInputConstraint.evaluate()
self.legRootInputConstraint.evaluate()
self.footOutputConstraint.evaluate()
self.toeOutputConstraint.evaluate()
# Eval Operators
self.legIKKLOp.evaluate()
self.outputsToDeformersKLOp.evaluate()
self.footDefKLOp.evaluate()
示例7: TentacleComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# 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")
fkCtrl.alignOnXAxis()
fkCtrl.lockScale(x=True, y=True, z=True)
fkCtrl.lockTranslation(x=True, y=True, z=True)
self.fkCtrlSpaces.append(fkCtrlSpace)
self.fkCtrls.append(fkCtrl)
def setNumDeformers(self, numDeformers):
# Add new deformers and outputs
for i in xrange(len(self.boneOutputsTgt), numDeformers):
name = 'bone' + str(i + 1).zfill(2)
tentacleOutput = ComponentOutput(name, parent=self.outputHrcGrp)
self.boneOutputsTgt.append(tentacleOutput)
for i in xrange(len(self.deformerJoints), numDeformers):
name = 'bone' + str(i + 1).zfill(2)
boneDef = Joint(name, parent=self.defCmpGrp)
boneDef.setComponent(self)
self.deformerJoints.append(boneDef)
return True
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(TentacleComponentRig, self).loadData( data )
boneXfos = data['boneXfos']
boneLengths = data['boneLengths']
numJoints = data['numJoints']
endXfo = data['endXfo']
# Add extra controls and outputs
self.setNumControls(numJoints)
self.setNumDeformers(numJoints)
# Scale controls based on bone lengths
for i, each in enumerate(self.fkCtrlSpaces):
self.fkCtrlSpaces[i].xfo = boneXfos[i]
self.fkCtrls[i].xfo = boneXfos[i]
self.fkCtrls[i].scalePoints(Vec3(Vec3(boneLengths[i], boneLengths[i] * 0.45, boneLengths[i] * 0.45)))
self.chainBase.xfo = boneXfos[0]
self.tentacleIKCtrlSpace.xfo = endXfo
self.tentacleIKCtrl.xfo = endXfo
# ============
# Set IO Xfos
# ============
self.rootInputTgt.xfo = boneXfos[0]
for i in xrange(len(boneLengths)):
self.boneOutputsTgt[i].xfo = boneXfos[i]
self.tentacleEndXfoOutputTgt.xfo = endXfo
# =============
# Set IO Attrs
# =============
tipBoneLen = boneLengths[len(boneLengths) - 1]
self.tipBoneLenInputAttr.setMax(tipBoneLen * 2.0)
self.tipBoneLenInputAttr.setValue(tipBoneLen)
# ====================
# Evaluate Splice Ops
# ====================
# evaluate the nbone op so that all the output transforms are updated.
self.tentacleSolverKLOp.evaluate()
self.outputsToDeformersKLOp.evaluate()
示例8: SpineComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
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()
def setNumDeformers(self, numDeformers):
# Add new deformers and outputs
for i in xrange(len(self.spineOutputs), numDeformers):
name = 'spine' + str(i + 1).zfill(2)
spineOutput = ComponentOutput(name, parent=self.outputHrcGrp)
self.spineOutputs.append(spineOutput)
for i in xrange(len(self.deformerJoints), numDeformers):
name = 'spine' + str(i + 1).zfill(2)
spineDef = Joint(name, parent=self.defCmpGrp)
spineDef.setComponent(self)
self.deformerJoints.append(spineDef)
return True
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(SpineComponentRig, self).loadData( data )
cogPosition = data['cogPosition']
spine01Position = data['spine01Position']
spine02Position = data['spine02Position']
spine03Position = data['spine03Position']
spine04Position = data['spine04Position']
numDeformers = data['numDeformers']
self.cogCtrlSpace.xfo.tr = cogPosition
self.cogCtrl.xfo.tr = cogPosition
self.pelvisCtrlSpace.xfo.tr = cogPosition
self.pelvisCtrl.xfo.tr = cogPosition
self.spine01CtrlSpace.xfo.tr = spine01Position
self.spine01Ctrl.xfo.tr = spine01Position
self.spine02CtrlSpace.xfo.tr = spine02Position
self.spine02Ctrl.xfo.tr = spine02Position
self.spine03CtrlSpace.xfo.tr = spine03Position
self.spine03Ctrl.xfo.tr = spine03Position
self.spine04CtrlSpace.xfo.tr = spine04Position
self.spine04Ctrl.xfo.tr = spine04Position
length = spine01Position.distanceTo(spine02Position) + spine02Position.distanceTo(spine03Position) + spine03Position.distanceTo(spine04Position)
self.lengthInputAttr.setMax(length * 3.0)
self.lengthInputAttr.setValue(length)
# Update number of deformers and outputs
self.setNumDeformers(numDeformers)
# Updating constraint to use the updated last output.
self.spineEndOutputConstraint.setConstrainer(self.spineOutputs[-1], index=0)
# ============
# Set IO Xfos
# ============
# ====================
# Evaluate Splice Ops
# ====================
# evaluate the spine op so that all the output transforms are updated.
self.bezierSpineKLOp.evaluate()
# evaluate the constraint op so that all the joint transforms are updated.
self.deformersToOutputsKLOp.evaluate()
self.pelvisDefKLOp.evaluate()
# evaluate the constraints to ensure the outputs are now in the correct location.
self.spineCogOutputConstraint.evaluate()
self.spineBaseOutputConstraint.evaluate()
self.pelvisOutputConstraint.evaluate()
self.spineEndOutputConstraint.evaluate()
示例9: StretchyLimbComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# 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.
Return:
True if successful.
"""
super(StretchyLimbComponentRig, self).loadData(data)
upperXfo = data.get('upperXfo')
upperLen = data.get('upperLen')
lowerXfo = data.get('lowerXfo')
lowerLen = data.get('lowerLen')
endXfo = data.get('endXfo')
upVXfo = data.get('upVXfo')
self.upperFKCtrlSpace.xfo = upperXfo
self.upperFKCtrl.xfo = upperXfo
self.upperFKCtrl.scalePoints(Vec3(upperLen, 1.75, 1.75))
self.limbUpperOutputTgt.xfo = upperXfo
self.limbLowerOutputTgt.xfo = lowerXfo
self.lowerFKCtrlSpace.xfo = lowerXfo
self.lowerFKCtrl.xfo = lowerXfo
self.lowerFKCtrl.scalePoints(Vec3(lowerLen, 1.5, 1.5))
self.limbIKCtrlSpace.xfo.tr = endXfo.tr
self.limbIKCtrl.xfo.tr = endXfo.tr
if self.getLocation() == "R":
self.limbIKCtrl.rotatePoints(0, 90, 0)
self.limbIKCtrl.translatePoints(Vec3(-1.0, 0.0, 0.0))
else:
self.limbIKCtrl.rotatePoints(0, -90, 0)
self.limbIKCtrl.translatePoints(Vec3(1.0, 0.0, 0.0))
self.limbUpVCtrlSpace.xfo = upVXfo
self.limbUpVCtrl.xfo = upVXfo
self.limbBone0LenInputAttr.setMin(0.0)
self.limbBone0LenInputAttr.setMax(upperLen * 3.0)
self.limbBone0LenInputAttr.setValue(upperLen)
self.limbBone1LenInputAttr.setMin(0.0)
self.limbBone1LenInputAttr.setMax(lowerLen * 3.0)
self.limbBone1LenInputAttr.setValue(lowerLen)
self.limbParentInputTgt.xfo = upperXfo
# Set Attrs
self.rightSideInputAttr.setValue(self.getLocation() is 'R')
# Eval Constraints
self.limbIKCtrlSpaceInputConstraint.evaluate()
self.limbUpVCtrlSpaceInputConstraint.evaluate()
self.limbRootInputConstraint.evaluate()
# Eval Operators
self.limbIKKLOp.evaluate()
self.outputsToDeformersKLOp.evaluate()
示例10: InsectLegComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
boneDef = Joint(name, parent=self.defCmpGrp)
boneDef.setComponent(self)
self.deformerJoints.append(boneDef)
return True
def calculateUpVXfo(self, boneXfos, endXfo):
"""Calculates the transform for the UpV control.
Args:
boneXfos (list): Bone transforms.
endXfo (Xfo): Transform for the end of the chain.
Returns:
Xfo: Up Vector transform.
"""
# Calculate FW
toFirst = boneXfos[1].tr.subtract(boneXfos[0].tr).unit()
toTip = endXfo.tr.subtract(boneXfos[0].tr).unit()
fw = toTip.cross(toFirst).unit()
chainNormal = fw.cross(toTip).unit()
chainZAxis = toTip.cross(chainNormal).unit()
chainXfo = Xfo()
chainXfo.setFromVectors(toTip.unit(), chainNormal, chainZAxis, boneXfos[0].tr)
rootToTip = endXfo.tr.subtract(boneXfos[0].tr).length()
upVXfo = Xfo()
upVXfo.tr = chainXfo.transformVector(Vec3(rootToTip / 2.0, rootToTip / 2.0, 0.0))
return upVXfo
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(InsectLegComponentRig, self).loadData(data)
boneXfos = data["boneXfos"]
boneLengths = data["boneLengths"]
numJoints = data["numJoints"]
endXfo = data["endXfo"]
# Add extra controls and outputs
self.setNumControls(numJoints)
self.setNumDeformers(numJoints)
# Scale controls based on bone lengths
for i, each in enumerate(self.fkCtrlSpaces):
self.fkCtrlSpaces[i].xfo = boneXfos[i]
self.fkCtrls[i].xfo = boneXfos[i]
self.fkCtrls[i].scalePoints(Vec3(boneLengths[i], 1.75, 1.75))
self.chainBase.xfo = boneXfos[0]
self.legIKCtrlSpace.xfo = endXfo
self.legIKCtrl.xfo = endXfo
upVXfo = self.calculateUpVXfo(boneXfos, endXfo)
self.legUpVCtrlSpace.xfo = upVXfo
self.legUpVCtrl.xfo = upVXfo
# Set max on the rootIndex attribute
self.rootIndexInputAttr.setMax(len(boneXfos))
# ============
# Set IO Xfos
# ============
self.rootInputTgt.xfo = boneXfos[0]
for i in xrange(len(boneLengths)):
self.boneOutputsTgt[i].xfo = boneXfos[i]
self.legEndXfoOutputTgt.xfo = endXfo
self.legEndPosOutputTgt.xfo = endXfo
# =============
# Set IO Attrs
# =============
tipBoneLen = boneLengths[len(boneLengths) - 1]
self.tipBoneLenInputAttr.setMax(tipBoneLen * 2.0)
self.tipBoneLenInputAttr.setValue(tipBoneLen)
# ====================
# Evaluate Splice Ops
# ====================
# evaluate the nbone op so that all the output transforms are updated.
self.nBoneSolverKLOp.evaluate()
self.outputsToDeformersKLOp.evaluate()
示例11: FootComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# Add Deformer KL Op
# ===================
self.outputsToDeformersKLOp = KLOperator('foot' + self.getLocation() + 'DeformerKLOp', '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.ankleOutputTgt, self.toeOutputTgt])
# Add Xfo Outputs
self.outputsToDeformersKLOp.setOutput('constrainees', [self.ankleDef, self.toeDef])
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(FootComponentRig, self).loadData( data )
footXfo = data.get('footXfo')
ankleXfo = data.get('ankleXfo')
toeXfo = data.get('toeXfo')
ankleFKXfo = data.get('ankleFKXfo')
toeFKXfo = data.get('toeFKXfo')
ankleLen = data.get('ankleLen')
toeLen = data.get('toeLen')
backPivotXfo = data.get('backPivotXfo')
frontPivotXfo = data.get('frontPivotXfo')
outerPivotXfo = data.get('outerPivotXfo')
innerPivotXfo = data.get('innerPivotXfo')
self.footAll.xfo = footXfo
self.ankleIKCtrlSpace.xfo = ankleXfo
self.ankleIKCtrl.xfo = ankleXfo
self.toeIKCtrlSpace.xfo = toeXfo
self.toeIKCtrl.xfo = toeXfo
self.ankleFKCtrl.scalePoints(Vec3(ankleLen, 1.0, 1.0))
self.toeFKCtrl.scalePoints(Vec3(toeLen, 1.0, 1.0))
self.ankleFKCtrlSpace.xfo.tr = footXfo.tr
self.ankleFKCtrlSpace.xfo.ori = ankleFKXfo.ori
self.ankleFKCtrl.xfo.tr = footXfo.tr
self.ankleFKCtrl.xfo.ori = ankleFKXfo.ori
self.toeFKCtrlSpace.xfo = toeFKXfo
self.toeFKCtrl.xfo = toeFKXfo
self.pivotAll.xfo = footXfo
self.backPivotCtrlSpace.xfo = backPivotXfo
self.backPivotCtrl.xfo = backPivotXfo
self.frontPivotCtrlSpace.xfo = frontPivotXfo
self.frontPivotCtrl.xfo = frontPivotXfo
self.outerPivotCtrlSpace.xfo = outerPivotXfo
self.outerPivotCtrl.xfo = outerPivotXfo
self.innerPivotCtrlSpace.xfo = innerPivotXfo
self.innerPivotCtrl.xfo = innerPivotXfo
if self.getLocation() == 'R':
self.outerPivotCtrl.rotatePoints(0.0, 180.0, 0.0)
self.innerPivotCtrl.rotatePoints(0.0, 180.0, 0.0)
self.ankleIKCtrl.scalePoints(Vec3(ankleLen, 1.0, 1.5))
self.toeIKCtrl.scalePoints(Vec3(toeLen, 1.0, 1.5))
# Set Attribute Values
self.rightSideInputAttr.setValue(self.getLocation() is 'R')
self.ankleLenInputAttr.setValue(ankleLen)
self.ankleLenInputAttr.setMax(ankleLen * 3.0)
self.toeLenInputAttr.setValue(toeLen)
self.toeLenInputAttr.setMax(toeLen * 3.0)
# Set IO Xfos
self.ikHandleInputTgt.xfo = footXfo
self.legEndInputTgt.xfo.tr = footXfo.tr
self.legEndInputTgt.xfo.ori = ankleXfo.ori
self.legEndFKInputTgt.xfo.tr = footXfo.tr
self.legEndFKInputTgt.xfo.ori = ankleXfo.ori
self.ikTargetOutputTgt.xfo.tr = footXfo.tr
self.ikTargetOutputTgt.xfo.ori = ankleXfo.ori
# Eval Canvas Ops
self.footPivotCanvasOp.evaluate()
self.footSolverCanvasOp.evaluate()
# Eval Constraints
self.ikTargetOutputConstraint.evaluate()
self.ankleFKInputConstraint.evaluate()
示例12: TwistComponentRig
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# Constrain outputs
# ===============
# Add Splice Ops
# ===============
# Add Spine Splice Op
self.twistKLOp = KLOperator('TwistOp', 'TwistSolver', 'Kraken')
self.addOperator(self.twistKLOp)
# Add Att Inputs
self.twistKLOp.setInput('drawDebug', self.drawDebugInputAttr)
self.twistKLOp.setInput('rigScale', self.rigScaleInputAttr)
self.twistKLOp.setInput('blendBias', self.blendBiasInputAttr)
# Add Xfo Inputs
self.twistKLOp.setInput('origin', self.originTransform)
self.twistKLOp.setInput('originUpV', self.originUpVTransform)
self.twistKLOp.setInput('insert', self.insertTransform)
self.twistKLOp.setInput('insertUpV', self.insertUpVTransform)
# Add Xfo Outputs
self.twistKLOp.setOutput('pose', self.twistOutputs)
# # Add Deformer Splice Op
self.deformersToOutputsKLOp = KLOperator('twistDeformerKLOp', '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.twistOutputs)
# Add Xfo Outputs
self.deformersToOutputsKLOp.setOutput('constrainees', self.deformerJoints)
Profiler.getInstance().pop()
def setNumDeformers(self, numDeformers):
# Add new deformers and outputs
for i in xrange(len(self.twistOutputs), numDeformers):
name = 'twist' + str(i + 1).zfill(2)
spineOutput = ComponentOutput(name, parent=self.outputHrcGrp)
self.twistOutputs.append(spineOutput)
for i in xrange(len(self.deformerJoints), numDeformers):
name = 'twist' + str(i + 1).zfill(2)
spineDef = Joint(name, parent=self.defCmpGrp)
spineDef.setComponent(self)
self.deformerJoints.append(spineDef)
return True
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(TwistComponentRig, self).loadData(data)
blendBias = data.get('blendBias')
originXfo = data.get('originXfo')
insertXfo = data.get('insertXfo')
originUpVXfo = data.get('originUpVXfo')
insertUpVXfo = data.get('insertUpVXfo')
numDeformers = data.get('numDeformers')
self.blendBiasInputAttr.setValue(blendBias)
self.originTransform.xfo = originXfo
self.originUpVTransform.xfo = originUpVXfo
self.insertTransform.xfo = insertXfo
self.insertUpVTransform.xfo = insertUpVXfo
self.originInputTgt.xfo = originXfo
self.insertInputTgt.xfo = insertXfo
# Update number of deformers and outputs
self.setNumDeformers(numDeformers)
# Evaluate Constraints
self.originInputConstraint.evaluate()
self.insertInputConstraint.evaluate()
self.originUpVInputConstraint.evaluate()
self.insertUpVInputConstraint.evaluate()
# Evaluate Operators
# self.twistKLOp.evaluate()
self.deformersToOutputsKLOp.evaluate()
示例13: NeckComponentGuide
# 需要导入模块: from kraken.core.objects.operators.kl_operator import KLOperator [as 别名]
# 或者: from kraken.core.objects.operators.kl_operator.KLOperator import evaluate [as 别名]
#.........这里部分代码省略.........
# =============
# Data Methods
# =============
def saveData(self):
"""Save the data for the component to be persisted.
Return:
The JSON data object
"""
data = super(NeckComponentGuide, self).saveData()
data['neckXfo'] = self.neckCtrl.xfo
data['neckMidXfo'] = self.neckMidCtrl.xfo
data['neckEndXfo'] = self.neckEndCtrl.xfo
data['neckCrvData'] = self.neckCtrlShape.getCurveData()
data['neckMidCrvData'] = self.neckMidCtrlShape.getCurveData()
return data
def loadData(self, data):
"""Load a saved guide representation from persisted data.
Arguments:
data (object): The JSON data object.
Returns:
bool: True if successful.
"""
super(NeckComponentGuide, self).loadData(data)
self.neckCtrl.xfo = data.get('neckXfo')
self.neckMidCtrl.xfo = data.get('neckMidXfo')
self.neckEndCtrl.xfo = data.get('neckEndXfo')
self.neckCtrlShape.setCurveData(data.get('neckCrvData'))
self.neckMidCtrlShape.setCurveData(data.get('neckMidCrvData'))
# Evaluate guide operators
self.neckGuideKLOp.evaluate()
return True
def getRigBuildData(self):
"""Returns the Guide data used by the Rig Component to define the layout
of the final rig.
Return:
The JSON rig data object.
"""
data = super(NeckComponentGuide, self).getRigBuildData()
neckEndXfo = Xfo(tr=self.neckEndCtrl.xfo.tr,
ori=self.neckMidCtrlShape.xfo.ori)
data['neckXfo'] = self.neckCtrlShape.xfo
data['neckCrvData'] = self.neckCtrlShape.getCurveData()
data['neckMidXfo'] = self.neckMidCtrlShape.xfo
data['neckMidCrvData'] = self.neckMidCtrlShape.getCurveData()
data['neckEndXfo'] = neckEndXfo
return data
# ==============
# Class Methods
# ==============
@classmethod
def getComponentType(cls):
"""Enables introspection of the class prior to construction to determine
if it is a guide component.
Returns:
bool: Whether the component is a guide component.
"""
return 'Guide'
@classmethod
def getRigComponentClass(cls):
"""Returns the corresponding rig component class for this guide
component class.
Returns:
class: The rig component class.
"""
return NeckComponentRig