Fix Multires edge adjacency info returning wrong vertex indices
ME_POLY_LOOP_NEXT and ME_POLY_LOOP_PREV expect the offset of the loop in the poly as an argument, in other words, corner index of the poly. This was violated in some places. It didn't cause issues when base mesh consists of only quads due to the way how modulus worked inside of the macro. However, if mesh had non-quad faces adjacency information was returning wrong vertex indices. This was causing multiple brushes to work erratically, including brushes like Face Set, Boundary automasking, mesh relax, and others. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9173
This commit is contained in:
parent
6fe3521481
commit
750e4e1158
|
@ -1878,12 +1878,14 @@ static void adjacet_vertices_index_from_adjacent_edge(const SubdivCCG *subdiv_cc
|
|||
const int poly_index = BKE_subdiv_ccg_grid_to_face_index(subdiv_ccg, coord->grid_index);
|
||||
const MPoly *p = &mpoly[poly_index];
|
||||
*r_v1 = mloop[coord->grid_index].v;
|
||||
|
||||
const int corner = poly_find_loop_from_vert(p, &mloop[p->loopstart], *r_v1);
|
||||
if (coord->x == grid_size_1) {
|
||||
const MLoop *next = ME_POLY_LOOP_NEXT(mloop, p, coord->grid_index);
|
||||
const MLoop *next = ME_POLY_LOOP_NEXT(mloop, p, corner);
|
||||
*r_v2 = next->v;
|
||||
}
|
||||
if (coord->y == grid_size_1) {
|
||||
const MLoop *prev = ME_POLY_LOOP_PREV(mloop, p, coord->grid_index);
|
||||
const MLoop *prev = ME_POLY_LOOP_PREV(mloop, p, corner);
|
||||
*r_v2 = prev->v;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue