當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。