[Bf-blender-cvs] [b3693fa30ed] greasepencil-object: Fix error in GP modes for undo

Antonio Vazquez noreply at git.blender.org
Tue Jun 27 12:39:49 CEST 2017


Commit: b3693fa30ede00cd9eb9c5fc84c5150db4ce84df
Author: Antonio Vazquez
Date:   Tue Jun 27 12:39:36 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb3693fa30ede00cd9eb9c5fc84c5150db4ce84df

Fix error in GP modes for undo

When undo the special gp modes did not work.

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

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

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

diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index f5830e451e3..d06c93c1842 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -47,6 +47,7 @@
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_screen.h"
+#include "BKE_workspace.h"
 
 #include "ED_armature.h"
 #include "ED_particle.h"
@@ -135,6 +136,11 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 	if (ED_gpencil_session_active()) {
 		return ED_undo_gpencil_step(C, step, undoname);
 	}
+	if (sa && (sa->spacetype == SPACE_VIEW3D)) {
+		if (obact && (obact->type == OB_GPENCIL)) {
+			ED_gpencil_toggle_brush_cursor(C, false);
+		}
+	}
 
 	if (sa && (sa->spacetype == SPACE_IMAGE)) {
 		SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
@@ -207,10 +213,30 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 			WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
 		}
 	}
-	
+
+	/* Set special modes for grease pencil */
+	if (sa && (sa->spacetype == SPACE_VIEW3D)) {
+		obact = CTX_data_active_object(C);
+		if (obact && (obact->type == OB_GPENCIL)) {
+			/* set cursor */
+			if (obact->mode == OB_MODE_GPENCIL_PAINT) {
+				WM_cursor_modal_set(CTX_wm_window(C), BC_PAINTBRUSHCURSOR);
+			}
+			else if (obact->mode == OB_MODE_GPENCIL_SCULPT) {
+				WM_cursor_modal_set(CTX_wm_window(C), BC_CROSSCURSOR);
+				ED_gpencil_toggle_brush_cursor(C, true);
+			}
+			else {
+				WM_cursor_modal_set(CTX_wm_window(C), CURSOR_STD);
+			}
+			/* set workspace mode */
+			BKE_workspace_object_mode_set(CTX_wm_workspace(C), obact->mode);
+		}
+	}
+
 	WM_event_add_notifier(C, NC_WINDOW, NULL);
 	WM_event_add_notifier(C, NC_WM | ND_UNDO, NULL);
-
+	
 	if (win) {
 		win->addmousemove = true;
 	}




More information about the Bf-blender-cvs mailing list