forked from bartvdbraak/blender
fix [#35858] Weight Paint: Hiding faces isnt flushing the flag to the vertices.
This commit is contained in:
parent
47cfdc4494
commit
a7858767f4
@ -138,18 +138,26 @@ int BKE_mesh_edge_other_vert(const struct MEdge *e, int v);
|
|||||||
|
|
||||||
/* update the hide flag for edges and polys from the corresponding
|
/* update the hide flag for edges and polys from the corresponding
|
||||||
* flag in verts */
|
* flag in verts */
|
||||||
void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert,
|
void BKE_mesh_flush_hidden_from_verts_ex(const struct MVert *mvert,
|
||||||
const struct MLoop *mloop,
|
const struct MLoop *mloop,
|
||||||
struct MEdge *medge, int totedge,
|
struct MEdge *medge, const int totedge,
|
||||||
struct MPoly *mpoly, int totpoly);
|
struct MPoly *mpoly, const int totpoly);
|
||||||
|
void BKE_mesh_flush_hidden_from_verts(struct Mesh *me);
|
||||||
|
|
||||||
|
void BKE_mesh_flush_hidden_from_polys_ex(struct MVert *mvert,
|
||||||
|
const struct MLoop *mloop,
|
||||||
|
struct MEdge *medge, int totedge,
|
||||||
|
const struct MPoly *mpoly, const int totpoly);
|
||||||
|
void BKE_mesh_flush_hidden_from_polys(struct Mesh *me);
|
||||||
|
|
||||||
|
|
||||||
void BKE_mesh_flush_select_from_polys_ex(struct MVert *mvert, const int totvert,
|
void BKE_mesh_flush_select_from_polys_ex(struct MVert *mvert, const int totvert,
|
||||||
struct MLoop *mloop,
|
const struct MLoop *mloop,
|
||||||
struct MEdge *medge, const int totedge,
|
struct MEdge *medge, const int totedge,
|
||||||
const struct MPoly *mpoly, const int totpoly);
|
const struct MPoly *mpoly, const int totpoly);
|
||||||
void BKE_mesh_flush_select_from_polys(struct Mesh *me);
|
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,
|
void BKE_mesh_flush_select_from_verts_ex(const struct MVert *mvert, const int totvert,
|
||||||
struct MLoop *mloop,
|
const struct MLoop *mloop,
|
||||||
struct MEdge *medge, const int totedge,
|
struct MEdge *medge, const int totedge,
|
||||||
struct MPoly *mpoly, const int totpoly);
|
struct MPoly *mpoly, const int totpoly);
|
||||||
void BKE_mesh_flush_select_from_verts(struct Mesh *me);
|
void BKE_mesh_flush_select_from_verts(struct Mesh *me);
|
||||||
|
@ -3437,10 +3437,10 @@ int BKE_mesh_edge_other_vert(const MEdge *e, int v)
|
|||||||
|
|
||||||
/* update the hide flag for edges and faces from the corresponding
|
/* update the hide flag for edges and faces from the corresponding
|
||||||
* flag in verts */
|
* flag in verts */
|
||||||
void BKE_mesh_flush_hidden_from_verts(const MVert *mvert,
|
void BKE_mesh_flush_hidden_from_verts_ex(const MVert *mvert,
|
||||||
const MLoop *mloop,
|
const MLoop *mloop,
|
||||||
MEdge *medge, int totedge,
|
MEdge *medge, const int totedge,
|
||||||
MPoly *mpoly, int totpoly)
|
MPoly *mpoly, const int totpoly)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
@ -3464,12 +3464,59 @@ void BKE_mesh_flush_hidden_from_verts(const MVert *mvert,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void BKE_mesh_flush_hidden_from_verts(Mesh *me)
|
||||||
|
{
|
||||||
|
BKE_mesh_flush_hidden_from_verts_ex(me->mvert, me->mloop,
|
||||||
|
me->medge, me->totedge,
|
||||||
|
me->mpoly, me->totpoly);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BKE_mesh_flush_hidden_from_polys_ex(MVert *mvert,
|
||||||
|
const MLoop *mloop,
|
||||||
|
MEdge *medge, const int UNUSED(totedge),
|
||||||
|
const MPoly *mpoly, const int totpoly)
|
||||||
|
{
|
||||||
|
const MPoly *mp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = totpoly;
|
||||||
|
for (mp = mpoly; i--; mp++) {
|
||||||
|
if (mp->flag & ME_HIDE) {
|
||||||
|
const MLoop *ml;
|
||||||
|
int j;
|
||||||
|
j = mp->totloop;
|
||||||
|
for (ml = &mloop[mp->loopstart]; j--; ml++) {
|
||||||
|
mvert[ml->v].flag |= ME_HIDE;
|
||||||
|
medge[ml->e].flag |= ME_HIDE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i = totpoly;
|
||||||
|
for (mp = mpoly; i--; mp++) {
|
||||||
|
if ((mp->flag & ME_HIDE) == 0) {
|
||||||
|
const MLoop *ml;
|
||||||
|
int j;
|
||||||
|
j = mp->totloop;
|
||||||
|
for (ml = &mloop[mp->loopstart]; j--; ml++) {
|
||||||
|
mvert[ml->v].flag &= ~ME_HIDE;
|
||||||
|
medge[ml->e].flag &= ~ME_HIDE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void BKE_mesh_flush_hidden_from_polys(Mesh *me)
|
||||||
|
{
|
||||||
|
BKE_mesh_flush_hidden_from_polys_ex(me->mvert, me->mloop,
|
||||||
|
me->medge, me->totedge,
|
||||||
|
me->mpoly, me->totpoly);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* simple poly -> vert/edge selection.
|
* simple poly -> vert/edge selection.
|
||||||
*/
|
*/
|
||||||
void BKE_mesh_flush_select_from_polys_ex(MVert *mvert, const int totvert,
|
void BKE_mesh_flush_select_from_polys_ex(MVert *mvert, const int totvert,
|
||||||
MLoop *mloop,
|
const MLoop *mloop,
|
||||||
MEdge *medge, const int totedge,
|
MEdge *medge, const int totedge,
|
||||||
const MPoly *mpoly, const int totpoly)
|
const MPoly *mpoly, const int totpoly)
|
||||||
{
|
{
|
||||||
@ -3493,7 +3540,7 @@ void BKE_mesh_flush_select_from_polys_ex(MVert *mvert, const int totvert,
|
|||||||
/* assume if its selected its not hidden and none of its verts/edges are hidden
|
/* assume if its selected its not hidden and none of its verts/edges are hidden
|
||||||
* (a common assumption)*/
|
* (a common assumption)*/
|
||||||
if (mp->flag & ME_FACE_SEL) {
|
if (mp->flag & ME_FACE_SEL) {
|
||||||
MLoop *ml;
|
const MLoop *ml;
|
||||||
int j;
|
int j;
|
||||||
j = mp->totloop;
|
j = mp->totloop;
|
||||||
for (ml = &mloop[mp->loopstart]; j--; ml++) {
|
for (ml = &mloop[mp->loopstart]; j--; ml++) {
|
||||||
@ -3512,7 +3559,7 @@ void BKE_mesh_flush_select_from_polys(Mesh *me)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(totvert),
|
void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(totvert),
|
||||||
MLoop *mloop,
|
const MLoop *mloop,
|
||||||
MEdge *medge, const int totedge,
|
MEdge *medge, const int totedge,
|
||||||
MPoly *mpoly, const int totpoly)
|
MPoly *mpoly, const int totpoly)
|
||||||
{
|
{
|
||||||
@ -3538,7 +3585,7 @@ void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(to
|
|||||||
for (mp = mpoly; i--; mp++) {
|
for (mp = mpoly; i--; mp++) {
|
||||||
if ((mp->flag & ME_HIDE) == 0) {
|
if ((mp->flag & ME_HIDE) == 0) {
|
||||||
int ok = TRUE;
|
int ok = TRUE;
|
||||||
MLoop *ml;
|
const MLoop *ml;
|
||||||
int j;
|
int j;
|
||||||
j = mp->totloop;
|
j = mp->totloop;
|
||||||
for (ml = &mloop[mp->loopstart]; j--; ml++) {
|
for (ml = &mloop[mp->loopstart]; j--; ml++) {
|
||||||
|
@ -74,6 +74,8 @@ void paintface_flush_flags(Object *ob)
|
|||||||
if (me == NULL)
|
if (me == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* note, call #BKE_mesh_flush_hidden_from_verts_ex first when changing hidden flags */
|
||||||
|
|
||||||
/* we could call this directly in all areas that change selection,
|
/* we could call this directly in all areas that change selection,
|
||||||
* since this could become slow for realtime updates (circle-select for eg) */
|
* since this could become slow for realtime updates (circle-select for eg) */
|
||||||
BKE_mesh_flush_select_from_polys(me);
|
BKE_mesh_flush_select_from_polys(me);
|
||||||
@ -139,18 +141,20 @@ void paintface_hide(Object *ob, const bool unselected)
|
|||||||
a = me->totpoly;
|
a = me->totpoly;
|
||||||
while (a--) {
|
while (a--) {
|
||||||
if ((mpoly->flag & ME_HIDE) == 0) {
|
if ((mpoly->flag & ME_HIDE) == 0) {
|
||||||
if (unselected) {
|
if (((mpoly->flag & ME_FACE_SEL) == 0) == unselected) {
|
||||||
if ((mpoly->flag & ME_FACE_SEL) == 0) mpoly->flag |= ME_HIDE;
|
mpoly->flag |= ME_HIDE;
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ((mpoly->flag & ME_FACE_SEL)) mpoly->flag |= ME_HIDE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mpoly->flag & ME_HIDE) mpoly->flag &= ~ME_FACE_SEL;
|
|
||||||
|
if (mpoly->flag & ME_HIDE) {
|
||||||
|
mpoly->flag &= ~ME_FACE_SEL;
|
||||||
|
}
|
||||||
|
|
||||||
mpoly++;
|
mpoly++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BKE_mesh_flush_hidden_from_polys(me);
|
||||||
|
|
||||||
paintface_flush_flags(ob);
|
paintface_flush_flags(ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,6 +178,8 @@ void paintface_reveal(Object *ob)
|
|||||||
mpoly++;
|
mpoly++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BKE_mesh_flush_hidden_from_polys(me);
|
||||||
|
|
||||||
paintface_flush_flags(ob);
|
paintface_flush_flags(ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,9 +416,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
|
|||||||
/* ensure that edges and faces get hidden as well (not used by
|
/* ensure that edges and faces get hidden as well (not used by
|
||||||
* sculpt but it looks wrong when entering editmode otherwise) */
|
* sculpt but it looks wrong when entering editmode otherwise) */
|
||||||
if (pbvh_type == PBVH_FACES) {
|
if (pbvh_type == PBVH_FACES) {
|
||||||
BKE_mesh_flush_hidden_from_verts(me->mvert, me->mloop,
|
BKE_mesh_flush_hidden_from_verts(me);
|
||||||
me->medge, me->totedge,
|
|
||||||
me->mpoly, me->totpoly);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ED_region_tag_redraw(ar);
|
ED_region_tag_redraw(ar);
|
||||||
|
@ -118,12 +118,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm,
|
|||||||
cddm->getVertArray(cddm),
|
cddm->getVertArray(cddm),
|
||||||
mdisps);
|
mdisps);
|
||||||
|
|
||||||
BKE_mesh_flush_hidden_from_verts(cddm->getVertArray(cddm),
|
BKE_mesh_flush_hidden_from_verts_ex(cddm->getVertArray(cddm),
|
||||||
cddm->getLoopArray(cddm),
|
cddm->getLoopArray(cddm),
|
||||||
cddm->getEdgeArray(cddm),
|
cddm->getEdgeArray(cddm),
|
||||||
cddm->getNumEdges(cddm),
|
cddm->getNumEdges(cddm),
|
||||||
cddm->getPolyArray(cddm),
|
cddm->getPolyArray(cddm),
|
||||||
cddm->getNumPolys(cddm));
|
cddm->getNumPolys(cddm));
|
||||||
}
|
}
|
||||||
if (grid_paint_mask) {
|
if (grid_paint_mask) {
|
||||||
float *paint_mask = CustomData_add_layer(&cddm->vertData,
|
float *paint_mask = CustomData_add_layer(&cddm->vertData,
|
||||||
|
Loading…
Reference in New Issue
Block a user