[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24207] trunk/blender/source/blender/ editors/transform: Object PET works with autokey.

Martin Poirier theeth at yahoo.com
Sun Nov 1 03:52:40 CET 2009


Revision: 24207
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24207
Author:   theeth
Date:     2009-11-01 03:52:38 +0100 (Sun, 01 Nov 2009)

Log Message:
-----------
Object PET works with autokey.

Reordering some function calls in transform cleanup to make it simpler (that means other fixes are possible too, sequencer probably don't need it's own freeing function anymore).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c
    trunk/blender/source/blender/editors/transform/transform_generics.c

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2009-11-01 01:11:15 UTC (rev 24206)
+++ trunk/blender/source/blender/editors/transform/transform.c	2009-11-01 02:52:38 UTC (rev 24207)
@@ -1012,11 +1012,12 @@
 		VECCOPY(vec, t->con.center);
 	}
 
-	postTrans(t);
 
 	/* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */
 	special_aftertrans_update(t);
 
+	postTrans(t);
+
 	MEM_freeN(t);
 
 	return success;
@@ -1573,12 +1574,12 @@
 			exit_code = OPERATOR_FINISHED;
 		}
 
+		/* aftertrans does insert keyframes, and clears base flags, doesnt read transdata */
+		special_aftertrans_update(t);
+
 		/* free data */
 		postTrans(t);
 
-		/* aftertrans does insert keyframes, and clears base flags, doesnt read transdata */
-		special_aftertrans_update(t);
-
 		/* send events out for redraws */
 		viewRedrawPost(t);
 

Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c	2009-11-01 01:11:15 UTC (rev 24206)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c	2009-11-01 02:52:38 UTC (rev 24207)
@@ -4703,10 +4703,11 @@
 }
 
 
-/* inserting keys, refresh ipo-keys, pointcache, redraw events... (ton) */
-/* note: transdata has been freed already! */
-/* note: this runs even when createTransData exits early because  (t->total==0), is this correct?... (campbell) */
-/* note: sequencer freeing has its own function now because of a conflict with transform's order of freeing (campbell)*/
+/* inserting keys, refresh ipo-keys, pointcache, redraw events... */
+/* 
+ * note: sequencer freeing has its own function now because of a conflict with transform's order of freeing (campbell)
+ * 		 Order changed, the sequencer stuff should go back in here
+ * */
 void special_aftertrans_update(TransInfo *t)
 {
 	Object *ob;
@@ -4714,6 +4715,10 @@
 	int cancelled= (t->state == TRANS_CANCEL);
 	short duplicate= (t->undostr && strstr(t->undostr, "Duplicate")) ? 1 : 0;
 	
+	/* early out when nothing happened */
+	if (t->total == 0 || t->mode != TFM_DUMMY)
+		return;
+	
 	if (t->spacetype==SPACE_VIEW3D) {
 		if (t->obedit) {
 			if (cancelled==0) {
@@ -4988,43 +4993,42 @@
 	else if(t->scene->basact && (ob = t->scene->basact->object) && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, ob)) {
 		;
 	}
-	else {
-		/* Objects */
-		// XXX ideally, this would go through context iterators, but we don't have context iterator access here,
-		// so we make do with old data + access styles...
-		Scene *scene= t->scene;
-		Base *base;
+	else { /* Objects */
+		int i;
 
-		for (base= FIRSTBASE; base; base= base->next) {
-			ob= base->object;
+		for (i = 0; i < t->total; i++) {
+			TransData *td = t->data + i;
+			Object *ob = td->ob;
+			ListBase pidlist;
+			PTCacheID *pid;
+			
+			if (td->flag & TD_NOACTION)
+				break;
+			
+			if (td->flag & TD_SKIP)
+				continue;
 
-			if (base->flag & SELECT && (t->mode != TFM_DUMMY)) {
-				ListBase pidlist;
-				PTCacheID *pid;
+			/* flag object caches as outdated */
+			BKE_ptcache_ids_from_object(&pidlist, ob);
+			for(pid=pidlist.first; pid; pid=pid->next) {
+				if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+					pid->cache->flag |= PTCACHE_OUTDATED;
+			}
+			BLI_freelistN(&pidlist);
 
-				/* flag object caches as outdated */
-				BKE_ptcache_ids_from_object(&pidlist, ob);
-				for(pid=pidlist.first; pid; pid=pid->next) {
-					if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
-						pid->cache->flag |= PTCACHE_OUTDATED;
-				}
-				BLI_freelistN(&pidlist);
+			/* pointcache refresh */
+			if (BKE_ptcache_object_reset(t->scene, ob, PTCACHE_RESET_OUTDATED))
+				ob->recalc |= OB_RECALC_DATA;
 
-				/* pointcache refresh */
-				if (BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED))
-					ob->recalc |= OB_RECALC_DATA;
+			/* Needed for proper updating of "quick cached" dynamics. */
+			/* Creates troubles for moving animated objects without */
+			/* autokey though, probably needed is an anim sys override? */
+			/* Please remove if some other solution is found. -jahka */
+			DAG_id_flush_update(&ob->id, OB_RECALC_OB);
 
-				/* Needed for proper updating of "quick cached" dynamics. */
-				/* Creates troubles for moving animated objects without */
-				/* autokey though, probably needed is an anim sys override? */
-				/* Please remove if some other solution is found. -jahka */
-				DAG_id_flush_update(&ob->id, OB_RECALC_OB);
-
-				/* Set autokey if necessary */
-				if (!cancelled)
-					autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
-			}
-
+			/* Set autokey if necessary */
+			if (!cancelled)
+				autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
 		}
 	}
 

Modified: trunk/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_generics.c	2009-11-01 01:11:15 UTC (rev 24206)
+++ trunk/blender/source/blender/editors/transform/transform_generics.c	2009-11-01 02:52:38 UTC (rev 24207)
@@ -776,6 +776,8 @@
 			flushTransParticles(t);
 		}
 		else {
+			int i;
+			
 			for(base= FIRSTBASE; base; base= base->next) {
 				Object *ob= base->object;
 				
@@ -784,18 +786,26 @@
 					ob->recalc |= OB_RECALC_OB;
 				if(base->flag & BA_HAS_RECALC_DATA)
 					ob->recalc |= OB_RECALC_DATA;
+			}
+			
+			for (i = 0; i < t->total; i++) {
+				TransData *td = t->data + i;
+				Object *ob = td->ob;
 				
-				/* if object/base is selected */
-				if ((base->flag & SELECT) || (ob->flag & SELECT)) {
-					/* if animtimer is running, and the object already has animation data,
-					 * check if the auto-record feature means that we should record 'samples'
-					 * (i.e. uneditable animation values)
-					 */
-					// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
-					if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
-						animrecord_check_state(t->scene, &ob->id, t->animtimer);
-						autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
-					}
+				if (td->flag & TD_NOACTION)
+					break;
+				
+				if (td->flag & TD_SKIP)
+					continue;
+				
+				/* if animtimer is running, and the object already has animation data,
+				 * check if the auto-record feature means that we should record 'samples'
+				 * (i.e. uneditable animation values)
+				 */
+				// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
+				if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+					animrecord_check_state(t->scene, &ob->id, t->animtimer);
+					autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
 				}
 				
 				/* proxy exception */





More information about the Bf-blender-cvs mailing list