diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 31 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 7 |
4 files changed, 47 insertions, 26 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index eb0fc5b103c..320ced67a2f 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -123,15 +123,16 @@ void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert, struct MEdge *medge, int totedge, struct MPoly *mpoly, int totpoly); -void BKE_mesh_flush_select_from_polys(struct MVert *mvert, const int totvert, - struct MLoop *mloop, - struct MEdge *medge, const int totedge, - const struct MPoly *mpoly, const int totpoly); - -void BKE_mesh_flush_select_from_verts(const struct MVert *mvert, const int totvert, - struct MLoop *mloop, - struct MEdge *medge, const int totedge, - struct MPoly *mpoly, const int totpoly); +void BKE_mesh_flush_select_from_polys_ex(struct MVert *mvert, const int totvert, + struct MLoop *mloop, + struct MEdge *medge, const int totedge, + const struct MPoly *mpoly, const int totpoly); +void BKE_mesh_flush_select_from_polys(struct Mesh *me); +void BKE_mesh_flush_select_from_verts_ex(const struct MVert *mvert, const int totvert, + struct MLoop *mloop, + struct MEdge *medge, const int totedge, + struct MPoly *mpoly, const int totpoly); +void BKE_mesh_flush_select_from_verts(struct Mesh *me); void BKE_mesh_unlink(struct Mesh *me); void BKE_mesh_free(struct Mesh *me, int unlink); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index cc6489b68f9..3eb96f218e4 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -3110,10 +3110,10 @@ void BKE_mesh_flush_hidden_from_verts(const MVert *mvert, /** * simple poly -> vert/edge selection. */ -void BKE_mesh_flush_select_from_polys(MVert *mvert, const int totvert, - MLoop *mloop, - MEdge *medge, const int totedge, - const MPoly *mpoly, const int totpoly) +void BKE_mesh_flush_select_from_polys_ex(MVert *mvert, const int totvert, + MLoop *mloop, + MEdge *medge, const int totedge, + const MPoly *mpoly, const int totpoly) { MVert *mv; MEdge *med; @@ -3145,11 +3145,18 @@ void BKE_mesh_flush_select_from_polys(MVert *mvert, const int totvert, } } } +void BKE_mesh_flush_select_from_polys(Mesh *me) +{ + BKE_mesh_flush_select_from_polys_ex(me->mvert, me->totvert, + me->mloop, + me->medge, me->totedge, + me->mpoly, me->totpoly); +} -void BKE_mesh_flush_select_from_verts(const MVert *mvert, const int UNUSED(totvert), - MLoop *mloop, - MEdge *medge, const int totedge, - MPoly *mpoly, const int totpoly) +void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(totvert), + MLoop *mloop, + MEdge *medge, const int totedge, + MPoly *mpoly, const int totpoly) { MEdge *med; MPoly *mp; @@ -3192,6 +3199,14 @@ void BKE_mesh_flush_select_from_verts(const MVert *mvert, const int UNUSED(totve } } } +void BKE_mesh_flush_select_from_verts(Mesh *me) +{ + BKE_mesh_flush_select_from_verts_ex(me->mvert, me->totvert, + me->mloop, + me->medge, me->totedge, + me->mpoly, me->totpoly); +} + /* basic vertex data functions */ int BKE_mesh_minmax(Mesh *me, float r_min[3], float r_max[3]) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 6d84e6a5210..6f79d22b3f2 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2005,6 +2005,13 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ else { mesh_octree_table(NULL, NULL, NULL, 'e'); mesh_mirrtopo_table(NULL, 'e'); + + if (me->editflag & ME_EDIT_VERT_SEL) { + BKE_mesh_flush_select_from_verts(me); + } + else if (me->editflag & ME_EDIT_PAINT_MASK) { + BKE_mesh_flush_select_from_polys(me); + } } WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); @@ -2488,6 +2495,10 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ if (ob->mode & OB_MODE_VERTEX_PAINT) { ob->mode &= ~OB_MODE_VERTEX_PAINT; + + if (me->editflag & ME_EDIT_PAINT_MASK) { + BKE_mesh_flush_select_from_polys(me); + } } else { ob->mode |= OB_MODE_VERTEX_PAINT; @@ -3114,10 +3125,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) /* on init only, convert face -> vert sel */ if (me->editflag & ME_EDIT_PAINT_MASK) { - BKE_mesh_flush_select_from_polys(me->mvert, me->totvert, - me->mloop, - me->medge, me->totedge, - me->mpoly, me->totpoly); + BKE_mesh_flush_select_from_polys(me); } } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index c0294212821..ac24d13706f 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -154,7 +154,7 @@ static void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr) Mesh *me = ptr->data; if ((me->editflag & ME_EDIT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_MASK)) { me->editflag &= ~ME_EDIT_PAINT_MASK; - BKE_mesh_flush_select_from_polys(me->mvert, me->totvert, + BKE_mesh_flush_select_from_polys_ex(me->mvert, me->totvert, me->mloop, me->medge, me->totedge, me->mpoly, me->totpoly); @@ -167,10 +167,7 @@ static void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr) Mesh *me = ptr->data; if ((me->editflag & ME_EDIT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_MASK)) { me->editflag &= ~ME_EDIT_VERT_SEL; - BKE_mesh_flush_select_from_verts(me->mvert, me->totvert, - me->mloop, - me->medge, me->totedge, - me->mpoly, me->totpoly); + BKE_mesh_flush_select_from_verts(me); } rna_Mesh_update_draw(bmain, scene, ptr); } |