Fix #26959: change selection of shapekeys in edit mode causes mesh deformity of a key
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 23 Apr 2011 09:25:34 +0000 (09:25 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 23 Apr 2011 09:25:34 +0000 (09:25 +0000)
Vertex offset, which was used to update referenced keys was calculating between
editmesh (which represents shapekey data) and base mesh (ob->mesh) which represents
Bases key.

This commit fixes bug with incorrect ofsset calculation for case when some keys
got other (not Basis) keys as relative key by calculating offset using EditMesh
(new shapekey data) and keyblock data (which was used to create EditMesh when
entering edit mode).

This commit shouldn't lead to regressions, but maybe there's something else
which should be fixed for such kinda complicated cases -- more testing would
be welcome.

source/blender/editors/mesh/editmesh.c

index 0165b9794cac2907e65deb3141751f9963c703c0..ec08bfccda3fcb0335191d8024dd46edad3889d1 100644 (file)
@@ -1177,13 +1177,14 @@ void load_editMesh(Scene *scene, Object *obedit)
                        }
 
                        if(act_is_basis) { /* active key is a base */
+                               float (*fp)[3]= actkey->data;
                                i=0;
                                ofs= MEM_callocN(sizeof(float) * 3 * em->totvert,  "currkey->data");
                                eve= em->verts.first;
                                mvert = me->mvert;
                                while(eve) {
                                        if(eve->keyindex>=0)
-                                               VECSUB(ofs[i], mvert->co, oldverts[eve->keyindex].co);
+                                               VECSUB(ofs[i], mvert->co, fp[eve->keyindex]);
 
                                        eve= eve->next;
                                        i++;