Undo for lattice editmode added.
This commit is contained in:
@@ -39,6 +39,7 @@ void load_editLatt(void);
|
|||||||
void remake_editLatt(void);
|
void remake_editLatt(void);
|
||||||
void deselectall_Latt(void);
|
void deselectall_Latt(void);
|
||||||
void mouse_lattice(void);
|
void mouse_lattice(void);
|
||||||
|
void undo_push_lattice(char *name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@@ -58,11 +59,12 @@
|
|||||||
#include "BKE_lattice.h"
|
#include "BKE_lattice.h"
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
|
|
||||||
#include "BIF_toolbox.h"
|
|
||||||
#include "BIF_space.h"
|
#include "BIF_space.h"
|
||||||
#include "BIF_screen.h"
|
#include "BIF_screen.h"
|
||||||
#include "BIF_editlattice.h"
|
#include "BIF_editlattice.h"
|
||||||
|
#include "BIF_editmode_undo.h"
|
||||||
#include "BIF_editkey.h"
|
#include "BIF_editkey.h"
|
||||||
|
#include "BIF_toolbox.h"
|
||||||
|
|
||||||
#include "BSE_edit.h"
|
#include "BSE_edit.h"
|
||||||
|
|
||||||
@@ -130,10 +132,10 @@ void make_editLatt(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
editLatt= MEM_dupallocN(lt);
|
editLatt= MEM_dupallocN(lt);
|
||||||
|
|
||||||
editLatt->def= MEM_dupallocN(lt->def);
|
editLatt->def= MEM_dupallocN(lt->def);
|
||||||
|
|
||||||
setflagsLatt(0);
|
setflagsLatt(0);
|
||||||
|
BIF_undo_push("original");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -199,6 +201,8 @@ void remake_editLatt(void)
|
|||||||
make_editLatt();
|
make_editLatt();
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
|
|
||||||
|
BIF_undo_push("Reload original");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -217,12 +221,15 @@ void deselectall_Latt(void)
|
|||||||
if(bp->hide==0) {
|
if(bp->hide==0) {
|
||||||
if(bp->f1) {
|
if(bp->f1) {
|
||||||
setflagsLatt(0);
|
setflagsLatt(0);
|
||||||
|
BIF_undo_push("(De)select all");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bp++;
|
bp++;
|
||||||
}
|
}
|
||||||
setflagsLatt(1);
|
setflagsLatt(1);
|
||||||
|
|
||||||
|
BIF_undo_push("(De)select all");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -285,8 +292,52 @@ void mouse_lattice(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
countall();
|
countall();
|
||||||
|
BIF_undo_push("Select");
|
||||||
}
|
}
|
||||||
|
|
||||||
rightmouse_transform();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***/
|
||||||
|
|||||||
@@ -636,6 +636,8 @@ void BIF_undo_push(char *str)
|
|||||||
undo_push_font(str);
|
undo_push_font(str);
|
||||||
else if (G.obedit->type==OB_MBALL)
|
else if (G.obedit->type==OB_MBALL)
|
||||||
undo_push_mball(str);
|
undo_push_mball(str);
|
||||||
|
else if (G.obedit->type==OB_LATTICE)
|
||||||
|
undo_push_lattice(str);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(U.uiflag & USER_GLOBALUNDO)
|
if(U.uiflag & USER_GLOBALUNDO)
|
||||||
@@ -646,7 +648,7 @@ void BIF_undo_push(char *str)
|
|||||||
void BIF_undo(void)
|
void BIF_undo(void)
|
||||||
{
|
{
|
||||||
if(G.obedit) {
|
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);
|
undo_editmode_step(1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -664,7 +666,7 @@ void BIF_undo(void)
|
|||||||
void BIF_redo(void)
|
void BIF_redo(void)
|
||||||
{
|
{
|
||||||
if(G.obedit) {
|
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);
|
undo_editmode_step(-1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -682,13 +684,8 @@ void BIF_redo(void)
|
|||||||
void BIF_undo_menu(void)
|
void BIF_undo_menu(void)
|
||||||
{
|
{
|
||||||
if(G.obedit) {
|
if(G.obedit) {
|
||||||
if(G.obedit->type==OB_MESH)
|
if ELEM6(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE)
|
||||||
undo_editmode_menu();
|
undo_editmode_menu();
|
||||||
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
|
|
||||||
undo_editmode_menu();
|
|
||||||
else if (G.obedit->type==OB_MBALL)
|
|
||||||
undo_editmode_menu();
|
|
||||||
|
|
||||||
allqueue(REDRAWALL, 0);
|
allqueue(REDRAWALL, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1516,13 +1513,11 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
}
|
}
|
||||||
else if(G.obedit->type==OB_ARMATURE)
|
else if(G.obedit->type==OB_ARMATURE)
|
||||||
remake_editArmature();
|
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();
|
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)
|
if (G.f & G_FACESELECT)
|
||||||
uv_autocalc_tface();
|
uv_autocalc_tface();
|
||||||
else if(G.f & G_WEIGHTPAINT)
|
else if(G.f & G_WEIGHTPAINT)
|
||||||
|
|||||||
Reference in New Issue
Block a user