[Bf-blender-cvs] [e6bdd57191e] master: Fix T86609: GPencil: Sculpt brush cursor disappears on undo.

Bastien Montagne noreply at git.blender.org
Wed Mar 17 11:38:35 CET 2021


Commit: e6bdd57191e833f336fdb582418935b997395f98
Author: Bastien Montagne
Date:   Wed Mar 17 11:37:10 2021 +0100
Branches: master
https://developer.blender.org/rBe6bdd57191e833f336fdb582418935b997395f98

Fix T86609: GPencil: Sculpt brush cursor disappears on undo.

Regression from rB2a8122fb65c5, somehow that piece of code was lost
during the refactor.

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

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

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

diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 989863b34af..b69f62a2875 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -224,6 +224,28 @@ static void ed_undo_step_post(bContext *C,
 
   Main *bmain = CTX_data_main(C);
   Scene *scene = CTX_data_scene(C);
+  ScrArea *area = CTX_wm_area(C);
+
+  /* Set special modes for grease pencil */
+  if (area != NULL && (area->spacetype == SPACE_VIEW3D)) {
+    Object *obact = CTX_data_active_object(C);
+    if (obact && (obact->type == OB_GPENCIL)) {
+      /* set cursor */
+      if (ELEM(obact->mode,
+               OB_MODE_PAINT_GPENCIL,
+               OB_MODE_SCULPT_GPENCIL,
+               OB_MODE_WEIGHT_GPENCIL,
+               OB_MODE_VERTEX_GPENCIL)) {
+        ED_gpencil_toggle_brush_cursor(C, true, NULL);
+      }
+      else {
+        ED_gpencil_toggle_brush_cursor(C, false, NULL);
+      }
+      /* set workspace mode */
+      Base *basact = CTX_data_active_base(C);
+      ED_object_base_activate(C, basact);
+    }
+  }
 
   /* App-Handlers (post). */
   {



More information about the Bf-blender-cvs mailing list