forked from bartvdbraak/blender
flush selection from vertex paint and weight paint modes when exiting, this isnt fool-proof, will need more work.
This commit is contained in:
parent
df6b0af04a
commit
4c5093ad48
@ -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);
|
||||
|
@ -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])
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user