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


Python io_utils.axis_conversion方法代码示例

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


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

示例1: execute

# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def execute(self, context):
        keywords = self.as_keywords(ignore=('filter_glob',))
        mesh = load(self, context, **keywords)
        if not mesh:
            return {'CANCELLED'}

        scene = bpy.context.scene
        obj = bpy.data.objects.new(mesh.name, mesh)
        scene.objects.link(obj)
        scene.objects.active = obj
        obj.select = True
        obj.matrix_world = axis_conversion(from_forward='-Z', from_up='Y').to_4x4()
        scene.update()
        return {'FINISHED'} 
开发者ID:Mrmaxmeier,项目名称:BombSquad-Community-Mod-Manager,代码行数:16,代码来源:bob_plugin.py

示例2: savecob

# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def savecob(operator, context, filepath, triangulate, check_existing):
    print("exporting", filepath)
    global_matrix = axis_conversion(to_forward='-Z', to_up='Y').to_4x4()
    scene = context.scene
    obj = scene.objects.active
    mesh = obj.to_mesh(scene, True, 'PREVIEW')
    mesh.transform(global_matrix * obj.matrix_world)  # inverse transformation

    if triangulate or any([len(face.vertices) != 3 for face in mesh.tessfaces]):
        print("triangulating...")
        with to_bmesh(mesh, save=True) as bm:
            bmesh.ops.triangulate(bm, faces=bm.faces)
        mesh.update(calc_edges=True, calc_tessface=True)

    with open(os.fsencode(filepath), 'wb') as file:

        def writestruct(s, *args):
            file.write(struct.pack(s, *args))

        writestruct('I', COB_FILE_ID)
        writestruct('I', len(mesh.vertices))
        writestruct('I', len(mesh.tessfaces))

        for i, vert in enumerate(mesh.vertices):
            writestruct('fff', *vert.co)

        for face in mesh.tessfaces:
            assert len(face.vertices) == 3
            for vertid in face.vertices:
                writestruct('I', vertid)

        for face in mesh.tessfaces:
            writestruct('fff', *face.normal)

    return {'FINISHED'} 
开发者ID:Mrmaxmeier,项目名称:BombSquad-Community-Mod-Manager,代码行数:37,代码来源:bob_plugin.py

示例3: execute

# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def execute(self, context):
        keywords = self.as_keywords(ignore=("axis_forward",
                                            "axis_up",
                                            "filter_glob"))

        global_matrix = axis_conversion(from_forward=self.axis_forward,
                                        from_up=self.axis_up,
                                        ).to_4x4()
        keywords["global_matrix"] = global_matrix

        print(keywords)
        importCSV(**keywords)
        return {'FINISHED'} 
开发者ID:sbobovyc,项目名称:GameTools,代码行数:15,代码来源:import_pix.py

示例4: __getitem__

# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def __getitem__(self, key): # makes all attributes available for parameter substitution
        if not type(key) is str or key.startswith('_'):
            raise KeyError(key)
        try:
            value = getattr(self, key)
            if value is None or type(value) is _FUNCTION_TYPE:
                raise KeyError(key)
            return value
        except AttributeError:
            raise KeyError(key)

# FWD = 'Z'
# UP = 'Y'
# MATRIX_NORMAL = axis_conversion(to_forward=FWD, to_up=UP).to_4x4()
# MATRIX_SCALE_DOWN = Matrix.Scale(0.2, 4) * MATRIX_NORMAL 
开发者ID:harag-on-steam,项目名称:se-blender,代码行数:17,代码来源:export.py


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