diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-03 10:47:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-03 10:47:44 +0400 |
commit | d8d24bdebd4544825c57e86a47bf796fe8ead64b (patch) | |
tree | f4b5d790e7cf31c581be0b3be29b7f712cf0ba3a /source/blender/blenkernel | |
parent | df3e2448871990fb96d6e2149d672e6a6ce43a92 (diff) |
fix [#33682] Animation not updated when the active shape index isnt set
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_key.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 15 |
4 files changed, 19 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index d7d75b4c4c9..a159cbb13d4 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -59,7 +59,7 @@ void key_curve_position_weights(float t, float data[4], int type); void key_curve_tangent_weights(float t, float data[4], int type); void key_curve_normal_weights(float t, float data[4], int type); -float *do_ob_key(struct Scene *scene, struct Object *ob); +float *BKE_key_evaluate_object(struct Scene *scene, struct Object *ob, int *r_totelem); struct Key *BKE_key_from_object(struct Object *ob); struct KeyBlock *BKE_keyblock_from_object(struct Object *ob); diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 5fff8a51214..71e9daaee6b 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -799,7 +799,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl required_mode |= eModifierMode_Editmode; if (cu->editnurb == NULL) { - keyVerts = do_ob_key(scene, ob); + keyVerts = BKE_key_evaluate_object(scene, ob, &numVerts); if (keyVerts) { /* split coords from key data, the latter also includes @@ -808,7 +808,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl * shape key modifier yet. */ deformedVerts = BKE_curve_keyVertexCos_get(cu, nurb, keyVerts); originalVerts = MEM_dupallocN(deformedVerts); - numVerts = BKE_nurbList_verts_count(nurb); + BLI_assert(BKE_nurbList_verts_count(nurb) == numVerts); } } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index ad95f09826a..ccc57a24540 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1300,13 +1300,13 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int } /* returns key coordinates (+ tilt) when key applied, NULL otherwise */ -float *do_ob_key(Scene *scene, Object *ob) +float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem) { Key *key = BKE_key_from_object(ob); KeyBlock *actkb = BKE_keyblock_from_object(ob); char *out; int tot = 0, size = 0; - + if (key == NULL || key->block.first == NULL) return NULL; @@ -1344,7 +1344,7 @@ float *do_ob_key(Scene *scene, Object *ob) return NULL; /* allocate array */ - out = MEM_callocN(size, "do_ob_key out"); + out = MEM_callocN(size, "BKE_key_evaluate_object out"); /* prevent python from screwing this up? anyhoo, the from pointer could be dropped */ key->from = (ID *)ob->data; @@ -1383,6 +1383,9 @@ float *do_ob_key(Scene *scene, Object *ob) else if (ob->type == OB_SURF) do_curve_key(scene, ob, key, out, tot); } + if (r_totelem) { + *r_totelem = tot; + } return (float *)out; } @@ -1732,7 +1735,7 @@ void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me) } /************************* vert coords ************************/ -float (*BKE_key_convert_to_vertcos(Object * ob, KeyBlock * kb))[3] +float (*BKE_key_convert_to_vertcos(Object *ob, KeyBlock *kb))[3] { float (*vertCos)[3], *co; float *fp = kb->data; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 976818fe2df..b2371da0c3c 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2981,12 +2981,13 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int } else { /* copy from current values */ - float *data = do_ob_key(scene, ob); + int totelem; + float *data = BKE_key_evaluate_object(scene, ob, &totelem); /* create new block with prepared data */ kb = BKE_keyblock_add_ctime(key, name, FALSE); kb->data = data; - kb->totelem = me->totvert; + kb->totelem = totelem; } return kb; @@ -3018,11 +3019,12 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int } else { /* copy from current values */ - float *data = do_ob_key(scene, ob); + int totelem; + float *data = BKE_key_evaluate_object(scene, ob, &totelem); /* create new block with prepared data */ kb = BKE_keyblock_add_ctime(key, name, FALSE); - kb->totelem = lt->pntsu * lt->pntsv * lt->pntsw; + kb->totelem = totelem; kb->data = data; } @@ -3057,11 +3059,12 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int } else { /* copy from current values */ - float *data = do_ob_key(scene, ob); + int totelem; + float *data = BKE_key_evaluate_object(scene, ob, &totelem); /* create new block with prepared data */ kb = BKE_keyblock_add_ctime(key, name, FALSE); - kb->totelem = BKE_nurbList_verts_count(lb); + kb->totelem = totelem; kb->data = data; } |