[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35045] trunk/blender/source/blender/ editors: operator ED_OT_undo_push, needed for editmode undo/redo glitch fix , (coming next).

Campbell Barton ideasman42 at gmail.com
Tue Feb 22 03:42:19 CET 2011


Revision: 35045
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35045
Author:   campbellbarton
Date:     2011-02-22 02:42:19 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
operator ED_OT_undo_push, needed for editmode undo/redo glitch fix, (coming next).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_util.h
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/editors/util/undo.c

Modified: trunk/blender/source/blender/editors/include/ED_util.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_util.h	2011-02-22 01:43:08 UTC (rev 35044)
+++ trunk/blender/source/blender/editors/include/ED_util.h	2011-02-22 02:42:19 UTC (rev 35045)
@@ -57,6 +57,7 @@
 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);

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2011-02-22 01:43:08 UTC (rev 35044)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2011-02-22 02:42:19 UTC (rev 35045)
@@ -3075,6 +3075,7 @@
 	
 	/* 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);	
 	
 }

Modified: trunk/blender/source/blender/editors/util/undo.c
===================================================================
--- trunk/blender/source/blender/editors/util/undo.c	2011-02-22 01:43:08 UTC (rev 35044)
+++ trunk/blender/source/blender/editors/util/undo.c	2011-02-22 02:42:19 UTC (rev 35045)
@@ -60,9 +60,13 @@
 #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 @@
 	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 @@
 	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 */




More information about the Bf-blender-cvs mailing list