本文整理汇总了Python中kraken.core.objects.constraints.pose_constraint.PoseConstraint.setConstrainee方法的典型用法代码示例。如果您正苦于以下问题:Python PoseConstraint.setConstrainee方法的具体用法?Python PoseConstraint.setConstrainee怎么用?Python PoseConstraint.setConstrainee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.objects.constraints.pose_constraint.PoseConstraint
的用法示例。
在下文中一共展示了PoseConstraint.setConstrainee方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildXfoConnection
# 需要导入模块: from kraken.core.objects.constraints.pose_constraint import PoseConstraint [as 别名]
# 或者: from kraken.core.objects.constraints.pose_constraint.PoseConstraint import setConstrainee [as 别名]
def buildXfoConnection(self, kConnection):
"""Builds the connection between the xfo and the connection.
Arguments:
kConnection -- Object, kraken connection to build.
Return:
True if successful.
"""
source = kConnection.getSource()
target = kConnection.getTarget()
if source is None or target is None:
raise Exception("Component connection '" + kConnection.getName() + "'is invalid! Missing Source or Target!")
constraint = PoseConstraint('_'.join([target.getName(), 'To', source.getName()]))
constraint.setMaintainOffset(True)
constraint.setConstrainee(target)
constraint.addConstrainer(source)
dccSceneItem = self.buildPoseConstraint(constraint)
self._registerSceneItemPair(kConnection, dccSceneItem)
return None
示例2: buildXfoConnection
# 需要导入模块: from kraken.core.objects.constraints.pose_constraint import PoseConstraint [as 别名]
# 或者: from kraken.core.objects.constraints.pose_constraint.PoseConstraint import setConstrainee [as 别名]
def buildXfoConnection(self, componentInput):
"""Builds the constraint between the target and connection target.
Args:
componentInput (object): kraken component input to build connections for.
Returns:
bool: True if successful.
"""
if componentInput.isConnected() is False:
return False
connection = componentInput.getConnection()
connectionTarget = connection.getTarget()
inputTarget = componentInput.getTarget()
if connection.getDataType().endswith('[]'):
if componentInput.getIndex() > len(connection.getTarget()) - 1:
inputParent = componentInput.getParent()
inputParentDecoration = inputParent.getNameDecoration()
fullInputName = inputParent.getName() + inputParentDecoration + "." + componentInput.getName()
raise Exception(fullInputName + " index ("
+ str(componentInput.getIndex()) + ") is out of range ("
+ str(len(connection.getTarget()) - 1) + ")!")
connectionTarget = connection.getTarget()[componentInput.getIndex()]
else:
connectionTarget = connection.getTarget()
constraint = PoseConstraint('_'.join([inputTarget.getName(), 'To', connectionTarget.getName()]))
constraint.setMaintainOffset(True)
constraint.setConstrainee(inputTarget)
constraint.addConstrainer(connectionTarget)
dccSceneItem = self.buildPoseConstraint(constraint)
self._registerSceneItemPair(componentInput, dccSceneItem)
return True
示例3: Locator
# 需要导入模块: from kraken.core.objects.constraints.pose_constraint import PoseConstraint [as 别名]
# 或者: from kraken.core.objects.constraints.pose_constraint.PoseConstraint import setConstrainee [as 别名]
from kraken import plugins
from kraken.core.objects.locator import Locator
from kraken.core.objects.constraints.pose_constraint import PoseConstraint
from kraken.core.traverser.traverser import Traverser
locA = Locator("locatorA")
locB = Locator("locatorB")
constraint = PoseConstraint("A to B")
constraint.addConstrainer(locB)
constraint.setConstrainee(locA)
trav = Traverser()
trav.addRootItem(locA)
def callback(**args):
item = args.get('item', None)
print 'Visited '+item.getDecoratedPath()
trav.traverse(itemCallback = callback)