diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 9 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 9 |
3 files changed, 27 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 875132d2776..08d506f94b8 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -743,8 +743,8 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, int animated) { extern int enable_cu_speed; /* object.c */ + Object copyob = {{NULL}}; int cfrao = scene->r.cfra; - float omat[4][4]; /* simple prevention of too deep nested groups */ if (level > MAX_DUPLI_RECUR) return; @@ -754,11 +754,13 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, */ if (ob->parent==NULL && ob->constraints.first==NULL && ob->adt==NULL) return; - if (ob->adt->action==NULL && ob->adt->nla_tracks.first==NULL && ob->adt->drivers.first==NULL) - return; - /* make a copy of the object's original transform matrix */ - copy_m4_m4(omat, ob->obmat); + /* make a copy of the object's original data (before any dupli-data overwrites it) + * as we'll need this to keep track of unkeyed data + * - this doesn't take into account other data that can be reached from the object, + * for example it's shapekeys or bones, hence the need for an update flush at the end + */ + copyob = *ob; /* duplicate over the required range */ if (ob->transflag & OB_DUPLINOSPEED) enable_cu_speed= 0; @@ -786,7 +788,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, where_is_object_time(scene, ob, (float)scene->r.cfra); dob= new_dupli_object(lb, ob, ob->obmat, ob->lay, scene->r.cfra, OB_DUPLIFRAMES, animated); - copy_m4_m4(dob->omat, omat); + copy_m4_m4(dob->omat, copyob.obmat); } } @@ -799,6 +801,11 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, BKE_animsys_evaluate_animdata(&ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */ where_is_object_time(scene, ob, (float)scene->r.cfra); + + /* but, to make sure unkeyed object transforms are still sane, + * let's copy object's original data back over + */ + *ob = copyob; } typedef struct vertexDupliData { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 06f641fb28a..21a53d5365a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1809,12 +1809,17 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) * we divide the curvetime calculated in the previous step by the length of the path, to get a time * factor, which then gets clamped to lie within 0.0 - 1.0 range */ - ctime= cu->ctime / cu->pathlen; + if (IS_EQ(cu->pathlen, 0.0f) == 0) + ctime= cu->ctime / cu->pathlen; + else + ctime= cu->ctime; + CLAMP(ctime, 0.0, 1.0); } else { ctime= scene->r.cfra - give_timeoffset(ob); - ctime /= cu->pathlen; + if (IS_EQ(cu->pathlen, 0.0f) == 0) + ctime /= cu->pathlen; CLAMP(ctime, 0.0, 1.0); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 08a31923cda..99ba139a2d8 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -971,8 +971,13 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) basen->lay= base->lay; BLI_addhead(&scene->base, basen); /* addhead: othwise eternal loop */ basen->object= ob; - ob->ipo= NULL; /* make sure apply works */ - ob->parent= ob->track= NULL; + + /* make sure apply works */ + BKE_free_animdata(ob->adt); + ob->adt = NULL; + + ob->parent= NULL; + ob->constraints.first= ob->constraints.last= NULL; ob->disp.first= ob->disp.last= NULL; ob->transflag &= ~OB_DUPLI; ob->lay= base->lay; |