Fix assert calculating tangents with no faces
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 Jun 2017 10:59:49 +0000 (20:59 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 28 Jun 2017 21:57:23 +0000 (07:57 +1000)
source/blender/blenkernel/intern/editmesh_tangent.c
source/blender/blenkernel/intern/mesh_tangent.c

index b04fc753f7a08e64ec71400bbe10c7cea8196666..ee13a887a5f5eb73979b22b171c2d1981ad9fc1e 100644 (file)
@@ -336,7 +336,7 @@ void BKE_editmesh_loop_tangent_calc(
                }
 #endif
                /* Calculation */
-               {
+               if (em->tottri != 0) {
                        TaskScheduler *scheduler = BLI_task_scheduler_get();
                        TaskPool *task_pool;
                        task_pool = BLI_task_pool_create(scheduler, NULL);
@@ -396,6 +396,9 @@ void BKE_editmesh_loop_tangent_calc(
                        BLI_task_pool_work_and_wait(task_pool);
                        BLI_task_pool_free(task_pool);
                }
+               else {
+                       tangent_mask_curr = tangent_mask;
+               }
 #ifdef USE_LOOPTRI_DETECT_QUADS
                if (face_as_quad_map) {
                        MEM_freeN(face_as_quad_map);
index b9d1025d7b1e3ea5e93f58fc914a6cec0c9e79c7..669b59bca058b991a565374faf9389f84f140aba 100644 (file)
@@ -602,7 +602,7 @@ void BKE_mesh_calc_loop_tangent_ex(
 #endif
 
                /* Calculation */
-               {
+               if (looptri_len != 0) {
                        TaskScheduler *scheduler = BLI_task_scheduler_get();
                        TaskPool *task_pool;
                        task_pool = BLI_task_pool_create(scheduler, NULL);
@@ -653,6 +653,9 @@ void BKE_mesh_calc_loop_tangent_ex(
                        BLI_task_pool_work_and_wait(task_pool);
                        BLI_task_pool_free(task_pool);
                }
+               else {
+                       tangent_mask_curr = tangent_mask;
+               }
 #ifdef USE_LOOPTRI_DETECT_QUADS
                if (face_as_quad_map) {
                        MEM_freeN(face_as_quad_map);