[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50727] trunk/blender/source/blender/ editors/mesh/meshtools.c: fix [#31569] Shapekey w/ Driver - Shapekey Influences Disappears After Going to Edit Mode

Campbell Barton ideasman42 at gmail.com
Tue Sep 18 16:29:01 CEST 2012


Revision: 50727
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50727
Author:   campbellbarton
Date:     2012-09-18 14:29:01 +0000 (Tue, 18 Sep 2012)
Log Message:
-----------
fix [#31569] Shapekey w/ Driver - Shapekey Influences Disappears After Going to Edit Mode

joining meshes would allow shape key UID's not to be unique.
This was caused by join adding new key blocks inline, now use add_keyblock() like everywhere else does.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/meshtools.c

Modified: trunk/blender/source/blender/editors/mesh/meshtools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/meshtools.c	2012-09-18 14:17:10 UTC (rev 50726)
+++ trunk/blender/source/blender/editors/mesh/meshtools.c	2012-09-18 14:29:01 UTC (rev 50727)
@@ -104,7 +104,7 @@
 	MLoop *mloop = NULL;
 	Key *key, *nkey = NULL;
 	KeyBlock *kb, *okb, *kbn;
-	float imat[4][4], cmat[4][4], *fp1, *fp2, curpos;
+	float imat[4][4], cmat[4][4], *fp1, *fp2;
 	int a, b, totcol, totmat = 0, totedge = 0, totvert = 0, ok = 0;
 	int totloop = 0, totpoly = 0, vertofs, *matmap = NULL;
 	int i, j, index, haskey = 0, edgeofs, loopofs, polyofs;
@@ -246,26 +246,21 @@
 					for (kb = me->key->block.first; kb; kb = kb->next) {
 						/* if key doesn't exist in destination mesh, add it */
 						if (key_get_named_keyblock(key, kb->name) == NULL) {
-							/* copy this existing one over to the new shapekey block */
-							kbn = MEM_dupallocN(kb);
-							kbn->prev = kbn->next = NULL;
+							kbn = add_keyblock(key, kb->name);
 							
+							/* copy most settings */
+							kbn->pos        = kb->pos;
+							kbn->curval     = kb->curval;
+							kbn->type       = kb->type;
+							kbn->relative   = kb->relative;
+							BLI_strncpy(kbn->vgroup, kb->vgroup, sizeof(kbn->vgroup));
+							kbn->slidermin  = kb->slidermin;
+							kbn->slidermax  = kb->slidermax;
+
 							/* adjust settings to fit (allocate a new data-array) */
 							kbn->data = MEM_callocN(sizeof(float) * 3 * totvert, "joined_shapekey");
-							kbn->totelem = totvert;
-							kbn->weights = NULL;
-							
-							okb = key->block.last;
-							curpos = (okb) ? okb->pos : -0.1f;
-							if (key->type == KEY_RELATIVE)
-								kbn->pos = curpos + 0.1f;
-							else
-								kbn->pos = curpos;
-							
-							BLI_addtail(&key->block, kbn);
-							key->totkey++;
-							if (key->totkey == 1) key->refkey = kbn;
-							
+							kbn->totelem = totvert;	
+		
 							/* XXX 2.5 Animato */
 #if 0
 							/* also, copy corresponding ipo-curve to ipo-block if applicable */




More information about the Bf-blender-cvs mailing list