Another step in the undo evolution.

- Made unified API for undo calls, to be found in space.c
  BIF_undo_push(char *str)
  BIF_undo(void)
  BIF_redo(void)
  These calls will do all undo levels, including editmode and vpaint.

  The transition is work in progress, because mesh undo needs recode.

- New global hotkey CTR+Z for undo
  Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
  the lighting in shaded mode, which already became much more interactive,
  like during/after any transform().
  Recalc hotkey now is SHIFT+ALT+Z

  CTRL+<any modifier>+Z is redo.

- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
  disables the one-mouse-button hack for rightmouse btw, will be fixed in
  next commit. At least we can use Apple-Z :)

- Old Ukey for undo is still there, as a training period... my preference is
  to restore Ukey to "reload original data" as in past, and only use new
  CTRL+Z for undo.

- Added undo_push() for all of editobject.c and editview.c. Meaning we can
  start using/testing global undo in the 3d window. Please dont comment on
  missing parts for now, first I want someone to volunteer to tackle all of
  that.

- Since the global undo has a full 'file' in memory, it can save extremely
  fast on exit to <temp dir>/quit.blend. That's default now when global undo
  is enabled. It prints "Saved session recovery to ..." in console then.

- In file menu, a new option is added "Recover Last Session". Note that this
  reads the undo-save, which is without UI.

- With such nice new features we then can also kill the disputed
  Cancel/Confirm menu on Q-KEY.

- Added fix which initializes seam/normal theme color on saved themes.
  They showed black now.... (Note: that's in usiblender.c!)
This commit is contained in:
2004-09-18 12:12:45 +00:00
parent 3d8a485fb9
commit 562d6958cb
20 changed files with 521 additions and 386 deletions

View File

@@ -620,18 +620,87 @@ static unsigned short convert_for_nonumpad(unsigned short event)
/* *************** */
void BIF_undo()
void BIF_undo_push(char *str)
{
if(G.obedit) {
if(G.obedit->type==OB_MESH)
undo_push_mesh(str);
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
undo_push_curve(str);
}
else {
if(U.uiflag & USER_GLOBALUNDO)
BKE_write_undo(str);
}
}
void BIF_redo()
void BIF_undo(void)
{
extern void undo_curve_step(int step); // editcurve.c
if(G.obedit) {
if(G.obedit->type==OB_MESH)
undo_pop_mesh(1);
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
undo_curve_step(1);
}
else {
if (G.f & G_FACESELECT)
;
else if(G.f & G_WEIGHTPAINT)
wpaint_undo();
else if(G.f & G_VERTEXPAINT)
vpaint_undo();
else {
if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(1);
}
}
}
void BIF_undo_menu()
void BIF_redo(void)
{
extern void undo_curve_step(int step); // editcurve.c
if(G.obedit) {
if(G.obedit->type==OB_MESH)
undo_redo_mesh();
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
undo_curve_step(-1);
}
else {
if (G.f & G_FACESELECT)
;
else if(G.f & G_WEIGHTPAINT)
wpaint_undo();
else if(G.f & G_VERTEXPAINT)
vpaint_undo();
else {
if(U.uiflag & USER_GLOBALUNDO) BKE_undo_step(-1);
}
}
}
void BIF_undo_menu(void)
{
if(G.obedit) {
if(G.obedit->type==OB_MESH)
undo_menu_mesh();
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
;//undo_menu_curve();
}
else {
if (G.f & G_FACESELECT)
;
else if(G.f & G_WEIGHTPAINT)
;
else if(G.f & G_VERTEXPAINT)
;
else {
if(U.uiflag & USER_GLOBALUNDO) BKE_undo_menu();
}
}
}
@@ -1469,12 +1538,12 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if(G.f & G_VERTEXPAINT)
vpaint_undo();
else {
if(U.uiflag & USER_GLOBALUNDO) BIF_undo_step(1);
if(U.uiflag & USER_GLOBALUNDO) BIF_undo();
else single_user();
}
}
else if(G.qual==LR_SHIFTKEY)
if(U.uiflag & USER_GLOBALUNDO) BIF_undo_step(-1);
if(U.uiflag & USER_GLOBALUNDO) BIF_redo();
break;
case VKEY:
@@ -1536,7 +1605,6 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
scrarea_queue_headredraw(curarea);
scrarea_queue_winredraw(curarea);
break;
case HOMEKEY:
if(G.qual==0)