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.
This commit is contained in:
Joshua Leung 2011-02-16 21:54:41 +00:00
parent 8ead7b327c
commit 2c4fb98522
3 changed files with 27 additions and 10 deletions

@ -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 {

@ -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);
}

@ -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;