Cleanup: doxy sections, move utility function to editmesh_utils.c

This commit is contained in:
2020-04-07 14:44:13 +10:00
parent 7c4391e6aa
commit a1eb5ec81c
3 changed files with 86 additions and 53 deletions

View File

@@ -52,6 +52,7 @@
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_transform_snap_object_context.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
@@ -1638,3 +1639,48 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name BMesh Vertex Projection API
* \{ */
void EDBM_project_snap_verts(
bContext *C, Depsgraph *depsgraph, ARegion *region, Object *obedit, BMEditMesh *em)
{
Main *bmain = CTX_data_main(C);
BMIter iter;
BMVert *eve;
ED_view3d_init_mats_rv3d(obedit, region->regiondata);
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
bmain, CTX_data_scene(C), 0, region, CTX_wm_view3d(C));
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
float mval[2], co_proj[3];
if (ED_view3d_project_float_object(region, eve->co, mval, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
if (ED_transform_snap_object_project_view3d(snap_context,
depsgraph,
SCE_SNAP_MODE_FACE,
&(const struct SnapObjectParams){
.snap_select = SNAP_NOT_ACTIVE,
.use_object_edit_cage = false,
.use_occlusion_test = true,
},
mval,
NULL,
NULL,
co_proj,
NULL)) {
mul_v3_m4v3(eve->co, obedit->imat, co_proj);
}
}
}
}
ED_transform_snap_object_context_destroy(snap_context);
}
/** \} */