Commit: 8be9d68dd42d6831675356bfa0e1bf9274680df3
Author: Howard Trickey
Date:   Tue May 16 07:19:01 2017 -0400
Branches: master
https://developer.blender.org/rB8be9d68dd42d6831675356bfa0e1bf9274680df3

Fix T49467: Crash due to assert failure in bevel.

The mesh interpolation code had an edge case where one of two
adjacent edges to a vertex has 0 length. This caused an assert
failure indexing the vertex mesh for splash Blenderman.blend.

===================================================================

M       source/blender/bmesh/tools/bmesh_bevel.c

===================================================================

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index 05169a2a976..a05c12a2730 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -2295,7 +2295,7 @@ static int interp_range(const float *frac, int n, const 
float f, float *r_rest)
 /* Interpolate given vmesh to make one with target nseg border vertices on the 
profiles */
 static VMesh *interp_vmesh(BevelParams *bp, VMesh *vm0, int nseg)
 {
-       int n, ns0, nseg2, odd, i, j, k, j0, k0, k0prev;
+       int n, ns0, nseg2, odd, i, j, k, j0, k0, k0prev, j0inc, k0inc;
        float *prev_frac, *frac, *new_frac, *prev_new_frac;
        float f, restj, restk, restkprev;
        float quad[4][3], co[3], center[3];
@@ -2339,10 +2339,12 @@ static VMesh *interp_vmesh(BevelParams *bp, VMesh *vm0, 
int nseg)
                                        copy_v3_v3(co, mesh_vert_canon(vm0, i, 
j0, k0)->co);
                                }
                                else {
+                                       j0inc = (restj < BEVEL_EPSILON || j0 == 
ns0) ? 0 : 1;
+                                       k0inc = (restk < BEVEL_EPSILON || k0 == 
ns0) ? 0 : 1;
                                        copy_v3_v3(quad[0], 
mesh_vert_canon(vm0, i, j0, k0)->co);
-                                       copy_v3_v3(quad[1], 
mesh_vert_canon(vm0, i, j0, k0 + 1)->co);
-                                       copy_v3_v3(quad[2], 
mesh_vert_canon(vm0, i, j0 + 1, k0 + 1)->co);
-                                       copy_v3_v3(quad[3], 
mesh_vert_canon(vm0, i, j0 + 1, k0)->co);
+                                       copy_v3_v3(quad[1], 
mesh_vert_canon(vm0, i, j0, k0 + k0inc)->co);
+                                       copy_v3_v3(quad[2], 
mesh_vert_canon(vm0, i, j0 + j0inc, k0 + k0inc)->co);
+                                       copy_v3_v3(quad[3], 
mesh_vert_canon(vm0, i, j0 + j0inc, k0)->co);
                                        interp_bilinear_quad_v3(quad, restk, 
restj, co);
                                }
                                copy_v3_v3(mesh_vert(vm1, i, j, k)->co, co);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to