12 lines
586 B
Python
12 lines
586 B
Python
import bpy, bmesh, os
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
R = os.path.expanduser("~/robo_movel/render")
|
|
bpy.ops.wm.obj_import(filepath=os.path.join(R, "robo_bp.obj"), up_axis="Z", forward_axis="Y")
|
|
objs = [o for o in bpy.context.scene.objects if o.type == "MESH"]
|
|
for o in objs:
|
|
bm = bmesh.new(); bm.from_mesh(o.data)
|
|
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=1e-6)
|
|
bm.to_mesh(o.data); bm.free()
|
|
bpy.data.libraries.write(os.path.join(R, "robo_bp_import.blend"), set(objs), fake_user=True)
|
|
print("ok", len(objs), sum(len(o.data.vertices) for o in objs))
|