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


Python core.orientConstraint方法代码示例

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


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

示例1: update

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def update(self):
        sel = selected(type='transform')
        if sel:
            obj = sel[0]
        else:
            return

        self.orient.removeAll()
        for obj in orientConstraint(obj, q=True, tl=True):
            self.orient.append(obj)

        self.point.removeAll()
        for obj in pointConstraint(obj, q=True, tl=True):
            self.point.append(obj)

        self.parent.removeAll()
        for obj in parentConstraint(obj, q=True, tl=True):
            self.parent.append(obj) 
开发者ID:patcorwin,项目名称:fossil,代码行数:20,代码来源:constraintTracker.py

示例2: getOrientConstrainee

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def getOrientConstrainee(target): # type: (PyNode) -> PyNode
    '''
    Given a target used in an orientConstraint, find the object that is orient
    constrained to it.
    '''
    try:
        #target.parentMatrix[0].listConnections( type='orientConstraint', d=True )[0].constraintRotateZ.listConnections()[0]

        constraints = target.parentMatrix[0].listConnections( type='orientConstraint', d=True )

        if not constraints:
            return None
        elif len(constraints) == 1:
            return constraints[0].constraintRotateZ.listConnections()[0]
        else:
            raise Exception( '{0} is the target of multiple constraints, too many results'.format( target ) )
    except Exception:
        return None 
开发者ID:patcorwin,项目名称:fossil,代码行数:20,代码来源:constraints.py

示例3: oriCns

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def oriCns(driver, driven, maintainOffset=False):
    """Apply orientation constraint

    Apply orientation constraint changing XYZ  default connexions by
    rotate compound connexions

    Note:
        We have found an evaluation difference in the values if the connexion
        is compound or by axis

    Arguments:
        driver (dagNode or dagNode list): Driver object.
        driven (dagNode): Driven object.
        maintainOffset (bool): Keep the offset.

    Returns:
        pyNode: Orientation constraintn node.

    Example:
        .. code-block:: python

            import mgear.core.applyop as aop
            import pymel.core as pm
            sphere = pm.polySphere(n='sphereDriver')
            cube = pm.polyCube(n='cubeDriven')
            ori_cns = aop.oriCns(sphere[0], cube[0], True)

    """
    oriCns = pm.orientConstraint(driver, driven, maintainOffset=maintainOffset)
    for axis in "XYZ":
        pm.disconnectAttr(oriCns + ".constraintRotate" + axis,
                          driven + ".rotate" + axis)
    pm.connectAttr(oriCns + ".constraintRotate", driven + ".rotate", f=True)

    return oriCns 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:37,代码来源:applyop.py

示例4: unique_spine_zero_controller

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def unique_spine_zero_controller(self):
    # Create Root Costrain Jnt Unde Hip cotrol
        # Duplicate zero Jnt

        tempConst = pm.duplicate(self.joints.zeroJoint, po=True,
                                 name=("Const_" + self.joints.zeroJoint ))
        rootConst_jnt = tempConst[0]

        pm.parent(rootConst_jnt, self.hipCtrl.drawnNode)
        pm.pointConstraint(rootConst_jnt, self.joints.zeroJoint)
        pm.orientConstraint(rootConst_jnt, self.joints.zeroJoint)
        pm.setAttr(rootConst_jnt.visibility, 0)
        self._stuff.append(rootConst_jnt) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:15,代码来源:limb.py

示例5: inputOrient

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def inputOrient(self, target=None, maintainOff=None):
        if target is None and maintainOff is None:
            return self._inputOrient
        else:
            self._inputOrient = pm.orientConstraint(target, self.drawnNode,
                                                    mo=maintainOff) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:8,代码来源:drawNode.py

示例6: outputOrient

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def outputOrient(self, constrained=None, maintainOff=None):
        if constrained is None and maintainOff is None:
            return self._outputOrient
        else:
            self._outputOrient = pm.orientConstraint(constrained,
                                                     self.drawnNode,
                                                     mo=maintainOff) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:9,代码来源:drawNode.py

示例7: _getSwitchPlug

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def _getSwitchPlug(obj):  # WTF IS THIS??
    '''
    Given the object a bind joint is constrained to, return the switching plug.
    '''

    bone = core.constraints.getOrientConstrainee(obj)
    constraint = orientConstraint( bone, q=True )
    
    plugs = orientConstraint(constraint, q=True, wal=True)
    targets = orientConstraint(constraint, q=True, tl=True)
    
    for plug, target in zip(plugs, targets):
        if target == obj:
            switchPlug = plug.listConnections(s=True, d=False, p=True)
            return switchPlug 
开发者ID:patcorwin,项目名称:fossil,代码行数:17,代码来源:kinematicSwitch.py

示例8: orientSerialize

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def orientSerialize(obj): # type: (PyNode) -> Dict
    return _constraintSerialize('orientConstraint', obj) 
开发者ID:patcorwin,项目名称:fossil,代码行数:4,代码来源:constraints.py

示例9: orientDeserialize

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def orientDeserialize(obj, data): # type: (PyNode, Dict) -> None
    kwargs = copy.deepcopy(data)
    targets, reformattedKwargs = _constraintDeserialize(obj, kwargs)
    if 'mo' in reformattedKwargs:
        del reformattedKwargs['mo']
    orientConstraint(targets, obj, mo=True, **reformattedKwargs) 
开发者ID:patcorwin,项目名称:fossil,代码行数:8,代码来源:constraints.py

示例10: orientConst

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def orientConst(*args, **kwargs):
    ''' orientConstraint wrapper that returns the controlling plug '''
    return orientConstraint(*args, **kwargs).getWeightAliasList()[-1] 
开发者ID:patcorwin,项目名称:fossil,代码行数:5,代码来源:constraints.py

示例11: create_ik_setup

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import orientConstraint [as 别名]
def create_ik_setup(self, solver='ikRPsolver', controller_radius=0.5):
        """Creates IK setup
        """
        self.ik_handle, self.ik_end_effector = \
            pm.ikHandle(sj=self.start_joint, ee=self.end_joint, solver=solver)

        self.ik_end_controller, shape = pm.circle(
            normal=(0, 1, 0),
            radius=controller_radius
        )
        pm.parent(self.ik_end_controller, self.ik_end_effector)

        self.ik_end_controller.t.set(0, 0, 0)
        self.ik_end_controller.r.set(0, 0, 0)

        # create default scale attribute
        pm.addAttr(self.ik_end_controller, sn="minScale", at="float", dv=1.0, k=True)
        pm.addAttr(self.ik_end_controller, sn="maxScale", at="float", dv=2.0, k=True)
        for j in self.joints[:-1]:  # do not scale the last joint
            self.ik_end_controller.minScale >> j.sx

        pm.parent(self.ik_end_controller, w=1)
        from anima.env.mayaEnv import auxiliary
        auxiliary.axial_correction_group(self.ik_end_controller)

        # constraint the orientation of the last joint to the controller
        pm.orientConstraint(self.ik_end_controller, self.joints[-1], mo=1)

        # create the point constraint
        pm.pointConstraint(self.ik_end_controller, self.ik_handle)

        # create pole controller
        self.ik_pole_controller = pm.spaceLocator(name='ikPoleController#')
        # place it to the extension of the pole vector
        pm.parent(self.ik_pole_controller, self.joints[1], r=1)
        pm.parent(self.ik_pole_controller, w=1)

        # I don't like this but it will help a lot
        move_amount = [0, -1, 0]
        if pm.xform(self.ik_pole_controller, q=1, ws=1, t=1)[0] < 0:
            move_amount = [0, 1, 0]
        pm.move(self.ik_pole_controller, move_amount, r=1, os=1, wd=1)

        pm.poleVectorConstraint(self.ik_pole_controller, self.ik_handle)
        auxiliary.axial_correction_group(self.ik_pole_controller)

        # group everything under the main_group
        self.main_group = pm.nt.Transform(name='IKLimbJointHierarchy_Grp#')
        pm.parent(self.ik_handle, self.main_group)
        pm.parent(self.ik_end_controller.getParent(), self.main_group)
        pm.parent(self.ik_pole_controller.getParent(), self.main_group)

        if self.do_stretchy:
            self.create_stretch_setup() 
开发者ID:eoyilmaz,项目名称:anima,代码行数:56,代码来源:rigging.py


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