Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Sun, 27 Aug 2017 06:35:51 +0000 (16:35 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 27 Aug 2017 06:35:51 +0000 (16:35 +1000)
1  2 
source/blender/bmesh/intern/bmesh_mesh_conv.c
tests/gtests/blenlib/CMakeLists.txt

index 025377b04aa26e0d6d7617bd4f00fba8a4e99932,7787d704b59d0614c5edad1cfd1a2257818eca7c..6cc1f37db439d337fad170085620cd9713320106
@@@ -199,17 -243,10 +207,10 @@@ void BM_mesh_bm_from_me
        BMEdge *e, **etable = NULL;
        BMFace *f, **ftable = NULL;
        float (*keyco)[3] = NULL;
-       int totloops, i, j;
-       /* free custom data */
-       /* this isnt needed in most cases but do just incase */
-       CustomData_free(&bm->vdata, bm->totvert);
-       CustomData_free(&bm->edata, bm->totedge);
-       CustomData_free(&bm->ldata, bm->totloop);
-       CustomData_free(&bm->pdata, bm->totface);
 -      int totuv, totloops, i;
++      int totloops, i;
  
        if (!me || !me->totvert) {
-               if (me) { /*no verts? still copy customdata layout*/
+               if (me && is_new) { /*no verts? still copy customdata layout*/
                        CustomData_copy(&me->vdata, &bm->vdata, CD_MASK_BMESH, CD_ASSIGN, 0);
                        CustomData_copy(&me->edata, &bm->edata, CD_MASK_BMESH, CD_ASSIGN, 0);
                        CustomData_copy(&me->ldata, &bm->ldata, CD_MASK_BMESH, CD_ASSIGN, 0);
                return; /* sanity check */
        }
  
-       vtable = MEM_mallocN(sizeof(BMVert **) * me->totvert, __func__);
+       if (is_new) {
+               CustomData_copy(&me->vdata, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
+               CustomData_copy(&me->edata, &bm->edata, CD_MASK_BMESH, CD_CALLOC, 0);
+               CustomData_copy(&me->ldata, &bm->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
+               CustomData_copy(&me->pdata, &bm->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
 -
 -              /* make sure uv layer names are consisten */
 -              totuv = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
 -              for (i = 0; i < totuv; i++) {
 -                      int li = CustomData_get_layer_index_n(&bm->pdata, CD_MTEXPOLY, i);
 -                      CustomData_set_layer_name(&bm->ldata, CD_MLOOPUV, i, bm->pdata.layers[li].name);
 -              }
+       }
  
-       CustomData_copy(&me->vdata, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
-       CustomData_copy(&me->edata, &bm->edata, CD_MASK_BMESH, CD_CALLOC, 0);
-       CustomData_copy(&me->ldata, &bm->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
-       CustomData_copy(&me->pdata, &bm->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
+       /* -------------------------------------------------------------------- */
+       /* Shape Key */
+       int tot_shape_keys = me->key ? BLI_listbase_count(&me->key->block) : 0;
+       if (is_new == false) {
+               tot_shape_keys = min_ii(tot_shape_keys, CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY));
+       }
+       const float (**shape_key_table)[3] = tot_shape_keys ? BLI_array_alloca(shape_key_table, tot_shape_keys) : NULL;
  
        if ((params->active_shapekey != 0) && (me->key != NULL)) {
                actkey = BLI_findlink(&me->key->block, params->active_shapekey - 1);
index 21b1d173e76511c5c3f2a181c2fa5503d651b275,ffdb8d08d314bb3a94ec5c87bb729045d07aade2..e64bcf821deb6dfb3b486e52b7f680b5f1b14da2
@@@ -37,22 -42,19 +42,20 @@@ endif(
  
  BLENDER_TEST(BLI_array_store "bf_blenlib")
  BLENDER_TEST(BLI_array_utils "bf_blenlib")
- BLENDER_TEST(BLI_kdopbvh "bf_blenlib;bf_intern_eigen")
- BLENDER_TEST(BLI_stack "bf_blenlib")
- BLENDER_TEST(BLI_math_color "bf_blenlib")
- BLENDER_TEST(BLI_math_geom "bf_blenlib;bf_intern_eigen")
+ BLENDER_TEST(BLI_ghash "bf_blenlib")
+ BLENDER_TEST(BLI_hash_mm2a "bf_blenlib")
+ BLENDER_TEST(BLI_kdopbvh "bf_blenlib")
+ BLENDER_TEST(BLI_listbase "bf_blenlib")
  BLENDER_TEST(BLI_math_base "bf_blenlib")
+ BLENDER_TEST(BLI_math_color "bf_blenlib")
+ BLENDER_TEST(BLI_math_geom "bf_blenlib")
 +BLENDER_TEST(BLI_memiter "bf_blenlib")
+ BLENDER_TEST(BLI_path_util "${BLI_path_util_extra_libs}")
+ BLENDER_TEST(BLI_polyfill2d "bf_blenlib")
+ BLENDER_TEST(BLI_stack "bf_blenlib")
  BLENDER_TEST(BLI_string "bf_blenlib")
  BLENDER_TEST(BLI_string_utf8 "bf_blenlib")
- if(WIN32)
-       BLENDER_TEST(BLI_path_util "bf_blenlib;bf_intern_utfconv;extern_wcwidth;${ZLIB_LIBRARIES}")
- else()
-       BLENDER_TEST(BLI_path_util "bf_blenlib;extern_wcwidth;${ZLIB_LIBRARIES}")
- endif()
- BLENDER_TEST(BLI_polyfill2d "bf_blenlib;bf_intern_eigen")
- BLENDER_TEST(BLI_listbase "bf_blenlib")
- BLENDER_TEST(BLI_hash_mm2a "bf_blenlib")
- BLENDER_TEST(BLI_ghash "bf_blenlib")
  
  BLENDER_TEST_PERFORMANCE(BLI_ghash_performance "bf_blenlib")
+ unset(BLI_path_util_extra_libs)