[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35815] trunk/blender: option not to restore the original frame when canceling the animation, use in demo mode.
Campbell Barton
ideasman42 at gmail.com
Sun Mar 27 10:31:11 CEST 2011
Revision: 35815
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35815
Author: campbellbarton
Date: 2011-03-27 08:31:10 +0000 (Sun, 27 Mar 2011)
Log Message:
-----------
option not to restore the original frame when canceling the animation, use in demo mode.
Modified Paths:
--------------
trunk/blender/intern/tools/demo_mode.py
trunk/blender/source/blender/editors/screen/screen_ops.c
Modified: trunk/blender/intern/tools/demo_mode.py
===================================================================
--- trunk/blender/intern/tools/demo_mode.py 2011-03-27 07:56:29 UTC (rev 35814)
+++ trunk/blender/intern/tools/demo_mode.py 2011-03-27 08:31:10 UTC (rev 35815)
@@ -82,9 +82,7 @@
# run update funcs
if global_config["_reset_anim"]:
global_config["_reset_anim"] = False
- f = bpy.context.scene.frame_current
- bpy.ops.screen.animation_cancel()
- bpy.context.scene.frame_set(f)
+ bpy.ops.screen.animation_cancel(restore_frame=False)
bpy.ops.screen.animation_play()
if global_config["screen_switch"]:
Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c 2011-03-27 07:56:29 UTC (rev 35814)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c 2011-03-27 08:31:10 UTC (rev 35815)
@@ -2938,20 +2938,23 @@
RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
}
-static int screen_animation_cancel_exec(bContext *C, wmOperator *UNUSED(op))
+static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
{
bScreen *screen= CTX_wm_screen(C);
-
+
if (screen->animtimer) {
- ScreenAnimData *sad= screen->animtimer->customdata;
- Scene *scene= CTX_data_scene(C);
-
- /* reset current frame before stopping, and just send a notifier to deal with the rest
- * (since playback still needs to be stopped)
- */
- scene->r.cfra= sad->sfra;
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
-
+ if(RNA_boolean_get(op->ptr, "restore_frame")) {
+ ScreenAnimData *sad= screen->animtimer->customdata;
+ Scene *scene= CTX_data_scene(C);
+
+ /* reset current frame before stopping, and just send a notifier to deal with the rest
+ * (since playback still needs to be stopped)
+ */
+ scene->r.cfra= sad->sfra;
+
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ }
+
/* call the other "toggling" operator to clean up now */
ED_screen_animation_play(C, 0, 0);
}
@@ -2970,6 +2973,8 @@
ot->exec= screen_animation_cancel_exec;
ot->poll= ED_operator_screenactive;
+
+ RNA_def_boolean(ot->srna, "restore_frame", TRUE, "Restore Frame", "Restore the frame when animation was initialized.");
}
/* ************** border select operator (template) ***************************** */
More information about the Bf-blender-cvs
mailing list