Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-18 18:29:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-18 18:29:01 +0400
commit6d76f140d08ebd2a990989768d1b34127b2a3b8a (patch)
treec828f169629cdf2adc160ec719c8fdfefb49b8fd /source/blender
parent2e3d044cd98b3b510a6baf0ab5cd1b0ee2f235e8 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/mesh/meshtools.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index aa09572b2a7..6694371d6ae 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -104,7 +104,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
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 @@ int join_mesh_exec(bContext *C, wmOperator *op)
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 */