[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18179] branches/blender2.5/blender/source /blender/editors: 2.5

Ton Roosendaal ton at blender.org
Tue Dec 30 20:01:12 CET 2008


Revision: 18179
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18179
Author:   ton
Date:     2008-12-30 20:01:12 +0100 (Tue, 30 Dec 2008)

Log Message:
-----------
2.5

Undo editmode and global undo code back. 
It's now called ED_undo_push() btw, but don't worry, for operators
this is going to be a simple operator flag, so you can remove the
old calls from all tools (but keep them when you directly change
data outide modifiers).

Will put undo back functional tomorrow

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h
    branches/blender2.5/blender/source/blender/editors/include/ED_util.h
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/util/editmode_undo.c
    branches/blender2.5/blender/source/blender/editors/util/undo.c

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h	2008-12-30 18:14:15 UTC (rev 18178)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h	2008-12-30 19:01:12 UTC (rev 18179)
@@ -73,6 +73,7 @@
 EditFace	*EM_get_face_for_index(int index);
 int			EM_texFaceCheck(struct EditMesh *em);
 int			EM_vertColorCheck(struct EditMesh *em);
+void		undo_push_mesh(char *name);
 
 
 /* editmesh_lib.c */

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_util.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_util.h	2008-12-30 18:14:15 UTC (rev 18178)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_util.h	2008-12-30 19:01:12 UTC (rev 18179)
@@ -28,6 +28,30 @@
 #ifndef ED_UTIL_H
 #define ED_UTIL_H
 
+struct Object;
+struct bContext;
+struct uiMenuBlockHandle;
+struct uiBlock;
+
+/* ************** Undo ************************ */
+
+/* undo.c */
+void	ED_redo					(struct bContext *C);
+void	ED_undo					(struct bContext *C);
+void	ED_undo_push			(struct bContext *C, char *str);
+void	ED_undo_menu			(struct bContext *C);
+
+/* undo_editmode.c */
+void	undo_editmode_push			(char *name, void (*freedata)(void *), 
+									 void (*to_editmode)(void *),  void *(*from_editmode)(void),
+									 int (*validate_undo)(void *));
+void	*undo_editmode_get_prev		(struct Object *ob);
+struct uiBlock *editmode_undohistorymenu(struct bContext *C, struct uiMenuBlockHandle *handle, void *arg_unused);
+void	undo_editmode_menu			(void);
+void	undo_editmode_clear			(void);
+void	undo_editmode_step			(int step);
+
+
 /* ************** XXX OLD CRUFT WARNING ************* */
 
 void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert);

Modified: branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c	2008-12-30 18:14:15 UTC (rev 18178)
+++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c	2008-12-30 19:01:12 UTC (rev 18179)
@@ -78,6 +78,7 @@
 #include "BIF_retopo.h"
 
 #include "ED_mesh.h"
+#include "ED_util.h"
 
 /* own include */
 #include "editmesh.h"
@@ -98,8 +99,6 @@
 static void undo_editmode_clear() {}
 static int multires_test() {return 0;}
 static void adduplicate() {}
-static void *undo_editmode_get_prev() {return NULL;}
-static void undo_editmode_push() {}
 
 
 /* ***************** HASH ********************* */

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c	2008-12-30 18:14:15 UTC (rev 18178)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c	2008-12-30 19:01:12 UTC (rev 18179)
@@ -121,7 +121,6 @@
 static void countall(void) {}
 extern void borderselect();
 static int BIF_snappingSupported() {return 1;}
-static void BIF_undo_push() {}
 static int retopo_mesh_paint_check() {return 0;}
 
 /* view3d handler codes */
@@ -984,7 +983,7 @@
 
 		case 16: /* path select */
 			pathselect();
-			BIF_undo_push("Path Select");
+			ED_undo_push(C, "Path Select");
 			break;
 		case 17: /* edge loop select */
 			loop_multiselect(0);
@@ -1508,15 +1507,15 @@
 	switch (event) {
 	case 1: /*Selection to grid*/
 	    snap_sel_to_grid();
-		BIF_undo_push("Snap selection to grid");
+		ED_undo_push(C, "Snap selection to grid");
 	    break;
 	case 2: /*Selection to cursor*/
 	    snap_sel_to_curs();
-		BIF_undo_push("Snap selection to cursor");
+		ED_undo_push(C, "Snap selection to cursor");
 	    break;
 	case 3: /*Selection to center of selection*/
 	    snap_to_center();
-		BIF_undo_push("Snap selection to center");
+		ED_undo_push(C, "Snap selection to center");
 	    break;
 	case 4: /*Cursor to selection*/
 	    snap_curs_to_sel();
@@ -1526,7 +1525,7 @@
 	    break;
 	case 6: /*Cursor to Active*/
 	    snap_curs_to_active();
-		BIF_undo_push("Snap selection to center");
+		ED_undo_push(C, "Snap selection to center");
 	    break;
 	}
 	allqueue(REDRAWVIEW3D, 0);
@@ -2667,7 +2666,7 @@
 		notice("Removed: %d", count);
 		if (count) { /* only undo and redraw if an action is taken */
 			DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
-			BIF_undo_push("Rem Doubles");
+			ED_undo_push(C, "Rem Doubles");
 		}
 		break;
 	case 2: /* smooth */
@@ -2735,18 +2734,18 @@
 		 
 	case 0: /* subdivide smooth */
 		esubdivideflag(1, 0.0, scene->toolsettings->editbutflag | B_SMOOTH,1,0);
-		BIF_undo_push("Subdivide Smooth");
+		ED_undo_push(C, "Subdivide Smooth");
 		break;
 	case 1: /*subdivide fractal */
 		randfac= 10;
 		if(button(&randfac, 1, 100, "Rand fac:")==0) return;
 		fac= -( (float)randfac )/100;
 		esubdivideflag(1, fac, scene->toolsettings->editbutflag,1,0);
-		BIF_undo_push("Subdivide Fractal");
+		ED_undo_push(C, "Subdivide Fractal");
 		break;
 	case 2: /* subdivide */
 		esubdivideflag(1, 0.0, scene->toolsettings->editbutflag,1,0);
-		BIF_undo_push("Subdivide");
+		ED_undo_push(C, "Subdivide");
 		break;
 	case 3: /* knife subdivide */
 		KnifeSubdivide(KNIFE_PROMPT);
@@ -2784,22 +2783,22 @@
 	case 13: /* Edge Loop Delete */
 		if(EdgeLoopDelete()) {
 			countall();
-			BIF_undo_push("Erase Edge Loop");
+			ED_undo_push(C, "Erase Edge Loop");
 			DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
 		}
 		break;
 	case 14: /*Collapse Edges*/
 		collapseEdges();
-		BIF_undo_push("Collapse");
+		ED_undo_push(C, "Collapse");
 		break;
 	case 15:
 		editmesh_mark_sharp(1);
-		BIF_undo_push("Mark Sharp");
+		ED_undo_push(C, "Mark Sharp");
 		DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
 		break;
 	case 16:
 		editmesh_mark_sharp(0);
-		BIF_undo_push("Clear Sharp");
+		ED_undo_push(C, "Clear Sharp");
 		DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
 		break;
 	case 17: /* Adjust Bevel Weight */
@@ -4151,7 +4150,7 @@
 	case 4: /* clear user transform */
 		rest_pose(ob->pose);
 		DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-		BIF_undo_push("Pose, Clear User Transform");
+		ED_undo_push(C, "Pose, Clear User Transform");
 		break;
 	}
 	allqueue(REDRAWVIEW3D, 0);
@@ -4723,19 +4722,19 @@
 	switch(event) {
 	case 0:
 		sd->flags ^= SCULPT_INPUT_SMOOTH;
-		BIF_undo_push("Smooth stroke");
+		ED_undo_push(C, "Smooth stroke");
 		break;
 	case 1:
 		val= sd->tablet_size;
 		if(button(&val,0,10,"Tablet Size:")==0) return;
 		sd->tablet_size= val;
-		BIF_undo_push("Tablet size");
+		ED_undo_push(C, "Tablet size");
 		break;
 	case 2:
 		val= sd->tablet_strength;
 		if(button(&val,0,10,"Tablet Strength:")==0) return;
 		sd->tablet_strength= val;
-		BIF_undo_push("Tablet strength");
+		ED_undo_push(C, "Tablet strength");
 		break;
 	}
 	
@@ -4762,23 +4761,23 @@
 	case 5:
 	case 6:
 		sd->brush_type= event+1;
-		BIF_undo_push("Brush type");
+		ED_undo_push(C, "Brush type");
 		break;
 	case 7:
 		br->flag ^= SCULPT_BRUSH_AIRBRUSH;
-		BIF_undo_push("Airbrush");
+		ED_undo_push(C, "Airbrush");
 		break;
 	case 8:
 		sd->symm ^= SYMM_X;
-		BIF_undo_push("X Symmetry");
+		ED_undo_push(C, "X Symmetry");
 		break;
 	case 9:
 		sd->symm ^= SYMM_Y;
-		BIF_undo_push("Y Symmetry");
+		ED_undo_push(C, "Y Symmetry");
 		break;
 	case 10:
 		sd->symm ^= SYMM_Z;
-		BIF_undo_push("Z Symmetry");
+		ED_undo_push(C, "Z Symmetry");
 		break;
 	case 11:
 	        if(v3d)
@@ -4786,11 +4785,11 @@
 		break;
 	case 12:
 		sd->flags ^= SCULPT_DRAW_FAST;
-		BIF_undo_push("Partial Redraw");
+		ED_undo_push(C, "Partial Redraw");
 		break;
 	case 13:
 		sd->flags ^= SCULPT_DRAW_BRUSH;
-		BIF_undo_push("Draw Brush");
+		ED_undo_push(C, "Draw Brush");
 		break;
 	case 14:
 		add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
@@ -4806,7 +4805,7 @@
 		break;
 	case 18:
 		br->dir= br->dir==1 ? 2 : 1;
-		BIF_undo_push("Add/Sub");
+		ED_undo_push(C, "Add/Sub");
 		break;
 	}
 
@@ -5364,7 +5363,7 @@
 				v3d->flag &= ~V3D_MODE;
 // XXX				exit_paint_modes();
 // XXX				enter_editmode(EM_WAITCURSOR);
-				BIF_undo_push("Original");	/* here, because all over code enter_editmode is abused */
+				ED_undo_push(C, "Original");	/* here, because all over code enter_editmode is abused */
 			}
 		} 
 		else if (v3d->modeselect == V3D_SCULPTMODE_SEL) {
@@ -5434,7 +5433,7 @@
 			scene->selectmode= SCE_SELECT_VERTEX;
 // XXX		EM_selectmode_set();
 		countall();
-		BIF_undo_push("Selectmode Set: Vertex");
+		ED_undo_push(C, "Selectmode Set: Vertex");
 		allqueue(REDRAWVIEW3D, 1);
 		allqueue(REDRAWIMAGE, 0); /* only needed in cases where mesh and UV selection are in sync */
 		break;
@@ -5447,7 +5446,7 @@
 		}
 // XXX		EM_selectmode_set();
 		countall();
-		BIF_undo_push("Selectmode Set: Edge");
+		ED_undo_push(C, "Selectmode Set: Edge");
 		allqueue(REDRAWVIEW3D, 1);
 		allqueue(REDRAWIMAGE, 0); /* only needed in cases where mesh and UV selection are in sync */
 		break;
@@ -5460,24 +5459,24 @@
 		}
 // XXX		EM_selectmode_set();
 		countall();
-		BIF_undo_push("Selectmode Set: Face");
+		ED_undo_push(C, "Selectmode Set: Face");
 		allqueue(REDRAWVIEW3D, 1);
 		allqueue(REDRAWIMAGE, 0); /* only needed in cases where mesh and UV selection are in sync */
 		break;	
 
 	case B_SEL_PATH:
 		scene->selectmode= SCE_SELECT_PATH;
-		BIF_undo_push("Selectmode Set: Path");
+		ED_undo_push(C, "Selectmode Set: Path");
 		allqueue(REDRAWVIEW3D, 1);
 		break;
 	case B_SEL_POINT:
 		scene->selectmode = SCE_SELECT_POINT;
-		BIF_undo_push("Selectmode Set: Point");
+		ED_undo_push(C, "Selectmode Set: Point");
 		allqueue(REDRAWVIEW3D, 1);
 		break;
 	case B_SEL_END:
 		scene->selectmode = SCE_SELECT_END;
-		BIF_undo_push("Selectmode Set: End point");
+		ED_undo_push(C, "Selectmode Set: End point");
 		allqueue(REDRAWVIEW3D, 1);
 		break;	
 	

Copied: branches/blender2.5/blender/source/blender/editors/util/editmode_undo.c (from rev 18176, trunk/blender/source/blender/src/editmode_undo.c)
===================================================================
--- branches/blender2.5/blender/source/blender/editors/util/editmode_undo.c	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/util/editmode_undo.c	2008-12-30 19:01:12 UTC (rev 18179)
@@ -0,0 +1,346 @@

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list