[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34919] trunk/blender/source/blender: Bugfix [#26106] No instant visual feed back for Dupliframes, parenting
Joshua Leung
aligorith at gmail.com
Wed Feb 16 22:54:43 CET 2011
Revision: 34919
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34919
Author: aligorith
Date: 2011-02-16 21:54:41 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/anim.c
trunk/blender/source/blender/blenkernel/intern/object.c
trunk/blender/source/blender/editors/object/object_add.c
Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c 2011-02-16 20:29:23 UTC (rev 34918)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c 2011-02-16 21:54:41 UTC (rev 34919)
@@ -743,8 +743,8 @@
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 @@
*/
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 @@
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 @@
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 {
Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c 2011-02-16 20:29:23 UTC (rev 34918)
+++ trunk/blender/source/blender/blenkernel/intern/object.c 2011-02-16 21:54:41 UTC (rev 34919)
@@ -1809,12 +1809,17 @@
* 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);
}
Modified: trunk/blender/source/blender/editors/object/object_add.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_add.c 2011-02-16 20:29:23 UTC (rev 34918)
+++ trunk/blender/source/blender/editors/object/object_add.c 2011-02-16 21:54:41 UTC (rev 34919)
@@ -971,8 +971,13 @@
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;
More information about the Bf-blender-cvs
mailing list