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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-11-08 00:14:21 +0300
committerTon Roosendaal <ton@blender.org>2004-11-08 00:14:21 +0300
commitfcd0a3f9d2971d76e8bea5f32f358780781a15b7 (patch)
tree4e522f39689b23e1d445a2cc6c61c3d8c4051b80 /source
parentb6e037049b5bca85af8862755eef7143569f77b2 (diff)
Undo for lattice editmode added.
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_editlattice.h1
-rw-r--r--source/blender/src/editlattice.c55
-rw-r--r--source/blender/src/space.c19
3 files changed, 61 insertions, 14 deletions
diff --git a/source/blender/include/BIF_editlattice.h b/source/blender/include/BIF_editlattice.h
index c882013576d..c7cf6c570ac 100644
--- a/source/blender/include/BIF_editlattice.h
+++ b/source/blender/include/BIF_editlattice.h
@@ -39,6 +39,7 @@ void load_editLatt(void);
void remake_editLatt(void);
void deselectall_Latt(void);
void mouse_lattice(void);
+void undo_push_lattice(char *name);
#endif
diff --git a/source/blender/src/editlattice.c b/source/blender/src/editlattice.c
index 18bed249da4..581278809d8 100644
--- a/source/blender/src/editlattice.c
+++ b/source/blender/src/editlattice.c
@@ -32,6 +32,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include <math.h>
#ifdef HAVE_CONFIG_H
@@ -58,11 +59,12 @@
#include "BKE_lattice.h"
#include "BKE_global.h"
-#include "BIF_toolbox.h"
#include "BIF_space.h"
#include "BIF_screen.h"
#include "BIF_editlattice.h"
+#include "BIF_editmode_undo.h"
#include "BIF_editkey.h"
+#include "BIF_toolbox.h"
#include "BSE_edit.h"
@@ -130,10 +132,10 @@ void make_editLatt(void)
}
editLatt= MEM_dupallocN(lt);
-
editLatt->def= MEM_dupallocN(lt->def);
setflagsLatt(0);
+ BIF_undo_push("original");
}
@@ -199,6 +201,8 @@ void remake_editLatt(void)
make_editLatt();
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
+
+ BIF_undo_push("Reload original");
}
@@ -217,12 +221,15 @@ void deselectall_Latt(void)
if(bp->hide==0) {
if(bp->f1) {
setflagsLatt(0);
+ BIF_undo_push("(De)select all");
return;
}
}
bp++;
}
setflagsLatt(1);
+
+ BIF_undo_push("(De)select all");
}
@@ -285,8 +292,52 @@ void mouse_lattice(void)
}
countall();
+ BIF_undo_push("Select");
}
rightmouse_transform();
}
+
+
+/* **************** undo for lattice object ************** */
+
+static void undoLatt_to_editLatt(void *defv)
+{
+ Base *base;
+ int a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
+
+ memcpy(editLatt->def, defv, a*sizeof(BPoint));
+
+ base= FIRSTBASE;
+ while(base) {
+ if(base->lay & G.vd->lay) {
+ if(base->object->parent==G.obedit) {
+ makeDispList(base->object);
+ }
+ }
+ base= base->next;
+ }
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+static void *editLatt_to_undoLatt(void)
+{
+
+ return MEM_dupallocN(editLatt->def);
+}
+
+static void free_undoLatt(void *defv)
+{
+ MEM_freeN(defv);
+}
+
+/* and this is all the undo system needs to know */
+void undo_push_lattice(char *name)
+{
+ undo_editmode_push(name, free_undoLatt, undoLatt_to_editLatt, editLatt_to_undoLatt);
+}
+
+
+
+/***/
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 6229e17af19..fa5a762d56c 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -636,6 +636,8 @@ void BIF_undo_push(char *str)
undo_push_font(str);
else if (G.obedit->type==OB_MBALL)
undo_push_mball(str);
+ else if (G.obedit->type==OB_LATTICE)
+ undo_push_lattice(str);
}
else {
if(U.uiflag & USER_GLOBALUNDO)
@@ -646,7 +648,7 @@ void BIF_undo_push(char *str)
void BIF_undo(void)
{
if(G.obedit) {
- if ELEM5(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL)
+ if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE)
undo_editmode_step(1);
}
else {
@@ -664,7 +666,7 @@ void BIF_undo(void)
void BIF_redo(void)
{
if(G.obedit) {
- if ELEM5(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL)
+ if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE)
undo_editmode_step(-1);
}
else {
@@ -682,13 +684,8 @@ void BIF_redo(void)
void BIF_undo_menu(void)
{
if(G.obedit) {
- if(G.obedit->type==OB_MESH)
- undo_editmode_menu();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
- undo_editmode_menu();
- else if (G.obedit->type==OB_MBALL)
+ if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE)
undo_editmode_menu();
-
allqueue(REDRAWALL, 0);
}
else {
@@ -1516,13 +1513,11 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
else if(G.obedit->type==OB_ARMATURE)
remake_editArmature();
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
+ else if ELEM4(G.obedit->type, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE) {
if(G.qual==0) BIF_undo(); else BIF_redo();
}
- else if(G.obedit->type==OB_LATTICE)
- remake_editLatt();
}
- else if((G.qual==0)){
+ else if((G.qual==0)) {
if (G.f & G_FACESELECT)
uv_autocalc_tface();
else if(G.f & G_WEIGHTPAINT)