Page MenuHome

Normalize All weights with lock Active bug.
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 660/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 416.94

Blender Version
Broken: version: 2.81 (sub 1), branch: master, commit date: 2019-08-08 20:54, hash: rB4c9fe657458f
Worked: (optional)

Short description of error
When using: Weights -> Normalize All, with Lock active option, the active group is not locked correctly - on one vert weight is increased.

Exact steps for others to reproduce the error
1)Use: Weights -> Normalize All, with Lock active option on selected mesh vertices.

  1. all weights on current group verices should have stayed the same, but center right ver weight is increased.

Related Objects

Event Timeline

Not sure if it's a bug.
For a vertex to be normalized, the sum of all weights must be 1.0
But in this case, the vertex that changed the weight is only set in the active group (it is not seen in the other group).
So for the sum to be 1.0, the only place where the weight can change is in the active group.

So I believe this works as designed.

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.Dec 27 2019, 2:48 PM

Analyzing the code this really seems to have been a mistake from the original coder.
The orinal coder put a magic number 0 as the number indicating which vertex group to lock.

This fixes the problem:

diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index a964cab3fa5..79dcdd15bf7 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -345,7 +345,7 @@ void defvert_normalize_lock_single(MDeformVert *dvert,
   else if (dvert->totweight == 1) {
     MDeformWeight *dw = dvert->dw;
     if ((dw->def_nr < vgroup_tot) && vgroup_subset[dw->def_nr]) {
-      if (def_nr_lock != 0) {
+      if (def_nr_lock != dw->def_nr) {
         dw->weight = 1.0f;
       }
     }

I will tag the animation team as this is an area often used by them.

Sybren A. Stüvel (sybren) changed the subtype of this task from "Report" to "Bug".