[Bf-blender-cvs] [23a870a0a90] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Thu Jul 12 16:23:29 CEST 2018
Commit: 23a870a0a90aa56c1d1d818c2ff3efd57441963d
Author: Antonio Vazquez
Date: Thu Jul 12 16:23:21 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB23a870a0a90aa56c1d1d818c2ff3efd57441963d
Merge branch 'blender2.8' into greasepencil-object
===================================================================
===================================================================
diff --cc source/blender/editors/undo/ed_undo.c
index 29c363f5738,7bbb2479a52..127d601d250
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@@ -124,13 -122,32 +126,38 @@@ static int ed_undo_step(bContext *C, in
if (ED_gpencil_session_active()) {
return ED_undo_gpencil_step(C, step, undoname);
}
+ if (sa && (sa->spacetype == SPACE_VIEW3D)) {
+ Object *obact = CTX_data_active_object(C);
+ if (obact && (obact->type == OB_GPENCIL)) {
+ ED_gpencil_toggle_brush_cursor(C, false, NULL);
+ }
+ }
+ UndoStep *step_data_from_name = NULL;
+ int step_for_callback = step;
+ if (undoname != NULL) {
+ step_data_from_name = BKE_undosys_step_find_by_name(wm->undo_stack, undoname);
+ if (step_data_from_name == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* TODO(campbell), could use simple optimization. */
+ BLI_assert(step_data_from_name != wm->undo_stack->step_active);
+ step_for_callback = (
+ BLI_findindex(&wm->undo_stack->steps, step_data_from_name) <
+ BLI_findindex(&wm->undo_stack->steps, wm->undo_stack->step_active)) ? 1 : -1;
+ }
+
+ /* App-Handlers (pre). */
+ {
+ /* Note: ignore grease pencil for now. */
+ Main *bmain = CTX_data_main(C);
+ wm->op_undo_depth++;
+ BLI_callback_exec(bmain, &scene->id, (step_for_callback > 0) ? BLI_CB_EVT_UNDO_PRE : BLI_CB_EVT_REDO_PRE);
+ wm->op_undo_depth--;
+ }
+
+
/* Undo System */
{
if (undoname) {
@@@ -140,25 -156,17 +166,34 @@@
else {
BKE_undosys_step_undo_compat_only(wm->undo_stack, C, step);
}
+
+ /* Set special modes for grease pencil */
+ if (sa && (sa->spacetype == SPACE_VIEW3D)) {
+ Object *obact = CTX_data_active_object(C);
+ if (obact && (obact->type == OB_GPENCIL)) {
+ /* set cursor */
+ if (ELEM(obact->mode, OB_MODE_GPENCIL_PAINT, OB_MODE_GPENCIL_SCULPT, OB_MODE_GPENCIL_WEIGHT)) {
+ 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). */
+ {
+ Main *bmain = CTX_data_main(C);
+ scene = CTX_data_scene(C);
+ wm->op_undo_depth++;
+ BLI_callback_exec(bmain, &scene->id, step_for_callback > 0 ? BLI_CB_EVT_UNDO_PRE : BLI_CB_EVT_REDO_PRE);
+ wm->op_undo_depth--;
+ }
+
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_event_add_notifier(C, NC_WM | ND_UNDO, NULL);
More information about the Bf-blender-cvs
mailing list