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


Python Euler.resize_4x4方法代码示例

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


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

示例1: add_object_align_init

# 需要导入模块: from mathutils import Euler [as 别名]
# 或者: from mathutils.Euler import resize_4x4 [as 别名]
def add_object_align_init(context, operator):
    """
    Return a matrix using the operator settings and view context.

    :arg context: The context to use.
    :type context: :class:`bpy.types.Context`
    :arg operator: The operator, checked for location and rotation properties.
    :type operator: :class:`bpy.types.Operator`
    :return: the matrix from the context and settings.
    :rtype: :class:`mathutils.Matrix`
    """

    from mathutils import Matrix, Vector, Euler
    properties = operator.properties if operator is not None else None

    space_data = context.space_data
    if space_data and space_data.type != 'VIEW_3D':
        space_data = None

    # location
    if operator and properties.is_property_set("location"):
        location = Matrix.Translation(Vector(properties.location))
    else:
        location = Matrix.Translation(context.scene.cursor.location)

        if operator:
            properties.location = location.to_translation()

    # rotation
    view_align = (context.preferences.edit.object_align == 'VIEW')
    view_align_force = False
    if operator:
        if properties.is_property_set("view_align"):
            view_align = view_align_force = operator.view_align
        else:
            if properties.is_property_set("rotation"):
                # ugh, 'view_align' callback resets
                value = properties.rotation[:]
                properties.view_align = view_align
                properties.rotation = value
                del value
            else:
                properties.view_align = view_align

    if operator and (properties.is_property_set("rotation") and
                     not view_align_force):

        rotation = Euler(properties.rotation).to_matrix().to_4x4()
    else:
        if view_align and space_data:
            rotation = space_data.region_3d.view_matrix.to_3x3().inverted()
            rotation.resize_4x4()
        else:
            rotation = Matrix()

        # set the operator properties
        if operator:
            properties.rotation = rotation.to_euler()

    return location @ rotation
开发者ID:wangyxuan,项目名称:blender,代码行数:62,代码来源:object_utils.py

示例2: getTransformFromParent

# 需要导入模块: from mathutils import Euler [as 别名]
# 或者: from mathutils.Euler import resize_4x4 [as 别名]
    def getTransformFromParent(self):
        rot = Euler((radians(self.alpha.value), radians(self.beta.value),
                     radians(self.gamma.value)), 'XYZ').to_matrix()
        rot.resize_4x4()

        transl = Matrix.Translation((self.x.value, self.y.value, self.z.value))
        # print("here",transl * rot)
        return transl * rot
开发者ID:HBPNeurorobotics,项目名称:BlenderRobotDesigner,代码行数:10,代码来源:segments.py


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