Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2011-02-27 09:19:40 +0300
committerJoseph Eagar <joeedh@gmail.com>2011-02-27 09:19:40 +0300
commitf01261d040be27337db9f9996d648a279c89b7c4 (patch)
treec448230939b3c90d53ce8852dd00925d6052e3a4 /source/blender/editors/util/editmode_undo.c
parentdcaeda5c4e3a0687251b8511de4f2e8b85ef75c0 (diff)
parent2198cfdb2deec8b2e85e242c74a032f43d0b26ca (diff)
merge with/from trunk at r35190
Diffstat (limited to 'source/blender/editors/util/editmode_undo.c')
-rw-r--r--source/blender/editors/util/editmode_undo.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 564439a7bb3..1e6f7cd8804 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -37,25 +37,29 @@
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
-#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_global.h"
+
+#include "ED_util.h"
#include "ED_mesh.h"
#include "UI_interface.h"
#include "UI_resources.h"
+#include "util_intern.h"
+
/* ***************** generic editmode undo system ********************* */
/*
Add this in your local code:
-void undo_editmode_push(bContext *C, char *name,
+void undo_editmode_push(bContext *C, const char *name,
void * (*getdata)(bContext *C), // use context to retrieve current editdata
void (*freedata)(void *), // pointer to function freeing data
void (*to_editmode)(void *, void *), // data to editmode conversion
@@ -74,7 +78,7 @@ void undo_editmode_menu(void) // history menu
/* ********************************************************************* */
/* ****** XXX ***** */
-void error(const char *dummy) {}
+static void error(const char *UNUSED(arg)) {}
/* ****** XXX ***** */
@@ -108,7 +112,7 @@ static void undo_restore(UndoElem *undo, void *editdata, void *obdata)
}
/* name can be a dynamic string */
-void undo_editmode_push(bContext *C, char *name,
+void undo_editmode_push(bContext *C, const char *name,
void * (*getdata)(bContext *C),
void (*freedata)(void *),
void (*to_editmode)(void *, void *, void *),
@@ -268,7 +272,7 @@ void undo_editmode_step(bContext *C, int step)
EDBM_selectmode_to_scene(CTX_data_scene(C), obedit);
}
- DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
/* XXX notifiers */
}
@@ -313,6 +317,20 @@ void undo_editmode_name(bContext *C, const char *undoname)
}
}
+/* undoname optionally, if NULL it just checks for existing undo steps */
+int undo_editmode_valid(const char *undoname)
+{
+ if(undoname) {
+ UndoElem *uel;
+
+ for(uel= undobase.last; uel; uel= uel->prev) {
+ if(strcmp(undoname, uel->name)==0)
+ break;
+ }
+ return uel != NULL;
+ }
+ return undobase.last != undobase.first;
+}
/* ************** for interaction with menu/pullown */
@@ -341,7 +359,7 @@ void undo_editmode_menu(bContext *C)
if(event>0) undo_number(C, event);
}
-static void do_editmode_undohistorymenu(bContext *C, void *arg, int event)
+static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event)
{
Object *obedit= CTX_data_edit_object(C);
@@ -351,7 +369,7 @@ static void do_editmode_undohistorymenu(bContext *C, void *arg, int event)
}
-uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *arg_unused)
+uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg))
{
uiBlock *block;
UndoElem *uel;