Fix #19802: tweaking the values of e.g. the add tube operator when
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 26 Jan 2010 15:54:42 +0000 (15:54 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 26 Jan 2010 15:54:42 +0000 (15:54 +0000)
entering editmode on a second mesh would create a duplicate tube.

Cleaning the undo stack from the previous mesh would mess up the redo.
Also, OBJECT_OT_mode_set was causing enter/exit editmode undo push to
be done twice, now it leaves undo push to the operator it calls.

source/blender/editors/object/object_edit.c
source/blender/editors/util/editmode_undo.c

index 4c97bf934c19257c0264ffd290ae32a0024ec65e..297951d283fee4dbc33a6660dea4b03e9c270d4d 100644 (file)
@@ -2077,7 +2077,7 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
        ot->poll= ED_operator_object_active_editable;
        
        /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag= 0; /* no register/undo here, leave it to operators being called */
        
        prop= RNA_def_enum(ot->srna, "mode", object_mode_items, OB_MODE_OBJECT, "Mode", "");
        RNA_def_enum_funcs(prop, object_mode_set_itemsf);
index 5fb93b0f8ec36cf17c7ececed4b50af8612a7b77..a21ff088f2e36f9bc3a4c4a8dc8616eddfc91799 100644 (file)
@@ -203,7 +203,6 @@ static void undo_clean_stack(bContext *C)
 {
        UndoElem *uel, *next;
        Object *obedit= CTX_data_edit_object(C);
-       int mixed= 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 */
@@ -226,7 +225,9 @@ static void undo_clean_stack(bContext *C)
                if(isvalid) 
                        uel->ob= obedit;
                else {
-                       mixed= 1;
+                       if(uel == curundo)
+                               curundo= NULL;
+
                        uel->freedata(uel->undodata);
                        BLI_freelinkN(&undobase, uel);
                }
@@ -234,7 +235,7 @@ static void undo_clean_stack(bContext *C)
                uel= next;
        }
        
-       if(mixed) curundo= undobase.last;
+       if(curundo == NULL) curundo= undobase.last;
 }
 
 /* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */