[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26543] trunk/blender/source/blender/ editors/mesh/editmesh.c: editing the basis shape now updates others when relative is enabled.
Campbell Barton
ideasman42 at gmail.com
Tue Feb 2 12:10:02 CET 2010
Revision: 26543
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26543
Author: campbellbarton
Date: 2010-02-02 12:10:02 +0100 (Tue, 02 Feb 2010)
Log Message:
-----------
editing the basis shape now updates others when relative is enabled.
Modified Paths:
--------------
trunk/blender/source/blender/editors/mesh/editmesh.c
Modified: trunk/blender/source/blender/editors/mesh/editmesh.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh.c 2010-02-02 06:11:35 UTC (rev 26542)
+++ trunk/blender/source/blender/editors/mesh/editmesh.c 2010-02-02 11:10:02 UTC (rev 26543)
@@ -1195,11 +1195,40 @@
KeyBlock *currkey;
KeyBlock *actkey= BLI_findlink(&me->key->block, em->shapenr-1);
+ float (*ofs)[3] = NULL;
+
+ /* editing the base key should update others */
+ if(me->key->type==KEY_RELATIVE && oldverts) {
+ int act_is_basis = 0;
+ /* find if this key is a basis for any others */
+ for(currkey = me->key->block.first; currkey; currkey= currkey->next) {
+ if(em->shapenr-1 == currkey->relative) {
+ act_is_basis = 1;
+ break;
+ }
+ }
+
+ if(act_is_basis) { /* active key is a base */
+ i=0;
+ ofs= MEM_callocN(sizeof(float) * 3 * em->totvert, "currkey->data");
+ eve= em->verts.first;
+ mvert = me->mvert;
+ while(eve) {
+ VECSUB(ofs[i], mvert->co, oldverts[eve->keyindex].co);
+ eve= eve->next;
+ i++;
+ mvert++;
+ }
+ }
+ }
+
+
/* Lets reorder the key data so that things line up roughly
* with the way things were before editmode */
currkey = me->key->block.first;
while(currkey) {
-
+ int apply_offset = (ofs && (currkey != actkey) && (em->shapenr-1 == currkey->relative));
+
fp= newkey= MEM_callocN(me->key->elemsize*em->totvert, "currkey->data");
oldkey = currkey->data;
@@ -1229,6 +1258,12 @@
else {
VECCOPY(fp, mvert->co);
}
+
+ /* propagate edited basis offsets to other shapes */
+ if(apply_offset) {
+ VECADD(fp, fp, ofs[i]);
+ }
+
fp+= 3;
++i;
++mvert;
@@ -1240,6 +1275,8 @@
currkey= currkey->next;
}
+
+ if(ofs) MEM_freeN(ofs);
}
if(oldverts) MEM_freeN(oldverts);
More information about the Bf-blender-cvs
mailing list