当前位置: 首页>>代码示例>>Python>>正文


Python PoseConstraint.setConstrainer方法代码示例

本文整理汇总了Python中kraken.core.objects.constraints.pose_constraint.PoseConstraint.setConstrainer方法的典型用法代码示例。如果您正苦于以下问题:Python PoseConstraint.setConstrainer方法的具体用法?Python PoseConstraint.setConstrainer怎么用?Python PoseConstraint.setConstrainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kraken.core.objects.constraints.pose_constraint.PoseConstraint的用法示例。


在下文中一共展示了PoseConstraint.setConstrainer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: FabriceTailRig

# 需要导入模块: from kraken.core.objects.constraints.pose_constraint import PoseConstraint [as 别名]
# 或者: from kraken.core.objects.constraints.pose_constraint.PoseConstraint import setConstrainer [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()
开发者ID:Leopardob,项目名称:Kraken,代码行数:104,代码来源:fabrice_tail.py

示例2: SpineComponentRig

# 需要导入模块: from kraken.core.objects.constraints.pose_constraint import PoseConstraint [as 别名]
# 或者: from kraken.core.objects.constraints.pose_constraint.PoseConstraint import setConstrainer [as 别名]

#.........这里部分代码省略.........
        self.addOperator(self.pelvisDefKLOp)

        # Add Att Inputs
        self.pelvisDefKLOp.setInput('drawDebug', self.drawDebugInputAttr)
        self.pelvisDefKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        self.pelvisDefKLOp.setInput('constrainer', self.pelvisOutputTgt)

        # Add Xfo Outputs
        self.pelvisDefKLOp.setOutput('constrainee', pelvisDef)


        Profiler.getInstance().pop()


    def setNumDeformers(self, numDeformers):

        # Add new deformers and outputs
        for i in xrange(len(self.spineOutputs), numDeformers):
            name = 'spine' + str(i + 1).zfill(2)
            spineOutput = ComponentOutput(name, parent=self.outputHrcGrp)
            self.spineOutputs.append(spineOutput)

        for i in xrange(len(self.deformerJoints), numDeformers):
            name = 'spine' + str(i + 1).zfill(2)
            spineDef = Joint(name, parent=self.defCmpGrp)
            spineDef.setComponent(self)
            self.deformerJoints.append(spineDef)

        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(SpineComponentRig, self).loadData( data )

        cogPosition = data['cogPosition']
        spine01Position = data['spine01Position']
        spine02Position = data['spine02Position']
        spine03Position = data['spine03Position']
        spine04Position = data['spine04Position']
        numDeformers = data['numDeformers']

        self.cogCtrlSpace.xfo.tr = cogPosition
        self.cogCtrl.xfo.tr = cogPosition

        self.pelvisCtrlSpace.xfo.tr = cogPosition
        self.pelvisCtrl.xfo.tr = cogPosition

        self.spine01CtrlSpace.xfo.tr = spine01Position
        self.spine01Ctrl.xfo.tr = spine01Position

        self.spine02CtrlSpace.xfo.tr = spine02Position
        self.spine02Ctrl.xfo.tr = spine02Position

        self.spine03CtrlSpace.xfo.tr = spine03Position
        self.spine03Ctrl.xfo.tr = spine03Position

        self.spine04CtrlSpace.xfo.tr = spine04Position
        self.spine04Ctrl.xfo.tr = spine04Position

        length = spine01Position.distanceTo(spine02Position) + spine02Position.distanceTo(spine03Position) + spine03Position.distanceTo(spine04Position)
        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.spineEndOutputConstraint.setConstrainer(self.spineOutputs[-1], index=0)

        # ============
        # Set IO Xfos
        # ============

        # ====================
        # Evaluate Splice Ops
        # ====================
        # evaluate the spine op so that all the output transforms are updated.
        self.bezierSpineKLOp.evaluate()

        # evaluate the constraint op so that all the joint transforms are updated.
        self.deformersToOutputsKLOp.evaluate()
        self.pelvisDefKLOp.evaluate()

        # evaluate the constraints to ensure the outputs are now in the correct location.
        self.spineCogOutputConstraint.evaluate()
        self.spineBaseOutputConstraint.evaluate()
        self.pelvisOutputConstraint.evaluate()
        self.spineEndOutputConstraint.evaluate()
开发者ID:AbedSHP,项目名称:Kraken,代码行数:104,代码来源:spine_component.py


注:本文中的kraken.core.objects.constraints.pose_constraint.PoseConstraint.setConstrainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。