Smooth Vertex Weights operator affects ALL objects that are in weight paint mode(even deselected ones) #61360

Closed
opened 2019-02-09 17:51:44 +01:00 by Demeter Dzadik · 12 comments
Member

smooth_vertex_weights_bug.webm

Blender Version
Broken: 2.80, 02581a7ef8, 2019-02-08

Short description of error
If you leave object A in weight paint mode by making object B the active object, then you enter weight paint mode on object B and use Smooth Vertex Groups operator, the operator will also affect object A.

Exact steps for others to reproduce the error
In attached blend:

  • execute the Smooth Vertex Weights operator
  • increase number of iterations to better see the issue
  • notice how the deselected objects' weights are getting smoothed. (Those objects are in weight paint mode)
    smooth_vertex_weights_bug.blend

Other weight operators may be affected. I tried the Clean Vertex Groups operator, it didn't seem to be affected.

[smooth_vertex_weights_bug.webm](https://archive.blender.org/developer/F6560923/smooth_vertex_weights_bug.webm) **Blender Version** Broken: 2.80, 02581a7ef819, 2019-02-08 **Short description of error** If you leave object A in weight paint mode by making object B the active object, then you enter weight paint mode on object B and use Smooth Vertex Groups operator, the operator will also affect object A. **Exact steps for others to reproduce the error** In attached blend: - execute the Smooth Vertex Weights operator - increase number of iterations to better see the issue - notice how the deselected objects' weights are getting smoothed. (Those objects are in weight paint mode) [smooth_vertex_weights_bug.blend](https://archive.blender.org/developer/F6560911/smooth_vertex_weights_bug.blend) Other weight operators may be affected. I tried the Clean Vertex Groups operator, it didn't seem to be affected.
Author
Member

Added subscriber: @Mets

Added subscriber: @Mets
Campbell Barton was assigned by Sebastian Parborg 2019-02-09 18:01:53 +01:00

This issue was referenced by a8134647c9

This issue was referenced by a8134647c9a99252b123c16f3eeb8b3cef62e646

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @capnm

Added subscriber: @capnm

@ideasman42 afaict a8134647c9 is unrelated and doesn't fix this issue.

@ideasman42 afaict a8134647c9 is unrelated and doesn't fix this issue.
Author
Member

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'
Author
Member

I agree, I can still reproduce this in today's build.

I agree, I can still reproduce this in today's build.

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Strange, all meshes are in the weight paint mode, but with the exception of the active object, there is no visual indication of in what mode the other meshes are.

Indicating that other objects are in weight paint can be implemented.
But an easier solution would be to change the operator to run only on the active object in that case:

diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 678f6f50096..883fe5e4668 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);
+  bool free_object_array = false;
+  uint objects_len = 1;
+  Object **objects;
+  if (ob_ctx->mode == OB_MODE_EDIT) {
+    free_object_array = true;
+    objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
+        view_layer, CTX_wm_view3d(C), &objects_len, ob_ctx->mode);
+  }
+  else {
+    objects = &ob_ctx;
+  }
+
   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 (free_object_array) {
+    MEM_freeN(objects);
+  }
 
   return OPERATOR_FINISHED;
 }

Strange, all meshes are in the weight paint mode, but with the exception of the active object, there is no visual indication of in what mode the other meshes are. Indicating that other objects are in weight paint can be implemented. But an easier solution would be to change the operator to run only on the active object in that case: ``` diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 678f6f50096..883fe5e4668 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); + bool free_object_array = false; + uint objects_len = 1; + Object **objects; + if (ob_ctx->mode == OB_MODE_EDIT) { + free_object_array = true; + objects = BKE_view_layer_array_from_objects_in_mode_unique_data( + view_layer, CTX_wm_view3d(C), &objects_len, ob_ctx->mode); + } + else { + objects = &ob_ctx; + } + 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 (free_object_array) { + MEM_freeN(objects); + } return OPERATOR_FINISHED; } ```
Author
Member

I think the fact that non-active objects in weight paint mode don't show the weight paint overlay is normal. Remember, the other objects in this scenario are not selected, so I wouldn't expect them to have the weight paint overlay. Even if they were selected, multi-object weight paint mode isn't a thing right now afaik(although it would be a welcome feature!), so I would still only expect the active object to have the weight paint overlay. This aspect is working as intended in my opinion.

I'm glad the easier solution is the one you describe, since that would make sense to me. After all, what other operator works on objects that are not even selected? So I think that's the main problem here, that it looks as though the Smooth Vertex Weights operator just checks the scene for any object that happens to be in weight paint mode, and operates on it, which probably goes against all kinds of Blender design philosophies.

I think the fact that non-active objects in weight paint mode don't show the weight paint overlay is normal. Remember, the other objects in this scenario are not selected, so I wouldn't expect them to have the weight paint overlay. Even if they were selected, multi-object weight paint mode isn't a thing right now afaik(although it would be a welcome feature!), so I would still only expect the active object to have the weight paint overlay. This aspect is working as intended in my opinion. I'm glad the easier solution is the one you describe, since that would make sense to me. After all, what other operator works on objects that are not even selected? So I think that's the main problem here, that it looks as though the Smooth Vertex Weights operator just checks the scene for any object that happens to be in weight paint mode, and operates on it, which probably goes against all kinds of Blender design philosophies.

This issue was referenced by 1278853849

This issue was referenced by 12788538496a6c63f876926f27a99cf8b0ad9c97

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#61360
No description provided.