Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-09-18 16:12:45 +0400
committerTon Roosendaal <ton@blender.org>2004-09-18 16:12:45 +0400
commit562d6958cbf646aba31ed92fe4f0e07d1dc495b6 (patch)
tree31de7ac4e7df2e56d269b14e336a04a2e1316f82 /source/blender/blenloader
parent3d8a485fb9bef36f717423955c587ebc7834c784 (diff)
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!)
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/blenloader/intern/undofile.c148
2 files changed, 1 insertions, 149 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a9a5b16b462..f75af94ea4f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2720,7 +2720,7 @@ void lib_link_screen_restore(Main *newmain, char mode, Scene *curscene)
}
else if(sl->spacetype==SPACE_IMASEL) {
- check_imasel_copy((SpaceImaSel *)sl);
+ ;
}
else if(sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)sl;
diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c
index 25ed891f0a4..af278c89133 100644
--- a/source/blender/blenloader/intern/undofile.c
+++ b/source/blender/blenloader/intern/undofile.c
@@ -148,151 +148,3 @@ void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned in
}
}
-/* ***************** GLOBAL UNDO *************** */
-
-#define UNDO_DISK 0
-
-#define MAXUNDONAME 64
-typedef struct UndoElem {
- struct UndoElem *next, *prev;
- char str[FILE_MAXDIR+FILE_MAXFILE];
- char name[MAXUNDONAME];
- MemFile memfile;
-} UndoElem;
-
-#define MAXUNDO 32
-static ListBase undobase={NULL, NULL};
-static UndoElem *curundo= NULL;
-
-
-static int read_undosave(UndoElem *uel)
-{
- char scestr[FILE_MAXDIR+FILE_MAXFILE];
- int success=0, fileflags;
-
- strcpy(scestr, G.sce); /* temporal store */
- fileflags= G.fileflags;
- G.fileflags |= G_FILE_NO_UI;
-
- if(UNDO_DISK)
- success= BKE_read_file(uel->str, NULL);
- else
- success= BKE_read_file_from_memfile(&uel->memfile);
-
- /* restore */
- strcpy(G.sce, scestr);
- G.fileflags= fileflags;
-
- return success;
-}
-
-/* name can be a dynamic string */
-void BIF_write_undo(char *name)
-{
- int nr, success;
- UndoElem *uel;
-
- if( (U.uiflag & USER_GLOBALUNDO)==0) return;
-
- /* remove all undos after (also when curundo==NULL) */
- while(undobase.last != curundo) {
- uel= undobase.last;
- BLI_remlink(&undobase, uel);
- BLO_free_memfile(&uel->memfile);
- MEM_freeN(uel);
- }
-
- /* make new */
- curundo= uel= MEM_callocN(sizeof(UndoElem), "undo file");
- strncpy(uel->name, name, MAXUNDONAME-1);
- BLI_addtail(&undobase, uel);
-
- /* and limit amount to the maximum */
- nr= 0;
- uel= undobase.last;
- while(uel) {
- nr++;
- if(nr==MAXUNDO) break;
- uel= uel->prev;
- }
- if(uel) {
- while(undobase.first!=uel) {
- UndoElem *first= undobase.first;
- BLI_remlink(&undobase, first);
- /* the merge is because of compression */
- BLO_merge_memfile(&first->memfile, &first->next->memfile);
- MEM_freeN(first);
- }
- }
-
-
- /* disk save version */
- if(UNDO_DISK) {
- static int counter= 0;
- char *err, tstr[FILE_MAXDIR+FILE_MAXFILE];
- char numstr[32];
-
- /* calculate current filename */
- counter++;
- counter= counter % MAXUNDO;
-
- sprintf(numstr, "%d.blend", counter);
- BLI_make_file_string("/", tstr, U.tempdir, numstr);
-
- success= BLO_write_file(tstr, G.fileflags, &err);
-
- strcpy(curundo->str, tstr);
- }
- else {
- MemFile *prevfile=NULL;
- char *err;
-
- if(curundo->prev) prevfile= &(curundo->prev->memfile);
-
- success= BLO_write_file_mem(prevfile, &curundo->memfile, G.fileflags, &err);
-
- }
-}
-
-/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
-void BIF_undo_step(int step)
-{
-
- if(step==1) {
- /* curundo should never be NULL, after restart or load file it should call undo_save */
- if(curundo==NULL || curundo->prev==NULL) error("No undo available");
- else {
- printf("undo %s\n", curundo->name);
- curundo= curundo->prev;
- read_undosave(curundo);
- }
- }
- else {
-
- /* curundo has to remain current situation! */
-
- if(curundo==NULL || curundo->next==NULL) error("No redo available");
- else {
- read_undosave(curundo->next);
- curundo= curundo->next;
- printf("redo %s\n", curundo->name);
- }
- }
-}
-
-void BIF_reset_undo(void)
-{
- UndoElem *uel;
-
- uel= undobase.first;
- while(uel) {
- BLO_free_memfile(&uel->memfile);
- uel= uel->next;
- }
-
- BLI_freelistN(&undobase);
- curundo= NULL;
-}
-
-
-