Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-10-11 22:39:28 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-10-15 20:37:56 +0300
commit750e4e1158bb1bd40c1724e24693cb22c6910f86 (patch)
tree2dba0b0a7f5ef818809ce05944d2d627fb1a9f8d /source/blender/blenkernel/intern/subdiv_ccg.c
parent6fe3521481b26ad6b6411b0863dfcd4ac2a81132 (diff)
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
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_ccg.c')
-rw-r--r--source/blender/blenkernel/intern/subdiv_ccg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c
index 0997b42a19f..a59f9e0c633 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg.c
@@ -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;
}
}