[Bf-blender-cvs] [7e4d6bcb888] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

Antonio Vazquez noreply at git.blender.org
Sun Apr 1 12:45:34 CEST 2018


Commit: 7e4d6bcb8887b16b786693af429673411f567019
Author: Antonio Vazquez
Date:   Sun Apr 1 12:25:58 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7e4d6bcb8887b16b786693af429673411f567019

Merge branch 'blender2.8' into greasepencil-object

 Conflicts:
	source/blender/editors/gpencil/gpencil_data.c
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/util/undo.c

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



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

diff --cc source/blender/editors/util/undo.c
index af66b71f90a,99e90eb73e8..1bbb6bcd5ce
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@@ -49,8 -48,7 +49,9 @@@
  #include "BKE_library_override.h"
  #include "BKE_main.h"
  #include "BKE_screen.h"
+ #include "BKE_undo_system.h"
 +#include "BKE_workspace.h"
 +#include "BKE_paint.h"
  
  #include "DEG_depsgraph.h"
  
@@@ -147,106 -126,16 +129,44 @@@ 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)) {
 +		if (obact && (obact->type == OB_GPENCIL)) {
 +			ED_gpencil_toggle_brush_cursor(C, false, NULL);
 +		}
 +	}
  
- 	if (sa && (sa->spacetype == SPACE_IMAGE)) {
- 		SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
- 		
- 		if ((obact && (workspace->object_mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) {
- 			if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname) {
- 				if (U.uiflag & USER_GLOBALUNDO) {
- 					ED_viewport_render_kill_jobs(wm, bmain, true);
- 					BKE_undo_name(C, undoname);
- 				}
- 			}
- 			
- 			WM_event_add_notifier(C, NC_WINDOW, NULL);
- 			return OPERATOR_FINISHED;
- 		}
- 	}
- 
- 	if (sa && (sa->spacetype == SPACE_TEXT)) {
- 		ED_text_undo_step(C, step);
- 	}
- 	else if (obedit) {
- 		if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
- 			if (undoname)
- 				undo_editmode_name(C, undoname);
- 			else
- 				undo_editmode_step(C, step);
- 			
- 			WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
+ 	/* Undo System */
+ 	{
+ 		if (undoname) {
+ 			UndoStep *step_data = BKE_undosys_step_find_by_name(wm->undo_stack, undoname);
+ 			BKE_undosys_step_undo_with_data(wm->undo_stack, C, step_data);
  		}
- 	}
- 	else {
- 		/* Note: we used to do a fall-through here where if the
- 		 * mode-specific undo system had no more steps to undo (or
- 		 * redo), the global undo would run.
- 		 *
- 		 * That was inconsistent with editmode, and also makes for
- 		 * unecessarily tricky interaction with the other undo
- 		 * systems. */
- 		if (obact && workspace->object_mode & OB_MODE_TEXTURE_PAINT) {
- 			ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname);
- 		}
- 		else if (obact && workspace->object_mode & OB_MODE_SCULPT) {
- 			ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname);
- 		}
- 		else if (obact && workspace->object_mode & OB_MODE_PARTICLE_EDIT) {
- 			if (step == 1)
- 				PE_undo(scene, view_layer);
- 			else
- 				PE_redo(scene, view_layer);
- 		}
- 		else if (U.uiflag & USER_GLOBALUNDO) {
- 			// note python defines not valid here anymore.
- 			//#ifdef WITH_PYTHON
- 			// XXX		BPY_scripts_clear_pyobjects();
- 			//#endif
- 			
- 			/* for global undo/redo we should just clear the editmode stack */
- 			/* for example, texface stores image pointers */
- 			undo_editmode_clear();
- 			
- 			ED_viewport_render_kill_jobs(wm, bmain, true);
- 
- 			if (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, scene);
+ 		else {
+ 			BKE_undosys_step_undo_compat_only(wm->undo_stack, C, step);
  		}
- 	}
- 
++	
 +	/* Set special modes for grease pencil */
 +	if (sa && (sa->spacetype == SPACE_VIEW3D)) {
 +		obact = CTX_data_active_object(C);
 +		if (obact && (obact->type == OB_GPENCIL)) {
 +			WorkSpace *workspace = CTX_wm_workspace(C);
 +			/* set cursor */
 +			if (workspace->object_mode == OB_MODE_GPENCIL_PAINT) {
 +				ED_gpencil_toggle_brush_cursor(C, true, NULL);
 +			}
 +			else if (workspace->object_mode == OB_MODE_GPENCIL_SCULPT) {
 +				ED_gpencil_toggle_brush_cursor(C, true, NULL);
 +			}
 +			else if (workspace->object_mode == 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);
 +		}
  	}
  
  	WM_event_add_notifier(C, NC_WINDOW, NULL);



More information about the Bf-blender-cvs mailing list