Lattice modifier: take comparison out of loop
authorSybren A. Stüvel <sybren@stuvel.eu>
Wed, 2 May 2018 11:51:31 +0000 (13:51 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Wed, 2 May 2018 11:51:31 +0000 (13:51 +0200)
source/blender/blenkernel/intern/lattice.c

index 6039826909b9f2446ff68558de3fd1cd22b96249..609c4b95dab0183a5a620d253bdec9aab6d27da1 100644 (file)
@@ -885,12 +885,9 @@ void lattice_deform_verts(Object *laOb, Object *target, Mesh *mesh,
                float weight;
 
                if (defgrp_index >= 0 && (me->dvert || mesh)) {
                float weight;
 
                if (defgrp_index >= 0 && (me->dvert || mesh)) {
-                       MDeformVert *dvert = me->dvert;
+                       MDeformVert *dvert = mesh ? mesh->dvert : me->dvert;
                        
                        for (a = 0; a < numVerts; a++, dvert++) {
                        
                        for (a = 0; a < numVerts; a++, dvert++) {
-                               /* TODO(sybren): take out of the loop and move to above assignment of dvert */
-                               if (mesh) dvert = mesh->dvert + a;
-
                                weight = defvert_find_weight(dvert, defgrp_index);
 
                                if (weight > 0.0f)
                                weight = defvert_find_weight(dvert, defgrp_index);
 
                                if (weight > 0.0f)