diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-23 07:04:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-23 07:04:19 +0400 |
commit | 4612bbf7dbe739795678688cb3814c1f5bbc38b1 (patch) | |
tree | b5797865a8dc4ef7c0ea26c64c30e9699efeeb58 /source/blender/editors/space_view3d/view3d_iterators.c | |
parent | 45681464e7d0ce2b040b4f835a3a40c78d55b7ae (diff) |
add zbuf/depth option to weight paint lasso select.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_iterators.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_iterators.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index a0b36e57d69..81e890c37ee 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -27,6 +27,7 @@ #include "DNA_curve_types.h" #include "DNA_lattice_types.h" #include "DNA_meta_types.h" +#include "DNA_mesh_types.h" #include "DNA_armature_types.h" #include "DNA_object_types.h" @@ -47,6 +48,12 @@ #include "ED_object.h" #include "ED_view3d.h" +typedef struct foreachScreenObjectVert_userData { + void (*func)(void *userData, MVert *mv, const float screen_co_b[2], int index); + void *userData; + ViewContext vc; + eV3DProjTest clip_flag; +} foreachScreenObjectVert_userData; typedef struct foreachScreenVert_userData { void (*func)(void *userData, BMVert *eve, const float screen_co_b[2], int index); @@ -79,6 +86,46 @@ typedef struct foreachScreenFace_userData { /* ------------------------------------------------------------------------ */ + +static void meshobject_foreachScreenVert__mapFunc(void *userData, int index, const float co[3], + const float UNUSED(no_f[3]), const short UNUSED(no_s[3])) +{ + foreachScreenObjectVert_userData *data = userData; + struct MVert *mv = &((Mesh *)(data->vc.obact->data))->mvert[index]; + + if (!(mv->flag & ME_HIDE)) { + float screen_co[2]; + + if (ED_view3d_project_float_object(data->vc.ar, co, screen_co, data->clip_flag) != V3D_PROJ_RET_OK) { + return; + } + + data->func(data->userData, mv, screen_co, index); + } +} + +void meshobject_foreachScreenVert( + ViewContext *vc, + void (*func)(void *userData, MVert *eve, const float screen_co[2], int index), + void *userData, eV3DProjTest clip_flag) +{ + foreachScreenObjectVert_userData data; + DerivedMesh *dm = mesh_get_derived_deform(vc->scene, vc->obact, CD_MASK_BAREMESH); + + data.vc = *vc; + data.func = func; + data.userData = userData; + data.clip_flag = clip_flag; + + if (clip_flag & V3D_PROJ_TEST_CLIP_BB) { + ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */ + } + + dm->foreachMappedVert(dm, meshobject_foreachScreenVert__mapFunc, &data); + + dm->release(dm); +} + static void mesh_foreachScreenVert__mapFunc(void *userData, int index, const float co[3], const float UNUSED(no_f[3]), const short UNUSED(no_s[3])) { |