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


Python OpenMaya.MEulerRotation方法代码示例

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


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

示例1: _get_tm_offset

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MEulerRotation [as 别名]
def _get_tm_offset(self, _nParent, _nDriven=None, _type="t"):
        """
        Get the offset between the driven and a driver node
        """
        if _nDriven is None:
            _nDriven = self.nSwConstRecept

        mStart = om.MMatrix()
        mEnd = om.MMatrix()

        wmStart = _nParent.worldMatrix.get().__melobject__()
        wmEnd = _nDriven.worldMatrix.get().__melobject__()

        om.MScriptUtil().createMatrixFromList(wmStart, mStart)
        om.MScriptUtil().createMatrixFromList(wmEnd, mEnd)

        mOut = om.MTransformationMatrix(mEnd * mStart.inverse())

        if _type == "t":
            # Extract Translation
            vTran = om.MVector(mOut.getTranslation(om.MSpace.kTransform))
            vTranPymel = [vTran.x, vTran.y, vTran.z]
            return vTranPymel
        if _type == "r":
            # Extract Rotation
            ro = _nDriven.rotateOrder.get()
            vRot = om.MEulerRotation(mOut.eulerRotation().reorder(ro))
            vRotDeg = [math.degrees(vRot.x), math.degrees(vRot.y), math.degrees(vRot.z)]
            return vRotDeg 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:31,代码来源:sqSpaceSwitcher.py

示例2: rotate_into

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MEulerRotation [as 别名]
def rotate_into(self, direction, rotation):
        """ slerp the given rotation values into the direction given
        by the brush_state
        @param direction MVector: the target direction
        @param rotation MVector: current euler rotation """

        vector_weight = self.brush_state.settings['strength']
        up_vector = om.MVector(0, 1, 0)
        local_up = up_vector.rotateBy(om.MEulerRotation(math.radians(rotation.x),
                                                        math.radians(rotation.y),
                                                        math.radians(rotation.z)))

        target_rotation = om.MQuaternion(local_up, direction, vector_weight)

        util = om.MScriptUtil()
        x_rot = np.radians(rotation.x)
        y_rot = np.radians(rotation.y)
        z_rot = np.radians(rotation.z)
        util.createFromDouble(x_rot, y_rot, z_rot)
        rotation_ptr = util.asDoublePtr()
        mat = om.MTransformationMatrix()
        mat.setRotation(rotation_ptr, om.MTransformationMatrix.kXYZ)

        mat = mat.asMatrix() * target_rotation.asMatrix()
        rotation = om.MTransformationMatrix(mat).rotation()

        return om.MVector(math.degrees(rotation.asEulerRotation().x),
                        math.degrees(rotation.asEulerRotation().y),
                        math.degrees(rotation.asEulerRotation().z)) 
开发者ID:wiremas,项目名称:spore,代码行数:31,代码来源:spore_context.py

示例3: getPointArrayWithOffset

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MEulerRotation [as 别名]
def getPointArrayWithOffset(point_pos, pos_offset=None, rot_offset=None):
    """Get Point array with offset

    Convert a list of vector to a List of float and add the position and
    rotation offset.

    Arguments:
        point_pos (list of vector): Point positions.
        pos_offset (vector):  The position offset of the curve from its
            center.
        rot_offset (vector): The rotation offset of the curve from its
            center. In radians.

    Returns:
        list of vector: the new point positions

    """
    points = []
    for v in point_pos:
        if rot_offset:
            mv = om.MVector(v.x, v.y, v.z)
            mv = mv.rotateBy(om.MEulerRotation(rot_offset.x,
                                               rot_offset.y,
                                               rot_offset.z,
                                               om.MEulerRotation.kXYZ))
            v = datatypes.Vector(mv.x, mv.y, mv.z)
        if pos_offset:
            v = v + pos_offset

        points.append(v)

    return points 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:34,代码来源:icon.py


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