diff options
author | Ton Roosendaal <ton@blender.org> | 2004-10-19 20:57:01 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-10-19 20:57:01 +0400 |
commit | 29ac3db7e8645c13eb844ad76cadc598bed483ea (patch) | |
tree | bc2d510b925eaed04d1324ec12a8cce4cbd5d337 /source/blender/src/editmode_undo.c | |
parent | 4c827e73e2714404a6066fd6f031811d3867e179 (diff) |
Two reported issues with undo #1667 and #1168
- press TAB without object active cleared undo stack
- typo (another!) in variable name, causing undo stack from wrong object
to be used (when have edited more objects)
Plus i found:
- rule for preserving editmode undo stacks, while using global undo, made
stricter now. Before it only checked name, now it checks for existance
of pointers extra.
Diffstat (limited to 'source/blender/src/editmode_undo.c')
-rw-r--r-- | source/blender/src/editmode_undo.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/source/blender/src/editmode_undo.c b/source/blender/src/editmode_undo.c index a89e7d0078a..1715b7382f7 100644 --- a/source/blender/src/editmode_undo.c +++ b/source/blender/src/editmode_undo.c @@ -53,10 +53,9 @@ #include "BKE_displist.h" #include "BKE_global.h" +#include "BKE_object.h" #include "BLI_blenlib.h" -#include "BLI_arithb.h" -#include "BLI_editVert.h" #include "BLI_dynstr.h" #include "BKE_utildefines.h" @@ -99,7 +98,8 @@ void undo_editmode_menu(void) // history menu #define MAXUNDONAME 64 typedef struct UndoElem { struct UndoElem *next, *prev; - ID id; // copy of editmode object ID + ID id; // copy of editmode object ID + Object *ob; // pointer to edited object void *undodata; char name[MAXUNDONAME]; void (*freedata)(void *); @@ -182,16 +182,31 @@ void undo_editmode_push(char *name, void (*freedata)(void *), static void undo_clean_stack(void) { UndoElem *uel, *next; - int mixed= 0; + int mixed= 0, checknames= 1; + + /* global undo changes pointers, so we also exceptionally allow identical names, + but not when this object pointer exists in the stack, which happens for + example when you rename objects and add new one with old name */ + for(uel= undobase.first; uel; uel= uel->next) { + if( exist_object(uel->ob)) break; + } + if(uel) checknames= 0; uel= undobase.first; while(uel) { next= uel->next; - if(strcmp(curundo->id.name, G.obedit->id.name)!=0) { - mixed= 1; - BLI_remlink(&undobase, uel); - uel->freedata(uel->undodata); - MEM_freeN(uel); + if(uel->ob != G.obedit) { + + /* for when global undo changes pointers... */ + if(checknames && strcmp(uel->id.name, G.obedit->id.name)==0) { + uel->ob= G.obedit; + } + else { + mixed= 1; + BLI_remlink(&undobase, uel); + uel->freedata(uel->undodata); + MEM_freeN(uel); + } } uel= next; } |