首页 > 解决方案 > 如何在 Blender 中将对象的每个断裂导出到单独的 .obj 文件中?

问题描述

我有一个被分成很多块的物体。我想将此对象的每一部分导出到一个.obj文件中。

标签: blender

解决方案


我通过在 Blender 中创建一个 python 脚本自己解决了这个问题。

import bpy
import os
#  show current path
print(">>>>",os.getcwd())
# find all objects whose name starting with "Group"
frag_objs = [obj for obj in bpy.data.objects if obj.name.startswith("Group")]
# Export all objects seperatly
bpy.ops.object.select_all(action='DESELECT')
for obj in frag_objs:
    frg = bpy.context.scene.objects[obj.name]
    frg.select=True
    bpy.ops.export_scene.obj(filepath="group/"+obj.name+".obj",use_selection=True)
    frg.select=False

推荐阅读