本文整理汇总了Python中kraken.core.objects.control.Control.setCurveData方法的典型用法代码示例。如果您正苦于以下问题:Python Control.setCurveData方法的具体用法?Python Control.setCurveData怎么用?Python Control.setCurveData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.objects.control.Control
的用法示例。
在下文中一共展示了Control.setCurveData方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addFinger
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [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
示例2: FabriceTailGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [as 别名]
#.........这里部分代码省略.........
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
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()
示例3: FabriceTailRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [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()
示例4: FabriceClavicleGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [as 别名]
class FabriceClavicleGuide(FabriceClavicle):
"""Clavicle Component Guide"""
def __init__(self, name='clavicle', parent=None):
Profiler.getInstance().push("Construct Clavicle Guide Component:" + name)
super(FabriceClavicleGuide, self).__init__(name, parent)
# =========
# Controls
# =========
# Guide Controls
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.clavicleCtrl = Control('clavicle', parent=self.ctrlCmpGrp, shape="cube")
self.clavicleCtrl.alignOnXAxis()
self.clavicleCtrl.scalePoints(Vec3(1.0, 0.25, 0.25))
data = {
"name": name,
"location": "L",
"clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
'clavicleCtrlCrvData': self.clavicleCtrl.getCurveData()
}
self.loadData(data)
Profiler.getInstance().pop()
# =============
# Data Methods
# =============
def saveData(self):
"""Save the data for the component to be persisted.
Return:
The JSON data object
"""
data = super(FabriceClavicleGuide, self).saveData()
data['clavicleXfo'] = self.clavicleCtrl.xfo
data['clavicleCtrlCrvData'] = self.clavicleCtrl.getCurveData()
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(FabriceClavicleGuide, self).loadData( data )
self.clavicleCtrl.xfo = data['clavicleXfo']
self.clavicleCtrl.setCurveData(data['clavicleCtrlCrvData'])
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(FabriceClavicleGuide, self).getRigBuildData()
data['clavicleXfo'] = self.clavicleCtrl.xfo
data['clavicleCtrlCrvData'] = self.clavicleCtrl.getCurveData()
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'
#.........这里部分代码省略.........
示例5: FabriceClavicleRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [as 别名]
class FabriceClavicleRig(FabriceClavicle):
"""Clavicle Component"""
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()
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(FabriceClavicleRig, self).loadData( data )
self.clavicleCtrlSpace.xfo = data['clavicleXfo']
self.clavicleCtrl.xfo = data['clavicleXfo']
self.clavicleCtrl.setCurveData(data['clavicleCtrlCrvData'])
# ============
# Set IO Xfos
# ============
self.spineEndInputTgt.xfo = data['clavicleXfo']
self.clavicleOutputTgt.xfo = data['clavicleXfo']
示例6: HeadComponentGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [as 别名]
#.........这里部分代码省略.........
# =============
# Data Methods
# =============
def saveData(self):
"""Save the data for the component to be persisted.
Return:
The JSON data object
"""
data = super(HeadComponentGuide, self).saveData()
data['headXfo'] = self.headCtrl.xfo
data['headCrvData'] = self.headCtrl.getCurveData()
data['eyeLeftXfo'] = self.eyeLeftCtrl.xfo
data['eyeLeftCrvData'] = self.eyeLeftCtrl.getCurveData()
data['eyeRightXfo'] = self.eyeRightCtrl.xfo
data['eyeRightCrvData'] = self.eyeRightCtrl.getCurveData()
data['jawXfo'] = self.jawCtrl.xfo
data['jawCrvData'] = self.jawCtrl.getCurveData()
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(HeadComponentGuide, self).loadData(data)
self.headCtrl.xfo = data.get('headXfo', self.default_data['headXfo'])
self.headCtrl.setCurveData(data.get('headCrvData', self.default_data['headCrvData']))
self.eyeLeftCtrl.xfo = data.get('eyeLeftXfo', self.default_data['eyeLeftXfo'])
self.eyeLeftCtrl.setCurveData(data.get('eyeLeftCrvData', self.default_data['eyeLeftCrvData']))
self.eyeRightCtrl.xfo = data.get('eyeRightXfo', self.default_data['eyeRightXfo'])
self.eyeRightCtrl.setCurveData(data.get('eyeRightCrvData', self.default_data['eyeRightCrvData']))
self.jawCtrl.xfo = data.get('jawXfo', self.default_data['jawXfo'])
self.jawCtrl.setCurveData(data.get('jawCrvData', self.default_data['jawCrvData']))
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(HeadComponentGuide, self).getRigBuildData()
data['headXfo'] = self.headCtrl.xfo
data['headCrvData'] = self.headCtrl.getCurveData()
data['eyeLeftXfo'] = self.eyeLeftCtrl.xfo
data['eyeLeftCrvData'] = self.eyeLeftCtrl.getCurveData()
data['eyeRightXfo'] = self.eyeRightCtrl.xfo
data['eyeRightCrvData'] = self.eyeRightCtrl.getCurveData()
data['jawXfo'] = self.jawCtrl.xfo
data['jawCrvData'] = self.jawCtrl.getCurveData()
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 HeadComponentRig
示例7: HeadComponentRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [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
示例8: FabriceHeadGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [as 别名]
class FabriceHeadGuide(FabriceHead):
"""Fabrice Head Component Guide"""
def __init__(self, name='head', parent=None):
Profiler.getInstance().push("Construct Head Guide Component:" + name)
super(FabriceHeadGuide, self).__init__(name, parent)
# =========
# Controls
# =========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape="circle")
self.headCtrl.rotatePoints(90.0, 0.0, 0.0)
self.headCtrl.scalePoints(Vec3(3.5, 3.5, 3.5))
self.jawCtrl = Control('jaw', parent=self.ctrlCmpGrp, shape="cube")
self.jawCtrl.alignOnZAxis()
self.jawCtrl.scalePoints(Vec3(2.0, 0.5, 2.0))
self.jawCtrl.alignOnYAxis(negative=True)
self.jawCtrl.setColor('orange')
data = {
"name": name,
"location": "M",
"headXfo": Xfo(Vec3(0.0, 1.67, 1.75)),
"headCtrlCrvData": self.headCtrl.getCurveData(),
"jawPosition": Vec3(0.0, 1.2787, 2.0078),
"jawCtrlCrvData": self.jawCtrl.getCurveData(),
}
self.loadData(data)
Profiler.getInstance().pop()
# =============
# Data Methods
# =============
def saveData(self):
"""Save the data for the component to be persisted.
Return:
The JSON data object
"""
data = super(FabriceHeadGuide, self).saveData()
data['headXfo'] = self.headCtrl.xfo
data['headCtrlCrvData'] = self.headCtrl.getCurveData()
data['jawPosition'] = self.jawCtrl.xfo.tr
data['jawCtrlCrvData'] = self.jawCtrl.getCurveData()
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(FabriceHeadGuide, self).loadData( data )
self.headCtrl.xfo = data['headXfo']
self.headCtrl.setCurveData(data['headCtrlCrvData'])
self.jawCtrl.xfo.tr = data['jawPosition']
self.jawCtrl.setCurveData(data['jawCtrlCrvData'])
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(FabriceHeadGuide, self).getRigBuildData()
data['headXfo'] = self.headCtrl.xfo
data['headCtrlCrvData'] = self.headCtrl.getCurveData()
data['jawPosition'] = self.jawCtrl.xfo.tr
data['jawCtrlCrvData'] = self.jawCtrl.getCurveData()
return data
# ==============
# Class Methods
#.........这里部分代码省略.........
示例9: FabriceHeadRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [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()
示例10: NeckComponentGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [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
示例11: NeckComponentRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import setCurveData [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()