Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2022-04-18 23:11:34 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-04-19 00:25:16 +0300
commita0c2d6bf85e1ba38373ac9371fb557086181dda3 (patch)
tree46882699e6f45b3cd1df834e92d96043baf85606 /source/blender/editors
parentbec057a4531dfc2c6986ffdcb6f8723b8a6d3c34 (diff)
Transform: small optimization in snap to edit mesh
In some cases, selected elements do not contribute to snapping. So ignore these elements when creating the edit meshes bound box.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/transform/transform_snap_object.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc
index d0c0d141f15..e5c0a68a0dc 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -178,13 +178,17 @@ static const Mesh *mesh_for_snap(Object *ob_eval, eSnapEditType edit_mode_type,
/**
* Calculate the minimum and maximum coordinates of the box that encompasses this mesh.
*/
-static void bm_mesh_minmax(BMesh *bm, float r_min[3], float r_max[3])
+static void snap_editmesh_minmax(SnapObjectContext *sctx, BMesh *bm, float r_min[3], float r_max[3])
{
INIT_MINMAX(r_min, r_max);
BMIter iter;
BMVert *v;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+ if (sctx->callbacks.edit_mesh.test_vert_fn &&
+ !sctx->callbacks.edit_mesh.test_vert_fn(v, sctx->callbacks.edit_mesh.user_data)) {
+ continue;
+ }
minmax_v3v3_v3(r_min, r_max, v->co);
}
}
@@ -423,7 +427,7 @@ static SnapObjectData *snap_object_data_editmesh_get(SnapObjectContext *sctx,
sod->type = SnapObjectData::Type::EditMesh;
sod->treedata_editmesh.em = em;
sod->mesh_runtime = snap_object_data_editmesh_runtime_get(ob_eval);
- bm_mesh_minmax(em->bm, sod->min, sod->max);
+ snap_editmesh_minmax(sctx, em->bm, sod->min, sod->max);
}
return sod;