本文整理汇总了Python中kraken.core.objects.control.Control.lockRotation方法的典型用法代码示例。如果您正苦于以下问题:Python Control.lockRotation方法的具体用法?Python Control.lockRotation怎么用?Python Control.lockRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.objects.control.Control
的用法示例。
在下文中一共展示了Control.lockRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TentacleComponentRig
# 需要导入模块: from kraken.core.objects.control import Control [as 别名]
# 或者: from kraken.core.objects.control.Control import lockRotation [as 别名]
class TentacleComponentRig(TentacleComponent):
"""Insect Leg Rig"""
def __init__(self, name='Tentacle', parent=None):
Profiler.getInstance().push("Construct Tentacle Rig Component:" + name)
super(TentacleComponentRig, self).__init__(name, parent)
# =========
# Controls
# =========
# Chain Base
self.chainBase = Locator('ChainBase', parent=self.ctrlCmpGrp)
self.chainBase.setShapeVisibility(False)
# FK
self.fkCtrlSpaces = []
self.fkCtrls = []
self.setNumControls(2)
# IK Control
self.tentacleIKCtrlSpace = CtrlSpace('IK', parent=self.ctrlCmpGrp)
self.tentacleIKCtrl = Control('IK', parent=self.tentacleIKCtrlSpace, shape="sphere")
self.tentacleIKCtrl.scalePoints(Vec3(0.25, 0.25, 0.25))
self.tentacleIKCtrl.lockScale(x=True, y=True, z=True)
self.tentacleIKCtrl.lockRotation(x=True, y=True, z=True)
# Add Component Params to IK control
tentacleSettingsAttrGrp = AttributeGroup("DisplayInfo_LegSettings", parent=self.tentacleIKCtrl)
tentacledrawDebugInputAttr = BoolAttribute('drawDebug', value=False, parent=tentacleSettingsAttrGrp)
fkikInputAttr = ScalarAttribute('fkik', value=0.0, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
waveLength_YInputAttr = ScalarAttribute('waveLength_Y', value=1.0, minValue=0.0, maxValue=5.0, parent=tentacleSettingsAttrGrp)
waveAmplitude_YInputAttr = ScalarAttribute('waveAmplitude_Y', value=0.0, minValue=-3.0, maxValue=3.0, parent=tentacleSettingsAttrGrp)
waveFrequency_YInputAttr = ScalarAttribute('waveFrequency_Y', value=2.0, minValue=0.0, maxValue=10.0, parent=tentacleSettingsAttrGrp)
waveLength_ZInputAttr = ScalarAttribute('waveLength_Z', value=2.329, minValue=0.0, maxValue=5.0, parent=tentacleSettingsAttrGrp)
waveAmplitude_ZInputAttr = ScalarAttribute('waveAmplitude_Z', value=0.0, minValue=-3.0, maxValue=3.0, parent=tentacleSettingsAttrGrp)
waveFrequency_ZInputAttr = ScalarAttribute('waveFrequency_Z', value=3.354, minValue=0.0, maxValue=10.0, parent=tentacleSettingsAttrGrp)
tipBiasInputAttr = ScalarAttribute('tipBias', value=1.0, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
springStrengthInputAttr = ScalarAttribute('springStrength', value=0.3, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
dampeningInputAttr = ScalarAttribute('dampening', value=0.03, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
simulationWeightInputAttr = ScalarAttribute('simulationWeight', value=1.0, minValue=0.0, maxValue=1.0, parent=tentacleSettingsAttrGrp)
softLimitBoundsInputAttr = ScalarAttribute('softLimitBounds', value=5.0, minValue=0.0, maxValue=10.0, parent=tentacleSettingsAttrGrp)
# Connect IO to controls
self.drawDebugInputAttr.connect(tentacledrawDebugInputAttr)
# ==========
# Deformers
# ==========
deformersLayer = self.getOrCreateLayer('deformers')
self.defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
self.deformerJoints = []
self.boneOutputsTgt = []
self.setNumDeformers(4)
# =====================
# Create Component I/O
# =====================
# Set IO Targets
self.boneOutputs.setTarget(self.boneOutputsTgt)
# ==============
# Constrain I/O
# ==============
# Constraint inputs
tentacleRootInputConstraint = PoseConstraint('_'.join([self.fkCtrlSpaces[0].getName(), 'To', self.rootInputTgt.getName()]))
tentacleRootInputConstraint.setMaintainOffset(True)
tentacleRootInputConstraint.addConstrainer(self.rootInputTgt)
self.fkCtrlSpaces[0].addConstraint(tentacleRootInputConstraint)
tentacleRootInputConstraint = PoseConstraint('_'.join([self.tentacleIKCtrlSpace.getName(), 'To', self.rootInputTgt.getName()]))
tentacleRootInputConstraint.setMaintainOffset(True)
tentacleRootInputConstraint.addConstrainer(self.rootInputTgt)
self.tentacleIKCtrlSpace.addConstraint(tentacleRootInputConstraint)
chainBaseInputConstraint = PoseConstraint('_'.join([self.chainBase.getName(), 'To', self.rootInputTgt.getName()]))
chainBaseInputConstraint.setMaintainOffset(True)
chainBaseInputConstraint.addConstrainer(self.rootInputTgt)
self.chainBase.addConstraint(chainBaseInputConstraint)
# ===============
# Add Splice Ops
# ===============
# Add Splice Op
self.tentacleSolverKLOp = KLOperator('tentacleKLOp', 'TentacleSolver', 'Kraken')
self.addOperator(self.tentacleSolverKLOp)
# # Add Att Inputs
self.tentacleSolverKLOp.setInput('drawDebug', self.drawDebugInputAttr)
self.tentacleSolverKLOp.setInput('rigScale', self.rigScaleInputAttr)
self.tentacleSolverKLOp.setInput('ikblend', fkikInputAttr)
self.tentacleSolverKLOp.setInput('waveLength_Y', waveLength_YInputAttr)
self.tentacleSolverKLOp.setInput('waveAmplitude_Y', waveAmplitude_YInputAttr)
self.tentacleSolverKLOp.setInput('waveFrequency_Y', waveFrequency_YInputAttr)
#.........这里部分代码省略.........