Fix for #1666
There's a conflict between global undo and editmode undo. The first one reloads a .blend actually, so pointers change all over. The latter still uses the object pointers for checks. To resolve that the editmode undo system cleans its stack based on object names, not pointers. In previous code I tried something smart to prevent undo stacks being reused when you delete an object, and add new object with same name. That didn't go OK in all cases... so I accept this little quirk for now (rename object still works though, wont clean the undo stack)
This commit is contained in:
@@ -133,7 +133,7 @@ void undo_editmode_push(char *name, void (*freedata)(void *),
|
||||
|
||||
/* prevent two same undocalls */
|
||||
if(curundo && strcmp("Original", name)==0) {
|
||||
if( strcmp(curundo->id.name, G.obedit->id.name)==0 ) {
|
||||
if( curundo->ob==G.obedit ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -184,13 +184,8 @@ static void undo_clean_stack(void)
|
||||
UndoElem *uel, *next;
|
||||
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;
|
||||
/* global undo changes pointers, so we also allow identical names */
|
||||
/* side effect: when deleting/renaming object and start editing new one with same name */
|
||||
|
||||
uel= undobase.first;
|
||||
while(uel) {
|
||||
|
||||
Reference in New Issue
Block a user