29 lines
849 B
Python
29 lines
849 B
Python
|
|
import bpy
|
||
|
|
import bmesh
|
||
|
|
|
||
|
|
bpy.ops.wm.open_mainfile(filepath="characters/female/lena_nude/hires_work/01_imported.blend")
|
||
|
|
obj = bpy.context.selected_objects[0]
|
||
|
|
print(f"Working on {obj.name}")
|
||
|
|
|
||
|
|
mesh = obj.data
|
||
|
|
bpy.context.view_layer.objects.active = obj
|
||
|
|
bpy.ops.object.mode_set(mode="EDIT")
|
||
|
|
bpy.ops.mesh.select_all(action="DESELECT")
|
||
|
|
|
||
|
|
bm = bmesh.from_edit_mesh(mesh)
|
||
|
|
bm.edges.ensure_lookup_table()
|
||
|
|
for e in bm.edges:
|
||
|
|
if e.is_boundary:
|
||
|
|
e.select = True
|
||
|
|
|
||
|
|
print(f"Selected {len([e for e in bm.edges if e.select])} boundary edges")
|
||
|
|
|
||
|
|
bpy.ops.mesh.remove_doubles(threshold=0.001)
|
||
|
|
|
||
|
|
bpy.ops.object.mode_set(mode="OBJECT")
|
||
|
|
print("Welding complete.")
|
||
|
|
|
||
|
|
bpy.context.preferences.filepaths.save_version = 0 # no .blend1 autosave
|
||
|
|
bpy.ops.wm.save_as_mainfile(filepath="characters/female/lena_nude/hires_work/02_welded.blend")
|
||
|
|
print("Saved 02_welded.blend")
|