[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32413] trunk/blender/source/blender/ editors: Fix for [#20064] Cloth simulation doesn' t stop when marker is set back to frame 1 after exiting mesh edit.

Janne Karhu jhkarh at gmail.com
Mon Oct 11 12:40:34 CEST 2010


Revision: 32413
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32413
Author:   jhk
Date:     2010-10-11 12:40:34 +0200 (Mon, 11 Oct 2010)

Log Message:
-----------
Fix for [#20064] Cloth simulation doesn't stop when marker is set back to frame 1 after exiting mesh edit.
* First frame was dropped some times when animation was running because clicking "go to start/end frame" changed the current frame directly.
* Now only the animtimer changes the frame and clicking the "go to" queues the next frame for animtimer.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_screen_types.h
    trunk/blender/source/blender/editors/screen/screen_ops.c

Modified: trunk/blender/source/blender/editors/include/ED_screen_types.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen_types.h	2010-10-11 09:52:25 UTC (rev 32412)
+++ trunk/blender/source/blender/editors/include/ED_screen_types.h	2010-10-11 10:40:34 UTC (rev 32413)
@@ -38,6 +38,7 @@
 	short refresh;
 	short flag;			/* flags for playback */
 	int sfra;			/* frame that playback was started from */
+	int nextfra;		/* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
 } ScreenAnimData;
 
 /* for animplayer */
@@ -50,6 +51,8 @@
 	ANIMPLAY_FLAG_SYNC			= (1<<2),
 		/* don't drop frames (and ignore SCE_FRAME_DROP flag) */
 	ANIMPLAY_FLAG_NO_SYNC		= (1<<3),
+		/* use nextfra at next timer update */
+	ANIMPLAY_FLAG_USE_NEXT_FRAME,
 };
 
 /* ----------------------------------------------------- */

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2010-10-11 09:52:25 UTC (rev 32412)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2010-10-11 10:40:34 UTC (rev 32413)
@@ -1553,15 +1553,32 @@
 static int frame_jump_exec(bContext *C, wmOperator *op)
 {
 	Scene *scene= CTX_data_scene(C);
-	
-	if (RNA_boolean_get(op->ptr, "end"))
-		CFRA= PEFRA;
-	else
-		CFRA= PSFRA;
-	
-	sound_seek_scene(C);
+	wmTimer *animtimer= CTX_wm_screen(C)->animtimer;
 
-	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+	/* Don't change CFRA directly if animtimer is running as this can cause
+	 * first/last frame not to be actually shown (bad since for example physics
+	 * simulations aren't reset properly).
+	 */
+	if(animtimer) {
+		ScreenAnimData *sad = animtimer->customdata;
+		
+		sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
+		
+		if (RNA_boolean_get(op->ptr, "end"))
+			sad->nextfra= PEFRA;
+		else
+			sad->nextfra= PSFRA;
+	}
+	else {
+		if (RNA_boolean_get(op->ptr, "end"))
+			CFRA= PEFRA;
+		else
+			CFRA= PSFRA;
+		
+		sound_seek_scene(C);
+
+		WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+	}
 	
 	return OPERATOR_FINISHED;
 }
@@ -2513,6 +2530,13 @@
 				}
 			}
 		}
+
+		/* next frame overriden by user action (pressed jump to first/last frame) */
+		if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
+			scene->r.cfra = sad->nextfra;
+			sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME;
+			sad->flag |= ANIMPLAY_FLAG_JUMPED;
+		}
 		
 		if (sad->flag & ANIMPLAY_FLAG_JUMPED)
 			sound_seek_scene(C);





More information about the Bf-blender-cvs mailing list