From f6dc2d690fbc0c0426d418579fa3d1c26614dfaa Mon Sep 17 00:00:00 2001 From: gsemaj Date: Sat, 9 Sep 2023 11:24:47 -0700 Subject: [PATCH] code to show all selected faces --- .../ExtractTerrainMeshes.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/terrain_mesh_extractor/ExtractTerrainMeshes.py b/terrain_mesh_extractor/ExtractTerrainMeshes.py index cb1658f..f5a9a5e 100644 --- a/terrain_mesh_extractor/ExtractTerrainMeshes.py +++ b/terrain_mesh_extractor/ExtractTerrainMeshes.py @@ -101,15 +101,22 @@ def rip_terrain_mesh(f, outpath, clear=False): outfile = f"{name}.obj" bpy.ops.export_scene.obj(filepath=os.path.join(outpath, outfile)) - # select modified vertices - #bpy.ops.object.mode_set(mode="EDIT") - #bm = bmesh.from_edit_mesh(context.edit_object.data) - #bm.verts.ensure_lookup_table() - #for v in bm.verts: - # v.select = False + bpy.ops.object.mode_set(mode="EDIT") + bm = bmesh.from_edit_mesh(context.edit_object.data) + bm.verts.ensure_lookup_table() + + # deselect all + for v in bm.verts: + v.select = False + for l in v.link_loops: + l.face.select = False + + # select modified vertices + faces #for shift_index in indices: # v = bm.verts[shift_index] # v.select = True + # for l in v.link_loops: + # l.face.select = True if(clear): bpy.ops.object.mode_set(mode="OBJECT")