[Bf-blender-cvs] [8572ae8] master: UI: fix for glitch where active button became inactive on undo

Campbell Barton noreply at git.blender.org
Sat Feb 15 03:30:35 CET 2014


Commit: 8572ae89cdc9148fc948f0052e7f12135ba5c664
Author: Campbell Barton
Date:   Sat Feb 15 13:28:26 2014 +1100
https://developer.blender.org/rB8572ae89cdc9148fc948f0052e7f12135ba5c664

UI: fix for glitch where active button became inactive on undo

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

M	source/blender/editors/util/undo.c

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

diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 6d3d33f..af524fa 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -121,14 +121,17 @@ void ED_undo_push(bContext *C, const char *str)
 
 /* note: also check undo_history_exec() in bottom if you change notifiers */
 static int ed_undo_step(bContext *C, int step, const char *undoname)
-{	
+{
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmWindow *win = CTX_wm_window(C);
+	Scene *scene = CTX_data_scene(C);
 	Object *obedit = CTX_data_edit_object(C);
 	Object *obact = CTX_data_active_object(C);
 	ScrArea *sa = CTX_wm_area(C);
 
 	/* undo during jobs are running can easily lead to freeing data using by jobs,
 	 * or they can just lead to freezing job in some other cases */
-	if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY)) {
+	if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) {
 		return OPERATOR_CANCELLED;
 	}
 
@@ -182,9 +185,9 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 		}
 		else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
 			if (step == 1)
-				PE_undo(CTX_data_scene(C));
+				PE_undo(scene);
 			else
-				PE_redo(CTX_data_scene(C));
+				PE_redo(scene);
 		}
 		else if (U.uiflag & USER_GLOBALUNDO) {
 			// note python defines not valid here anymore.
@@ -202,12 +205,18 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 				BKE_undo_name(C, undoname);
 			else
 				BKE_undo_step(C, step);
+
+			scene = CTX_data_scene(C);
 				
-			WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
+			WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
 		}
 	}
 	
 	WM_event_add_notifier(C, NC_WINDOW, NULL);
+
+	if (win) {
+		win->addmousemove = true;
+	}
 	
 	return OPERATOR_FINISHED;
 }




More information about the Bf-blender-cvs mailing list