本文整理汇总了Python中kraken.core.objects.control.Control.getCurveData方法的典型用法代码示例。如果您正苦于以下问题:Python Control.getCurveData方法的具体用法?Python Control.getCurveData怎么用?Python Control.getCurveData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.objects.control.Control
的用法示例。
在下文中一共展示了Control.getCurveData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [as 别名]
def __init__(self, name='head', parent=None, *args, **kwargs):
Profiler.getInstance().push("Construct Head Guide Component:" + name)
super(HeadComponentGuide, self).__init__(name, parent, *args, **kwargs)
# =========
# Controls
# =========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
sphereCtrl = Control('sphere', shape='sphere')
sphereCtrl.scalePoints(Vec3(0.375, 0.375, 0.375))
self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape='square')
self.headCtrl.rotatePoints(90, 0, 0)
self.headCtrl.translatePoints(Vec3(0.0, 0.5, 0.0))
self.headCtrl.scalePoints(Vec3(1.8, 2.0, 2.0))
self.eyeLeftCtrl = Control('eyeLeft', parent=self.headCtrl, shape='arrow_thin')
self.eyeLeftCtrl.translatePoints(Vec3(0, 0, 0.5))
self.eyeLeftCtrl.rotatePoints(0, 90, 0)
self.eyeLeftCtrl.appendCurveData(sphereCtrl.getCurveData())
self.eyeRightCtrl = Control('eyeRight', parent=self.headCtrl, shape='arrow_thin')
self.eyeRightCtrl.translatePoints(Vec3(0, 0, 0.5))
self.eyeRightCtrl.rotatePoints(0, 90, 0)
self.eyeRightCtrl.appendCurveData(sphereCtrl.getCurveData())
self.jawCtrl = Control('jaw', parent=self.headCtrl, shape='square')
self.jawCtrl.rotatePoints(90, 0, 0)
self.jawCtrl.rotatePoints(0, 90, 0)
self.jawCtrl.translatePoints(Vec3(0.0, -0.5, 0.5))
self.jawCtrl.scalePoints(Vec3(1.0, 0.8, 1.5))
self.jawCtrl.setColor('orange')
eyeXAlignOri = Quat()
eyeXAlignOri.setFromAxisAndAngle(Vec3(0, 1, 0), Math_degToRad(-90))
self.default_data = {
"name": name,
"location": "M",
"headXfo": Xfo(Vec3(0.0, 17.5, -0.5)),
"headCrvData": self.headCtrl.getCurveData(),
"eyeLeftXfo": Xfo(tr=Vec3(0.375, 18.5, 0.5), ori=eyeXAlignOri),
"eyeLeftCrvData": self.eyeLeftCtrl.getCurveData(),
"eyeRightXfo": Xfo(tr=Vec3(-0.375, 18.5, 0.5), ori=eyeXAlignOri),
"eyeRightCrvData": self.eyeRightCtrl.getCurveData(),
"jawXfo": Xfo(Vec3(0.0, 17.875, -0.275)),
"jawCrvData": self.jawCtrl.getCurveData()
}
self.loadData(self.default_data)
Profiler.getInstance().pop()
示例2: __init__
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [as 别名]
def __init__(self, name='twist', parent=None):
Profiler.getInstance().push('Construct Spine Guide Component:' + name)
super(TwistComponentGuide, self).__init__(name, parent)
# =========
# Controls
# ========
guideSettingsAttrGrp = AttributeGroup('GuideSettings', parent=self)
self.numDeformersAttr = IntegerAttribute('numDeformers', value=1, minValue=0, maxValue=20, parent=guideSettingsAttrGrp)
self.blendBiasAttr = ScalarAttribute('blendBias', value=0.0, minValue=0, maxValue=1.0, parent=guideSettingsAttrGrp)
# Guide Controls
triangleCtrl = Control('triangle', shape='triangle')
triangleCtrl.rotatePoints(90, 0, 0)
triangleCtrl.scalePoints(Vec3(0.25, 0.25, 0.25))
triangleCtrl.scalePoints(Vec3(1.0, 0.5, 1.0))
triangleCtrl.translatePoints(Vec3(0.0, 1.25, 0.0))
triangleCtrl.rotatePoints(0, 90, 0)
self.originCtrl = Control('origin', parent=self.ctrlCmpGrp, shape='circle')
self.originCtrl.rotatePoints(90, 0, 0)
self.originCtrl.rotatePoints(0, 90, 0)
self.originCtrl.appendCurveData(triangleCtrl.getCurveData())
self.insertCtrl = Control('insert', parent=self.ctrlCmpGrp, shape='circle')
self.insertCtrl.rotatePoints(90, 0, 0)
self.insertCtrl.rotatePoints(0, 90, 0)
self.insertCtrl.appendCurveData(triangleCtrl.getCurveData())
self.default_data = {
'name': name,
'location': 'M',
'blendBias': 0.5,
'originXfo': Xfo(Vec3(0.0, 0.0, 0.0)),
'insertXfo': Xfo(Vec3(5.0, 0.0, 0.0)),
'numDeformers': 5
}
self.loadData(self.default_data)
Profiler.getInstance().pop()
示例3: FabriceTailGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [as 别名]
class FabriceTailGuide(FabriceTail):
"""Fabrice Tail Component Guide"""
def __init__(self, name='tail', parent=None):
Profiler.getInstance().push("Construct Fabrice Tail Guide Component:" + name)
super(FabriceTailGuide, self).__init__(name, parent)
# =========
# Controls
# ========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.numDeformersAttr = IntegerAttribute('numDeformers', value=1, minValue=0, maxValue=20, parent=guideSettingsAttrGrp)
self.numDeformersAttr.setValueChangeCallback(self.updateNumDeformers)
# Guide Controls
self.tailBaseCtrl = Control('tailBase', parent=self.ctrlCmpGrp, shape='sphere')
self.tailBaseCtrl.scalePoints(Vec3(1.2, 1.2, 1.2))
self.tailBaseCtrl.lockScale(x=True, y=True, z=True)
self.tailBaseCtrl.setColor("turqoise")
self.tailBaseHandleCtrl = Control('tailBaseHandle', parent=self.ctrlCmpGrp, shape='pin')
self.tailBaseHandleCtrl.rotatePoints(90, 0, 0)
self.tailBaseHandleCtrl.translatePoints(Vec3(0, 1.0, 0))
self.tailBaseHandleCtrl.lockScale(x=True, y=True, z=True)
self.tailBaseHandleCtrl.setColor("turqoise")
self.tailEndHandleCtrl = Control('tailEndHandle', parent=self.ctrlCmpGrp, shape='pin')
self.tailEndHandleCtrl.rotatePoints(90, 0, 0)
self.tailEndHandleCtrl.translatePoints(Vec3(0, 1.0, 0))
self.tailEndHandleCtrl.lockScale(x=True, y=True, z=True)
self.tailEndHandleCtrl.setColor("turqoise")
self.tailEndCtrl = Control('tailEnd', parent=self.ctrlCmpGrp, shape='pin')
self.tailEndCtrl.rotatePoints(90, 0, 0)
self.tailEndCtrl.translatePoints(Vec3(0, 1.0, 0))
self.tailEndCtrl.lockScale(x=True, y=True, z=True)
self.tailEndCtrl.setColor("turqoise")
# ===============
# Add Splice Ops
# ===============
# Add Tail Splice Op
self.bezierSpineKLOp = KLOperator('spineGuideKLOp', 'BezierSpineSolver', 'Kraken')
self.bezierSpineKLOp.setOutput('outputs', self.tailVertebraeOutput.getTarget())
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.tailBaseCtrl)
self.bezierSpineKLOp.setInput('baseHandle', self.tailBaseHandleCtrl)
self.bezierSpineKLOp.setInput('tipHandle', self.tailEndHandleCtrl)
self.bezierSpineKLOp.setInput('tip', self.tailEndCtrl)
self.loadData({
'name': name,
'location': 'M',
'tailBasePos': Vec3(0.0, 0.65, -3.1),
'tailBaseHandlePos': Vec3(0.0, 0.157, -4.7),
'tailBaseHandleCtrlCrvData': self.tailBaseHandleCtrl.getCurveData(),
'tailEndHandlePos': Vec3(0.0, 0.0625, -6.165),
'tailEndHandleCtrlCrvData': self.tailEndHandleCtrl.getCurveData(),
'tailEndPos': Vec3(0.0, -0.22, -7.42),
'tailEndCtrlCrvData': self.tailEndCtrl.getCurveData(),
'numDeformers': 6
})
Profiler.getInstance().pop()
# ==========
# Callbacks
# ==========
def updateNumDeformers(self, count):
"""Generate the guide controls for the variable outputes array.
Arguments:
count -- object, The number of joints inthe chain.
Return:
True if successful.
"""
if count == 0:
raise IndexError("'count' must be > 0")
vertebraeOutputs = self.tailVertebraeOutput.getTarget()
if count > len(vertebraeOutputs):
for i in xrange(len(vertebraeOutputs), count):
debugCtrl = Control('spine' + str(i+1).zfill(2), parent=self.outputHrcGrp, shape="vertebra")
debugCtrl.rotatePoints(0, -90, 0)
debugCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
#.........这里部分代码省略.........
示例4: FabriceClavicleGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [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: HeadComponentGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [as 别名]
class HeadComponentGuide(HeadComponent):
"""Head Component Guide"""
def __init__(self, name='head', parent=None, *args, **kwargs):
Profiler.getInstance().push("Construct Head Guide Component:" + name)
super(HeadComponentGuide, self).__init__(name, parent, *args, **kwargs)
# =========
# Controls
# =========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
sphereCtrl = Control('sphere', shape='sphere')
sphereCtrl.scalePoints(Vec3(0.375, 0.375, 0.375))
self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape='square')
self.headCtrl.rotatePoints(90, 0, 0)
self.headCtrl.translatePoints(Vec3(0.0, 0.5, 0.0))
self.headCtrl.scalePoints(Vec3(1.8, 2.0, 2.0))
self.eyeLeftCtrl = Control('eyeLeft', parent=self.headCtrl, shape='arrow_thin')
self.eyeLeftCtrl.translatePoints(Vec3(0, 0, 0.5))
self.eyeLeftCtrl.rotatePoints(0, 90, 0)
self.eyeLeftCtrl.appendCurveData(sphereCtrl.getCurveData())
self.eyeRightCtrl = Control('eyeRight', parent=self.headCtrl, shape='arrow_thin')
self.eyeRightCtrl.translatePoints(Vec3(0, 0, 0.5))
self.eyeRightCtrl.rotatePoints(0, 90, 0)
self.eyeRightCtrl.appendCurveData(sphereCtrl.getCurveData())
self.jawCtrl = Control('jaw', parent=self.headCtrl, shape='square')
self.jawCtrl.rotatePoints(90, 0, 0)
self.jawCtrl.rotatePoints(0, 90, 0)
self.jawCtrl.translatePoints(Vec3(0.0, -0.5, 0.5))
self.jawCtrl.scalePoints(Vec3(1.0, 0.8, 1.5))
self.jawCtrl.setColor('orange')
eyeXAlignOri = Quat()
eyeXAlignOri.setFromAxisAndAngle(Vec3(0, 1, 0), Math_degToRad(-90))
self.default_data = {
"name": name,
"location": "M",
"headXfo": Xfo(Vec3(0.0, 17.5, -0.5)),
"headCrvData": self.headCtrl.getCurveData(),
"eyeLeftXfo": Xfo(tr=Vec3(0.375, 18.5, 0.5), ori=eyeXAlignOri),
"eyeLeftCrvData": self.eyeLeftCtrl.getCurveData(),
"eyeRightXfo": Xfo(tr=Vec3(-0.375, 18.5, 0.5), ori=eyeXAlignOri),
"eyeRightCrvData": self.eyeRightCtrl.getCurveData(),
"jawXfo": Xfo(Vec3(0.0, 17.875, -0.275)),
"jawCrvData": self.jawCtrl.getCurveData()
}
self.loadData(self.default_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(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'])
#.........这里部分代码省略.........
示例6: FabriceHeadGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [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
#.........这里部分代码省略.........
示例7: addFinger
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [as 别名]
def addFinger(self, name):
digitSizeAttributes = []
fingerGuideCtrls = []
firstDigitCtrl = Control(name + "01", parent=self.handCtrl, shape='sphere')
firstDigitCtrl.scalePoints(Vec3(0.125, 0.125, 0.125))
firstDigitShapeCtrl = Control(name + "Shp01", parent=self.guideCtrlHrcGrp, shape='square')
firstDigitShapeCtrl.setColor('yellow')
firstDigitShapeCtrl.scalePoints(Vec3(0.175, 0.175, 0.175))
firstDigitShapeCtrl.translatePoints(Vec3(0.0, 0.125, 0.0))
fingerGuideCtrls.append(firstDigitShapeCtrl)
firstDigitCtrl.shapeCtrl = firstDigitShapeCtrl
firstDigitVisAttr = firstDigitShapeCtrl.getVisibilityAttr()
firstDigitVisAttr.connect(self.ctrlShapeToggle)
triangleCtrl = Control('tempCtrl', parent=None, shape='triangle')
triangleCtrl.rotatePoints(90.0, 0.0, 0.0)
triangleCtrl.scalePoints(Vec3(0.025, 0.025, 0.025))
triangleCtrl.translatePoints(Vec3(0.0, 0.0875, 0.0))
firstDigitCtrl.appendCurveData(triangleCtrl.getCurveData())
firstDigitCtrl.lockScale(True, True, True)
digitSettingsAttrGrp = AttributeGroup("DigitSettings", parent=firstDigitCtrl)
digitSizeAttr = ScalarAttribute('size', value=0.25, parent=digitSettingsAttrGrp)
digitSizeAttributes.append(digitSizeAttr)
# Set Finger
self.fingers[name] = []
self.fingers[name].append(firstDigitCtrl)
parent = firstDigitCtrl
numJoints = self.numJointsAttr.getValue()
if name == "thumb":
numJoints = 3
for i in xrange(2, numJoints + 2):
digitCtrl = Control(name + str(i).zfill(2), parent=parent, shape='sphere')
if i != numJoints + 1:
digitCtrl.scalePoints(Vec3(0.125, 0.125, 0.125))
digitCtrl.appendCurveData(triangleCtrl.getCurveData())
digitShapeCtrl = Control(name + 'Shp' + str(i).zfill(2), parent=self.guideCtrlHrcGrp, shape='circle')
digitShapeCtrl.setColor('yellow')
digitShapeCtrl.scalePoints(Vec3(0.175, 0.175, 0.175))
digitShapeCtrl.getVisibilityAttr().connect(self.ctrlShapeToggle)
digitCtrl.shapeCtrl = digitShapeCtrl
if i == 2:
digitShapeCtrl.translatePoints(Vec3(0.0, 0.125, 0.0))
else:
digitShapeCtrl.rotatePoints(0.0, 0.0, 90.0)
fingerGuideCtrls.append(digitShapeCtrl)
# Add size attr to all but last guide control
digitSettingsAttrGrp = AttributeGroup("DigitSettings", parent=digitCtrl)
digitSizeAttr = ScalarAttribute('size', value=0.25, parent=digitSettingsAttrGrp)
digitSizeAttributes.append(digitSizeAttr)
else:
digitCtrl.scalePoints(Vec3(0.0875, 0.0875, 0.0875))
digitCtrl.lockScale(True, True, True)
self.fingers[name].append(digitCtrl)
parent = digitCtrl
# ===========================
# Create Canvas Operators
# ===========================
# Add Finger Guide Canvas Op
fingerGuideCanvasOp = CanvasOperator(name + 'FingerGuideOp', 'Kraken.Solvers.Biped.BipedFingerGuideSolver')
self.addOperator(fingerGuideCanvasOp)
# Add Att Inputs
fingerGuideCanvasOp.setInput('drawDebug', self.drawDebugInputAttr)
fingerGuideCanvasOp.setInput('rigScale', self.rigScaleInputAttr)
# Add Xfo Inputs
fingerGuideCanvasOp.setInput('controls', self.fingers[name])
fingerGuideCanvasOp.setInput('planeSizes', digitSizeAttributes)
# Add Xfo Outputs
fingerGuideCanvasOp.setOutput('result', fingerGuideCtrls)
fingerGuideCanvasOp.setOutput('forceEval', firstDigitCtrl.getVisibilityAttr())
return firstDigitCtrl
示例8: NeckComponentGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import getCurveData [as 别名]
class NeckComponentGuide(NeckComponent):
"""Neck Component Guide"""
def __init__(self, name='neck', parent=None, *args, **kwargs):
Profiler.getInstance().push('Construct Neck Component:' + name)
super(NeckComponentGuide, self).__init__(name, parent, *args, **kwargs)
# =========
# Controls
# =========
# Guide Controls
self.neckCtrl = Control('neck', parent=self.ctrlCmpGrp, shape='sphere')
self.neckCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
self.neckMidCtrl = Control('neckMid', parent=self.ctrlCmpGrp, shape='sphere')
self.neckMidCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
self.neckEndCtrl = Control('neckEnd', parent=self.ctrlCmpGrp, shape='sphere')
self.neckEndCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
self.neckCtrlShape = Control('neck', parent=self.ctrlCmpGrp, shape='pin')
self.neckCtrlShape.rotatePoints(90.0, 0.0, 0.0)
self.neckCtrlShape.rotatePoints(0.0, 90.0, 0.0)
self.neckCtrlShape.setColor('orange')
self.neckMidCtrlShape = Control('neckMid', parent=self.ctrlCmpGrp, shape='pin')
self.neckMidCtrlShape.rotatePoints(90.0, 0.0, 0.0)
self.neckMidCtrlShape.rotatePoints(0.0, 90.0, 0.0)
self.neckMidCtrlShape.setColor('orange')
# Guide Operator
self.neckGuideKLOp = KLOperator(name + 'GuideKLOp', 'NeckGuideSolver', 'Kraken')
self.addOperator(self.neckGuideKLOp)
# Add Att Inputs
self.neckGuideKLOp.setInput('drawDebug', self.drawDebugInputAttr)
self.neckGuideKLOp.setInput('rigScale', self.rigScaleInputAttr)
# Add Source Inputs
self.neckGuideKLOp.setInput('sources', [self.neckCtrl, self.neckMidCtrl, self.neckEndCtrl])
# Add Target Outputs
self.neckGuideKLOp.setOutput('targets', [self.neckCtrlShape, self.neckMidCtrlShape])
# Calculate default values
neckVec = Vec3(0.0, 16.00, -0.75)
neckMidVec = Vec3(0.0, 16.50, -0.50)
neckEndVec = Vec3(0.0, 17.00, -0.25)
upVector = Vec3(0.0, 0.0, -1.0)
neckOri = Quat()
neckOri.setFromDirectionAndUpvector((neckMidVec - neckVec).unit(),
((neckVec + upVector) - neckVec).unit())
neckMidOri = Quat()
neckMidOri.setFromDirectionAndUpvector((neckEndVec - neckMidVec).unit(),
((neckMidVec + upVector) - neckMidVec).unit())
self.default_data = {
"name": name,
"location": "M",
"neckXfo": Xfo(tr=neckVec, ori=neckOri),
"neckMidXfo": Xfo(tr=neckMidVec, ori=neckMidOri),
"neckEndXfo": Xfo(tr=neckEndVec, ori=neckMidOri),
"neckCrvData": self.neckCtrlShape.getCurveData(),
"neckMidCrvData": self.neckMidCtrlShape.getCurveData()
}
self.loadData(self.default_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(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:
#.........这里部分代码省略.........