operator ED_OT_undo_push, needed for editmode undo/redo glitch fix, (coming next).
authorCampbell Barton <ideasman42@gmail.com>
Tue, 22 Feb 2011 02:42:19 +0000 (02:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 22 Feb 2011 02:42:19 +0000 (02:42 +0000)
source/blender/editors/include/ED_util.h
source/blender/editors/screen/screen_ops.c
source/blender/editors/util/undo.c

index 6943772e6ff446d56a13739b838598c7aac12c05..77b754519fb171271fef69288745e6c513dcebad 100644 (file)
@@ -57,6 +57,7 @@ void  ED_undo_pop_op                  (struct bContext *C, struct wmOperator *op);
 void   ED_undo_pop                             (struct bContext *C);
 void   ED_undo_redo                    (struct bContext *C);
 void   ED_OT_undo                              (struct wmOperatorType *ot);
+void   ED_OT_undo_push                 (struct wmOperatorType *ot);
 void   ED_OT_redo                              (struct wmOperatorType *ot);
 
 int            ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op);
index 33c1fce48726885312dbcc3661a50f45508c0f76..1bc485c645a64ad9be1dc5e0a5af788e9ab9034f 100644 (file)
@@ -3075,6 +3075,7 @@ void ED_operatortypes_screen(void)
        
        /* tools shared by more space types */
        WM_operatortype_append(ED_OT_undo);
+       WM_operatortype_append(ED_OT_undo_push);
        WM_operatortype_append(ED_OT_redo);     
        
 }
index a992e33e7d6b2e5326e7a4aec2b962d087c9f728..c32946576356cc1e758f4b081dc63c8c4a1b53cd 100644 (file)
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "RNA_access.h"
+#include "RNA_define.h"
 
 #include "util_intern.h"
 
+#define MAXUNDONAME 64 /* XXX, make common define */
+
 /* ***************** generic undo system ********************* */
 
 void ED_undo_push(bContext *C, const char *str)
@@ -252,6 +256,14 @@ static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op))
        return ed_undo_step(C, 1, NULL);
 }
 
+static int ed_undo_push_exec(bContext *C, wmOperator *op)
+{
+       char str[MAXUNDONAME];
+       RNA_string_get(op->ptr, "message", str);
+       ED_undo_push(C, str);
+       return OPERATOR_FINISHED;
+}
+
 static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op))
 {
        return ed_undo_step(C, -1, NULL);
@@ -298,6 +310,19 @@ void ED_OT_undo(wmOperatorType *ot)
        ot->poll= ED_operator_screenactive;
 }
 
+void ED_OT_undo_push(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Undo Push";
+       ot->description= "Add an undo state (internal use only)";
+       ot->idname= "ED_OT_undo_push";
+       
+       /* api callbacks */
+       ot->exec= ed_undo_push_exec;
+
+       RNA_def_string(ot->srna, "message", "Add an undo step *function may be moved*", MAXUNDONAME, "Undo Message", "");
+}
+
 void ED_OT_redo(wmOperatorType *ot)
 {
        /* identifiers */