[Bf-blender-cvs] [12788538496] master: Fix T61360: Smooth Weights affects all objects

mano-wii noreply at git.blender.org
Tue Jul 2 01:02:21 CEST 2019


Commit: 12788538496a6c63f876926f27a99cf8b0ad9c97
Author: mano-wii
Date:   Tue Jul 2 08:59:40 2019 +1000
Branches: master
https://developer.blender.org/rB12788538496a6c63f876926f27a99cf8b0ad9c97

Fix T61360: Smooth Weights affects all objects

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

M	source/blender/editors/object/object_vgroup.c

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

diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 678f6f50096..4f61443ac54 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -3278,9 +3278,18 @@ static int vertex_group_smooth_exec(bContext *C, wmOperator *op)
   ViewLayer *view_layer = CTX_data_view_layer(C);
   Object *ob_ctx = ED_object_context(C);
 
-  uint objects_len = 0;
-  Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
-      view_layer, CTX_wm_view3d(C), &objects_len, ob_ctx->mode);
+  uint objects_len;
+  Object **objects;
+  if (ob_ctx->mode == OB_MODE_WEIGHT_PAINT) {
+    /* Until weight paint supports multi-edit, use only the active. */
+    objects_len = 1;
+    objects = &ob_ctx;
+  }
+  else {
+    objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
+        view_layer, CTX_wm_view3d(C), &objects_len, ob_ctx->mode);
+  }
+
   for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
     Object *ob = objects[ob_index];
 
@@ -3296,7 +3305,9 @@ static int vertex_group_smooth_exec(bContext *C, wmOperator *op)
     WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
     WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
   }
-  MEM_freeN(objects);
+  if (objects != &ob_ctx) {
+    MEM_freeN(objects);
+  }
 
   return OPERATOR_FINISHED;
 }



More information about the Bf-blender-cvs mailing list