Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Sat, 16 Jun 2018 16:02:50 +0000 (18:02 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Sat, 16 Jun 2018 16:02:50 +0000 (18:02 +0200)
1  2 
source/blender/blenkernel/intern/deform.c

index d4ff9bd5c0c36ee8089406b6c0213a431fca3f33,f33f17019b3d78554f9ec14cc13b7a2f8108f153..2da157d5b88db7a17146d01f5b02c248b3b71c86
@@@ -54,7 -54,6 +54,7 @@@
  #include "BKE_customdata.h"
  #include "BKE_data_transfer.h"
  #include "BKE_deform.h"  /* own include */
 +#include "BKE_mesh.h"
  #include "BKE_mesh_mapping.h"
  #include "BKE_object_deform.h"
  
@@@ -74,8 -73,6 +74,8 @@@ bDeformGroup *BKE_defgroup_new(Object *
        BLI_addtail(&ob->defbase, defgroup);
        defgroup_unique_name(defgroup, ob);
  
 +      BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
 +
        return defgroup;
  }
  
@@@ -1192,7 -1189,12 +1192,12 @@@ bool data_transfer_layersmapping_vgroup
  
                if (fromlayers >= 0) {
                        idx_src = fromlayers;
-                       BLI_assert(idx_src < BLI_listbase_count(&ob_src->defbase));
+                       if (idx_src >= BLI_listbase_count(&ob_src->defbase)) {
+                               /* This can happen when vgroups are removed from source object...
+                                * Remapping would be really tricky here, we'd need to go over all objects in Main everytime we delete
+                                * a vgroup... for now, simpler and safer to abort. */
+                               return false;
+                       }
                }
                else if ((idx_src = ob_src->actdef - 1) == -1) {
                        return false;