[Bf-blender-cvs] [8b84c5f] master: Port optimization from gooseberry branch:

Antony Riakiotakis noreply at git.blender.org
Wed Jul 29 12:52:22 CEST 2015


Commit: 8b84c5f9de32e42e835a15aa1ef05504d0a4c198
Author: Antony Riakiotakis
Date:   Wed Jul 29 12:52:03 2015 +0200
Branches: master
https://developer.blender.org/rB8b84c5f9de32e42e835a15aa1ef05504d0a4c198

Port optimization from gooseberry branch:

Treat scrubbing as animation.

This is checked during various updates to avoid
some costly calculations.

===================================================================

M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/animation/anim_ops.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/space_graph/graph_ops.c
M	source/blender/makesdna/DNA_screen_types.h

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 90aafa9..541b401 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5948,6 +5948,7 @@ static void lib_link_screen(FileData *fd, Main *main)
 				sc->scene = main->scene.first;
 
 			sc->animtimer = NULL; /* saved in rare cases */
+			sc->scrubbing = false;
 			
 			for (sa = sc->areabase.first; sa; sa = sa->next) {
 				SpaceLink *sl;
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 2de4293..20d1dbe 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -148,18 +148,24 @@ static void change_frame_seq_preview_begin(bContext *C, const wmEvent *event)
 {
 	ScrArea *sa = CTX_wm_area(C);
 	if (sa && sa->spacetype == SPACE_SEQ) {
+		wmWindow *win = CTX_wm_window(C);
 		SpaceSeq *sseq = sa->spacedata.first;
 		if (ED_space_sequencer_check_show_strip(sseq)) {
 			ED_sequencer_special_preview_set(C, event->mval);
 		}
+		if (win->screen)
+			win->screen->scrubbing = true;
 	}
 }
 static void change_frame_seq_preview_end(bContext *C)
 {
 	if (ED_sequencer_special_preview_get() != NULL) {
+		wmWindow *win = CTX_wm_window(C);
 		Scene *scene = CTX_data_scene(C);
 		ED_sequencer_special_preview_clear();
 		WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
+		if (win->screen)
+			win->screen->scrubbing = false;
 	}
 }
 
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 0c40c83..ae0d261 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1314,7 +1314,8 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
 	if (screen->animtimer)
 		WM_event_remove_timer(wm, window, screen->animtimer);
 	screen->animtimer = NULL;
-	
+	screen->scrubbing = false;
+
 	if (screen->mainwin)
 		wm_subwindow_close(window, screen->mainwin);
 	screen->mainwin = 0;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 571dab6..b157c91 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3626,7 +3626,7 @@ bScreen *ED_screen_animation_playing(const wmWindowManager *wm)
 	wmWindow *win;
 
 	for (win = wm->windows.first; win; win = win->next) {
-		if (win->screen->animtimer) {
+		if (win->screen->animtimer || win->screen->scrubbing) {
 			return win->screen;
 		}
 	}
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index f4cce29..93773a1 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -139,6 +139,7 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent
 /* Modal Operator init */
 static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
+	wmWindow *win = CTX_wm_window(C);
 	/* Change to frame that mouse is over before adding modal handler,
 	 * as user could click on a single frame (jump to frame) as well as
 	 * click-dragging over a range (modal scrubbing).
@@ -148,6 +149,9 @@ static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *e
 	/* apply these changes first */
 	graphview_cursor_apply(C, op);
 	
+	if (win->screen)
+		win->screen->scrubbing = true;
+
 	/* add temp handler */
 	WM_event_add_modal_handler(C, op);
 	return OPERATOR_RUNNING_MODAL;
@@ -156,9 +160,12 @@ static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *e
 /* Modal event handling of cursor changing */
 static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
+	wmWindow *win = CTX_wm_window(C);
 	/* execute the events */
 	switch (event->type) {
 		case ESCKEY:
+			if (win->screen)
+				win->screen->scrubbing = false;
 			return OPERATOR_FINISHED;
 		
 		case MOUSEMOVE:
@@ -173,8 +180,11 @@ static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *ev
 			/* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init 
 			 * the modal op) doesn't work for some reason
 			 */
-			if (event->val == KM_RELEASE)
+			if (event->val == KM_RELEASE) {
+				if (win->screen)
+					win->screen->scrubbing = false;
 				return OPERATOR_FINISHED;
+			}
 			break;
 	}
 
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index eb76c90..45b3aad 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -68,7 +68,8 @@ typedef struct bScreen {
 	char do_draw_drag;					/* notifier for dragging draw. */
 	char swap;							/* indicator to survive swap-exchange systems */
 	char skip_handling;					/* set to delay screen handling after switching back from maximized area */
-	char pad[7];
+	char scrubbing;						/* set when scrubbing to avoid some costly updates */
+	char pad[6];
 	
 	short mainwin;						/* screensize subwindow, for screenedges and global menus */
 	short subwinactive;					/* active subwindow */




More information about the Bf-blender-cvs mailing list