本文整理汇总了Python中kraken.core.objects.control.Control.alignOnYAxis方法的典型用法代码示例。如果您正苦于以下问题:Python Control.alignOnYAxis方法的具体用法?Python Control.alignOnYAxis怎么用?Python Control.alignOnYAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.objects.control.Control
的用法示例。
在下文中一共展示了Control.alignOnYAxis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HeadComponentRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import alignOnYAxis [as 别名]
class HeadComponentRig(HeadComponent):
"""Head Component Rig"""
def __init__(self, name='head', parent=None):
Profiler.getInstance().push("Construct Head Rig Component:" + name)
super(HeadComponentRig, self).__init__(name, parent)
# =========
# Controls
# =========
# Head
self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape='circle')
self.headCtrl.lockScale(x=True, y=True, z=True)
self.headCtrl.lockTranslation(x=True, y=True, z=True)
self.headCtrlSpace = self.headCtrl.insertCtrlSpace()
self.headCtrl.rotatePoints(0, 0, 90)
self.headCtrl.scalePoints(Vec3(3, 3, 3))
self.headCtrl.translatePoints(Vec3(0, 1, 0.25))
# Eye Left
self.eyeLeftCtrl = Control('eyeLeft', parent=self.ctrlCmpGrp, shape='sphere')
self.eyeLeftCtrl.lockScale(x=True, y=True, z=True)
self.eyeLeftCtrl.lockTranslation(x=True, y=True, z=True)
self.eyeLeftCtrlSpace = self.eyeLeftCtrl.insertCtrlSpace()
self.eyeLeftCtrl.rotatePoints(0, 90, 0)
self.eyeLeftCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
self.eyeLeftCtrl.setColor('blueMedium')
# Eye Right
self.eyeRightCtrl = Control('eyeRight', parent=self.ctrlCmpGrp, shape='sphere')
self.eyeRightCtrl.lockScale(x=True, y=True, z=True)
self.eyeRightCtrl.lockTranslation(x=True, y=True, z=True)
self.eyeRightCtrlSpace = self.eyeRightCtrl.insertCtrlSpace()
self.eyeRightCtrl.rotatePoints(0, 90, 0)
self.eyeRightCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
self.eyeRightCtrl.setColor('blueMedium')
# LookAt Control
self.lookAtCtrl = Control('lookAt', parent=self.ctrlCmpGrp, shape='square')
self.lookAtCtrl.lockScale(x=True, y=True, z=True)
self.lookAtCtrl.rotatePoints(90, 0, 0)
self.lookAtCtrlSpace = self.lookAtCtrl.insertCtrlSpace()
self.eyeLeftBase = Transform('eyeLeftBase', parent=self.headCtrl)
self.eyeRightBase = Transform('eyeRightBase', parent=self.headCtrl)
self.eyeLeftUpV = Transform('eyeLeftUpV', parent=self.headCtrl)
self.eyeRightUpV = Transform('eyeRightUpV', parent=self.headCtrl)
self.eyeLeftAtV = Transform('eyeLeftAtV', parent=self.lookAtCtrl)
self.eyeRightAtV = Transform('eyeRightAtV', parent=self.lookAtCtrl)
# Jaw
self.jawCtrl = Control('jaw', parent=self.headCtrl, shape='cube')
self.jawCtrlSpace = self.jawCtrl.insertCtrlSpace()
self.jawCtrl.lockScale(x=True, y=True, z=True)
self.jawCtrl.lockTranslation(x=True, y=True, z=True)
self.jawCtrl.alignOnYAxis(negative=True)
self.jawCtrl.alignOnZAxis()
self.jawCtrl.scalePoints(Vec3(1.45, 0.65, 1.25))
self.jawCtrl.translatePoints(Vec3(0, -0.25, 0))
self.jawCtrl.setColor('orange')
# ==========
# Deformers
# ==========
deformersLayer = self.getOrCreateLayer('deformers')
self.defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
self.addItem('defCmpGrp', self.defCmpGrp)
headDef = Joint('head', parent=self.defCmpGrp)
headDef.setComponent(self)
jawDef = Joint('jaw', parent=self.defCmpGrp)
jawDef.setComponent(self)
eyeLeftDef = Joint('eyeLeft', parent=self.defCmpGrp)
eyeLeftDef.setComponent(self)
eyeRightDef = Joint('eyeRight', parent=self.defCmpGrp)
eyeRightDef.setComponent(self)
# ==============
# 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)
#.........这里部分代码省略.........
示例2: SpineComponentRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import alignOnYAxis [as 别名]
class SpineComponentRig(SpineComponent):
"""Spine Component"""
def __init__(self, name="spine", parent=None):
Profiler.getInstance().push("Construct Spine Rig Component:" + name)
super(SpineComponentRig, self).__init__(name, parent)
# =========
# Controls
# =========
# COG
self.cogCtrlSpace = CtrlSpace('cog', parent=self.ctrlCmpGrp)
self.cogCtrl = Control('cog', parent=self.cogCtrlSpace, shape="circle")
self.cogCtrl.scalePoints(Vec3(6.0, 6.0, 6.0))
self.cogCtrl.setColor("orange")
self.cogCtrl.lockScale(True, True, True)
# Spine01
self.spine01CtrlSpace = CtrlSpace('spine01', parent=self.cogCtrl)
self.spine01Ctrl = Control('spine01', parent=self.spine01CtrlSpace, shape="circle")
self.spine01Ctrl.scalePoints(Vec3(4.0, 4.0, 4.0))
self.spine01Ctrl.lockScale(True, True, True)
# Spine02
self.spine02CtrlSpace = CtrlSpace('spine02', parent=self.spine01Ctrl)
self.spine02Ctrl = Control('spine02', parent=self.spine02CtrlSpace, shape="circle")
self.spine02Ctrl.scalePoints(Vec3(4.5, 4.5, 4.5))
self.spine02Ctrl.lockScale(True, True, True)
self.spine02Ctrl.setColor("blue")
# Spine04
self.spine04CtrlSpace = CtrlSpace('spine04', parent=self.cogCtrl)
self.spine04Ctrl = Control('spine04', parent=self.spine04CtrlSpace, shape="circle")
self.spine04Ctrl.scalePoints(Vec3(6.0, 6.0, 6.0))
self.spine04Ctrl.lockScale(True, True, True)
# Spine03
self.spine03CtrlSpace = CtrlSpace('spine03', parent=self.spine04Ctrl)
self.spine03Ctrl = Control('spine03', parent=self.spine03CtrlSpace, shape="circle")
self.spine03Ctrl.scalePoints(Vec3(4.5, 4.5, 4.5))
self.spine03Ctrl.lockScale(True, True, True)
self.spine03Ctrl.setColor("blue")
# Pelvis
self.pelvisCtrlSpace = CtrlSpace('pelvis', parent=self.spine01Ctrl)
self.pelvisCtrl = Control('pelvis', parent=self.pelvisCtrlSpace, shape="cube")
self.pelvisCtrl.alignOnYAxis(negative=True)
self.pelvisCtrl.scalePoints(Vec3(4.0, 0.375, 3.75))
self.pelvisCtrl.translatePoints(Vec3(0.0, -0.5, -0.25))
self.pelvisCtrl.lockTranslation(True, True, True)
self.pelvisCtrl.lockScale(True, True, True)
self.pelvisCtrl.setColor("blueLightMuted")
# ==========
# Deformers
# ==========
deformersLayer = self.getOrCreateLayer('deformers')
self.defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
self.addItem('defCmpGrp', self.defCmpGrp)
self.deformerJoints = []
self.spineOutputs = []
self.setNumDeformers(1)
pelvisDef = Joint('pelvis', parent=self.defCmpGrp)
pelvisDef.setComponent(self)
# =====================
# Create Component I/O
# =====================
# Setup component Xfo I/O's
self.spineVertebraeOutput.setTarget(self.spineOutputs)
# ==============
# Constrain I/O
# ==============
# 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']))
#.........这里部分代码省略.........
示例3: FabriceHeadGuide
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import alignOnYAxis [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
#.........这里部分代码省略.........
示例4: HeadComponentRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import alignOnYAxis [as 别名]
class HeadComponentRig(HeadComponent):
"""Head Component Rig"""
def __init__(self, name='head', parent=None):
Profiler.getInstance().push("Construct Head Rig Component:" + name)
super(HeadComponentRig, self).__init__(name, parent)
# =========
# Controls
# =========
# Head
self.headCtrlSpace = CtrlSpace('head', parent=self.ctrlCmpGrp)
self.headCtrl = Control('head', parent=self.headCtrlSpace, shape="circle")
self.headCtrl.rotatePoints(0, 0, 90)
self.headCtrl.scalePoints(Vec3(3, 3, 3))
self.headCtrl.translatePoints(Vec3(0, 1, 0.25))
# Eye Left
self.eyeLeftCtrlSpace = CtrlSpace('eyeLeft', parent=self.headCtrl)
self.eyeLeftCtrl = Control('eyeLeft', parent=self.eyeLeftCtrlSpace, shape="sphere")
self.eyeLeftCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
self.eyeLeftCtrl.setColor("blueMedium")
# Eye Right
self.eyeRightCtrlSpace = CtrlSpace('eyeRight', parent=self.headCtrl)
self.eyeRightCtrl = Control('eyeRight', parent=self.eyeRightCtrlSpace, shape="sphere")
self.eyeRightCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))
self.eyeRightCtrl.setColor("blueMedium")
# Jaw
self.jawCtrlSpace = CtrlSpace('jawCtrlSpace', parent=self.headCtrl)
self.jawCtrl = Control('jaw', parent=self.jawCtrlSpace, shape="cube")
self.jawCtrl.alignOnYAxis(negative=True)
self.jawCtrl.alignOnZAxis()
self.jawCtrl.scalePoints(Vec3(1.45, 0.65, 1.25))
self.jawCtrl.translatePoints(Vec3(0, -0.25, 0))
self.jawCtrl.setColor("orange")
# ==========
# Deformers
# ==========
deformersLayer = self.getOrCreateLayer('deformers')
defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
headDef = Joint('head', parent=defCmpGrp)
headDef.setComponent(self)
jawDef = Joint('jaw', parent=defCmpGrp)
jawDef.setComponent(self)
eyeLeftDef = Joint('eyeLeft', parent=defCmpGrp)
eyeLeftDef.setComponent(self)
eyeRightDef = Joint('eyeRight', parent=defCmpGrp)
eyeRightDef.setComponent(self)
# ==============
# Constrain I/O
# ==============
# Constraint inputs
headInputConstraint = PoseConstraint('_'.join([self.headCtrlSpace.getName(), 'To', self.headBaseInputTgt.getName()]))
headInputConstraint.setMaintainOffset(True)
headInputConstraint.addConstrainer(self.headBaseInputTgt)
self.headCtrlSpace.addConstraint(headInputConstraint)
# # Constraint outputs
headOutputConstraint = PoseConstraint('_'.join([self.headOutputTgt.getName(), 'To', self.headCtrl.getName()]))
headOutputConstraint.addConstrainer(self.headCtrl)
self.headOutputTgt.addConstraint(headOutputConstraint)
jawOutputConstraint = PoseConstraint('_'.join([self.jawOutputTgt.getName(), 'To', self.jawCtrl.getName()]))
jawOutputConstraint.addConstrainer(self.jawCtrl)
self.jawOutputTgt.addConstraint(jawOutputConstraint)
eyeLOutputConstraint = PoseConstraint('_'.join([self.eyeLOutputTgt.getName(), 'To', self.eyeLeftCtrl.getName()]))
eyeLOutputConstraint.addConstrainer(self.eyeLeftCtrl)
self.eyeLOutputTgt.addConstraint(eyeLOutputConstraint)
eyeROutputConstraint = PoseConstraint('_'.join([self.eyeROutputTgt.getName(), 'To', self.eyeRightCtrl.getName()]))
eyeROutputConstraint.addConstrainer(self.eyeRightCtrl)
self.eyeROutputTgt.addConstraint(eyeROutputConstraint)
# ==================
# Add Component I/O
# ==================
# Add Xfo I/O's
# self.addInput(self.headBaseInputTgt)
# self.addOutput(self.headOutputTgt)
# self.addOutput(self.jawOutputTgt)
# self.addOutput(self.eyeLOutputTgt)
# self.addOutput(self.eyeROutputTgt)
# Add Attribute I/O's
# self.addInput(self.drawDebugInputAttr)
#.........这里部分代码省略.........