diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-02-17 00:54:41 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-02-17 00:54:41 +0300 |
commit | 2c4fb98522d152c7ec8e973a72bdbacff95158a3 (patch) | |
tree | faa3e82ab51842c950eed22df0e5f0c1b8ccd473 /source/blender/blenkernel | |
parent | 8ead7b327ce7c05be8e12a6dd0a663b00ba8ad16 (diff) |
Bugfix [#26106] No instant visual feed back for Dupliframes, parenting
problem and crash
- It turns out we still need the "copyob" still, if for nothing other
than making sure that the unkeyed transforms can get restored. This
was removed originally as I thought that just reevaluating the
animation would work.
- Removed a buggy line of logic that was causing crashes when there
was no animation data. It's better to just assume that if animation
data exists, that something exists there.
- Make Duplicates Real was not clearing data such as the new animation
data or constraints.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 9 |
2 files changed, 20 insertions, 8 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); } |