Missed last commit
authorCampbell Barton <ideasman42@gmail.com>
Sat, 26 Aug 2017 17:48:18 +0000 (03:48 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 26 Aug 2017 17:51:25 +0000 (03:51 +1000)
source/blender/bmesh/intern/bmesh_mesh_conv.c

index 2edc043cb131a38f3c0c48e550cf332e8c5b5974..7787d704b59d0614c5edad1cfd1a2257818eca7c 100644 (file)
@@ -219,6 +219,11 @@ static BMFace *bm_face_create_from_mpoly(
 
 /**
  * \brief Mesh -> BMesh
+ * \param bm: The mesh to write into, while this is typically a newly created BMesh,
+ * merging into existing data is supported.
+ * Note the custom-data layout isn't used.
+ * If more comprehensive merging is needed we should move this into a separate function
+ * since this should be kept fast for edit-mode switching and storing undo steps.
  *
  * \warning This function doesn't calculate face normals.
  */
@@ -240,8 +245,6 @@ void BM_mesh_bm_from_me(
        float (*keyco)[3] = NULL;
        int totuv, totloops, i;
 
-       /* free custom data */
-
        if (!me || !me->totvert) {
                if (me && is_new) { /*no verts? still copy customdata layout*/
                        CustomData_copy(&me->vdata, &bm->vdata, CD_MASK_BMESH, CD_ASSIGN, 0);
@@ -293,18 +296,20 @@ void BM_mesh_bm_from_me(
        }
 
        if (tot_shape_keys) {
-               /* check if we need to generate unique ids for the shapekeys.
-                * this also exists in the file reading code, but is here for
-                * a sanity check */
-               if (!me->key->uidgen) {
-                       fprintf(stderr,
-                               "%s had to generate shape key uid's in a situation we shouldn't need to! "
-                               "(bmesh internal error)\n",
-                               __func__);
-
-                       me->key->uidgen = 1;
-                       for (block = me->key->block.first; block; block = block->next) {
-                               block->uid = me->key->uidgen++;
+               if (is_new) {
+                       /* check if we need to generate unique ids for the shapekeys.
+                        * this also exists in the file reading code, but is here for
+                        * a sanity check */
+                       if (!me->key->uidgen) {
+                               fprintf(stderr,
+                                       "%s had to generate shape key uid's in a situation we shouldn't need to! "
+                                       "(bmesh internal error)\n",
+                                       __func__);
+
+                               me->key->uidgen = 1;
+                               for (block = me->key->block.first; block; block = block->next) {
+                                       block->uid = me->key->uidgen++;
+                               }
                        }
                }