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:
authorSergey Sharybin <sergey.vfx@gmail.com>2010-08-10 10:36:42 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2010-08-10 10:36:42 +0400
commitc0e39df6ac42d137fd51eeea463aace856bf97d4 (patch)
tree86be54ecb6f01b8192905a05707b12402970d5a4
parent41531e4fb6547df543a80d62b473c250d5b78753 (diff)
- Enable shape key switching in edit mode for curves, surfaces and latticies
- Disable changing of lattice size if there are shape keys
-rw-r--r--source/blender/blenkernel/intern/lattice.c18
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/editors/curve/editcurve.c7
-rw-r--r--source/blender/editors/include/ED_lattice.h33
-rw-r--r--source/blender/editors/interface/interface_templates.c6
-rw-r--r--source/blender/editors/object/object_edit.c8
-rw-r--r--source/blender/editors/object/object_hook.c11
-rw-r--r--source/blender/editors/object/object_intern.h5
-rw-r--r--source/blender/editors/object/object_lattice.c116
-rw-r--r--source/blender/editors/object/object_relations.c4
-rw-r--r--source/blender/editors/object/object_vgroup.c6
-rw-r--r--source/blender/editors/space_info/info_stats.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c8
-rw-r--r--source/blender/editors/transform/transform_conversions.c2
-rw-r--r--source/blender/editors/transform/transform_generics.c2
-rw-r--r--source/blender/editors/transform/transform_manipulator.c4
-rw-r--r--source/blender/makesdna/DNA_curve_types.h5
-rw-r--r--source/blender/makesdna/DNA_lattice_types.h10
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c44
-rw-r--r--source/blender/makesrna/intern/rna_object.c22
22 files changed, 206 insertions, 123 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 1eb7b5d2021..1390f0dbd56 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -225,8 +225,12 @@ void free_lattice(Lattice *lt)
if(lt->def) MEM_freeN(lt->def);
if(lt->dvert) free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
if(lt->editlatt) {
- if(lt->editlatt->def) MEM_freeN(lt->editlatt->def);
- if(lt->editlatt->dvert) free_dverts(lt->editlatt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
+ Lattice *editlt= lt->editlatt->latt;
+
+ if(editlt->def) MEM_freeN(editlt->def);
+ if(editlt->dvert) free_dverts(editlt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
+
+ MEM_freeN(editlt);
MEM_freeN(lt->editlatt);
}
}
@@ -295,7 +299,7 @@ void init_latt_deform(Object *oblatt, Object *ob)
float fu, fv, fw;
int u, v, w;
- if(lt->editlatt) lt= lt->editlatt;
+ if(lt->editlatt) lt= lt->editlatt->latt;
bp = lt->def;
fp= lt->latticedata= MEM_mallocN(sizeof(float)*3*lt->pntsu*lt->pntsv*lt->pntsw, "latticedata");
@@ -350,7 +354,7 @@ void calc_latt_deform(Object *ob, float *co, float weight)
MDeformVert *dvert= lattice_get_deform_verts(ob);
- if(lt->editlatt) lt= lt->editlatt;
+ if(lt->editlatt) lt= lt->editlatt->latt;
if(lt->latticedata==NULL) return;
if(lt->vgroup[0] && dvert) {
@@ -446,7 +450,7 @@ void end_latt_deform(Object *ob)
{
Lattice *lt= ob->data;
- if(lt->editlatt) lt= lt->editlatt;
+ if(lt->editlatt) lt= lt->editlatt->latt;
if(lt->latticedata)
MEM_freeN(lt->latticedata);
@@ -1002,7 +1006,7 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]
int i, numVerts;
float (*vertexCos)[3];
- if(lt->editlatt) lt= lt->editlatt;
+ if(lt->editlatt) lt= lt->editlatt->latt;
numVerts = *numVerts_r = lt->pntsu*lt->pntsv*lt->pntsw;
vertexCos = MEM_mallocN(sizeof(*vertexCos)*numVerts,"lt_vcos");
@@ -1066,7 +1070,7 @@ struct MDeformVert* lattice_get_deform_verts(struct Object *oblatt)
if(oblatt->type == OB_LATTICE)
{
Lattice *lt = (Lattice*)oblatt->data;
- if(lt->editlatt) lt= lt->editlatt;
+ if(lt->editlatt) lt= lt->editlatt->latt;
return lt->dvert;
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index c08a3408505..18eedd63906 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1917,7 +1917,7 @@ static void give_parvert(Object *par, int nr, float *vec)
DispList *dl = find_displist(&par->disp, DL_VERTS);
float *co = dl?dl->verts:NULL;
- if(latt->editlatt) latt= latt->editlatt;
+ if(latt->editlatt) latt= latt->editlatt->latt;
a= latt->pntsu*latt->pntsv*latt->pntsw;
count= 0;
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 7150070dd65..b85429e36a9 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -724,7 +724,7 @@ static void calc_shapeKeys(Object *obedit)
int a, i, j;
EditNurb *editnurb= cu->editnurb;
KeyBlock *currkey;
- KeyBlock *actkey= ob_get_keyblock(obedit);
+ KeyBlock *actkey= BLI_findlink(&cu->key->block, editnurb->shapenr-1);
BezTriple *bezt, *oldbezt;
BPoint *bp, *oldbp;
Nurb *nu;
@@ -738,7 +738,7 @@ static void calc_shapeKeys(Object *obedit)
int act_is_basis = 0;
/* find if this key is a basis for any others */
for(currkey = cu->key->block.first; currkey; currkey= currkey->next) {
- if(obedit->shapenr-1 == currkey->relative) {
+ if(editnurb->shapenr-1 == currkey->relative) {
act_is_basis = 1;
break;
}
@@ -806,7 +806,7 @@ static void calc_shapeKeys(Object *obedit)
currkey = cu->key->block.first;
while(currkey) {
- int apply_offset = (ofs && (currkey != actkey) && (obedit->shapenr-1 == currkey->relative));
+ int apply_offset = (ofs && (currkey != actkey) && (editnurb->shapenr-1 == currkey->relative));
fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data");
ofp= oldkey = currkey->data;
@@ -1035,6 +1035,7 @@ void make_editNurb(Object *obedit)
}
if(actkey) {
+ editnurb->shapenr= obedit->shapenr;
init_editNurb_keyIndex(editnurb, &cu->nurb);
}
}
diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h
new file mode 100644
index 00000000000..bebd6c5f3ab
--- /dev/null
+++ b/source/blender/editors/include/ED_lattice.h
@@ -0,0 +1,33 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+struct Object;
+
+void free_editLatt(struct Object *ob);
+void make_editLatt(struct Object *obedit);
+void load_editLatt(struct Object *obedit);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index bebec77ce1a..eb99a45d62d 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2097,12 +2097,6 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* list item behind label & other buttons */
sub= uiLayoutRow(overlap, 0);
- if(itemptr->type == &RNA_ShapeKey) {
- ob= (Object*)activeptr->data;
- if(ob->mode == OB_MODE_EDIT && !(ob->type == OB_MESH))
- uiLayoutSetEnabled(sub, 0);
- }
-
but= uiDefButR(block, LISTROW, 0, "", 0,0, UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index f7bde077740..36879e43fe2 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -78,6 +78,7 @@
#include "ED_curve.h"
#include "ED_mesh.h"
#include "ED_mball.h"
+#include "ED_lattice.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_util.h"
@@ -938,14 +939,15 @@ void special_editmenu(Scene *scene, View3D *v3d)
static float weight= 1.0f;
{ // XXX
// XXX if(fbutton(&weight, 0.0f, 1.0f, 10, 10, "Set Weight")) {
- int a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
- BPoint *bp= lt->editlatt->def;
+ Lattice *editlt= lt->editlatt->latt;
+ int a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
+ BPoint *bp= editlt->def;
while(a--) {
if(bp->f1 & SELECT)
bp->weight= weight;
bp++;
- }
+ }
}
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 2ee82a194cc..75e22d5356f 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -191,13 +191,14 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
{
- Lattice *lt= obedit->data;
+ Lattice *lt= obedit->data, *editlt;
BPoint *bp;
int index=0, nr=0, a;
-
+
+ editlt= lt->editlatt->latt;
/* count */
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
- bp= lt->editlatt->def;
+ a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
+ bp= editlt->def;
while(a--) {
if(hmd->indexar[index]==nr) {
bp->f1 |= SELECT;
@@ -313,7 +314,7 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
case OB_LATTICE:
{
Lattice *lt= obedit->data;
- return return_editlattice_indexar(lt->editlatt, tot, indexar, cent_r);
+ return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r);
}
default:
return 0;
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index bd48db2f780..ed75c4060a2 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -131,11 +131,6 @@ void OBJECT_OT_hook_reset(struct wmOperatorType *ot);
void OBJECT_OT_hook_recenter(struct wmOperatorType *ot);
/* object_lattice.c */
-void free_editLatt(struct Object *ob);
-void make_editLatt(struct Object *obedit);
-void load_editLatt(struct Object *obedit);
-void remake_editLatt(struct Object *obedit);
-
void LATTICE_OT_select_all(struct wmOperatorType *ot);
void LATTICE_OT_make_regular(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index a1fb10e350e..9f82a1209cf 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -46,6 +46,8 @@
#include "BKE_lattice.h"
#include "BKE_mesh.h"
+#include "BLI_listbase.h"
+
#include "ED_screen.h"
#include "ED_view3d.h"
#include "ED_util.h"
@@ -62,12 +64,16 @@ void free_editLatt(Object *ob)
Lattice *lt= ob->data;
if(lt->editlatt) {
- if(lt->editlatt->def)
- MEM_freeN(lt->editlatt->def);
- if(lt->editlatt->dvert)
- free_dverts(lt->editlatt->dvert, lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw);
-
+ Lattice *editlt= lt->editlatt->latt;
+
+ if(editlt->def)
+ MEM_freeN(editlt->def);
+ if(editlt->dvert)
+ free_dverts(editlt->dvert, editlt->pntsu*editlt->pntsv*editlt->pntsw);
+
+ MEM_freeN(editlt);
MEM_freeN(lt->editlatt);
+
lt->editlatt= NULL;
}
}
@@ -76,47 +82,51 @@ void make_editLatt(Object *obedit)
{
Lattice *lt= obedit->data;
KeyBlock *actkey;
-
+
free_editLatt(obedit);
-
+
lt= obedit->data;
actkey= ob_get_keyblock(obedit);
if(actkey)
key_to_latt(actkey, lt);
- lt->editlatt= MEM_dupallocN(lt);
- lt->editlatt->def= MEM_dupallocN(lt->def);
-
+ lt->editlatt= MEM_callocN(sizeof(EditLatt), "editlatt");
+ lt->editlatt->latt= MEM_dupallocN(lt);
+ lt->editlatt->latt->def= MEM_dupallocN(lt->def);
+
if(lt->dvert) {
int tot= lt->pntsu*lt->pntsv*lt->pntsw;
- lt->editlatt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
- copy_dverts(lt->editlatt->dvert, lt->dvert, tot);
+ lt->editlatt->latt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
+ copy_dverts(lt->editlatt->latt->dvert, lt->dvert, tot);
}
+
+ if(lt->key) lt->editlatt->shapenr= obedit->shapenr;
}
void load_editLatt(Object *obedit)
{
- Lattice *lt;
+ Lattice *lt, *editlt;
KeyBlock *actkey;
BPoint *bp;
float *fp;
int tot;
-
+
lt= obedit->data;
-
- actkey= ob_get_keyblock(obedit);
+ editlt= lt->editlatt->latt;
+
+ if(lt->editlatt->shapenr) {
+ actkey= BLI_findlink(&lt->key->block, lt->editlatt->shapenr-1);
- if(actkey) {
/* active key: vertices */
- tot= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+ tot= editlt->pntsu*editlt->pntsv*editlt->pntsw;
if(actkey->data) MEM_freeN(actkey->data);
fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data");
actkey->totelem= tot;
-
- bp= lt->editlatt->def;
+
+ bp= editlt->def;
while(tot--) {
VECCOPY(fp, bp->vec);
fp+= 3;
@@ -125,30 +135,30 @@ void load_editLatt(Object *obedit)
}
else {
MEM_freeN(lt->def);
-
- lt->def= MEM_dupallocN(lt->editlatt->def);
- lt->flag= lt->editlatt->flag;
+ lt->def= MEM_dupallocN(editlt->def);
- lt->pntsu= lt->editlatt->pntsu;
- lt->pntsv= lt->editlatt->pntsv;
- lt->pntsw= lt->editlatt->pntsw;
+ lt->flag= editlt->flag;
+
+ lt->pntsu= editlt->pntsu;
+ lt->pntsv= editlt->pntsv;
+ lt->pntsw= editlt->pntsw;
- lt->typeu= lt->editlatt->typeu;
- lt->typev= lt->editlatt->typev;
- lt->typew= lt->editlatt->typew;
+ lt->typeu= editlt->typeu;
+ lt->typev= editlt->typev;
+ lt->typew= editlt->typew;
}
-
+
if(lt->dvert) {
free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
lt->dvert= NULL;
}
-
- if(lt->editlatt->dvert) {
+
+ if(editlt->dvert) {
int tot= lt->pntsu*lt->pntsv*lt->pntsw;
-
+
lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
- copy_dverts(lt->dvert, lt->editlatt->dvert, tot);
+ copy_dverts(lt->dvert, editlt->dvert, tot);
}
}
@@ -160,9 +170,9 @@ void ED_setflagsLatt(Object *obedit, int flag)
BPoint *bp;
int a;
- bp= lt->editlatt->def;
+ bp= lt->editlatt->latt->def;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
while(a--) {
if(bp->hide==0) {
@@ -183,8 +193,8 @@ int select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- bp= lt->editlatt->def;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+ bp= lt->editlatt->latt->def;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
while(a--) {
if(bp->hide==0) {
@@ -205,8 +215,8 @@ int select_all_exec(bContext *C, wmOperator *op)
ED_setflagsLatt(obedit, 0);
break;
case SEL_INVERT:
- bp= lt->editlatt->def;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+ bp= lt->editlatt->latt->def;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
while(a--) {
if(bp->hide==0) {
@@ -256,7 +266,7 @@ int make_regular_exec(bContext *C, wmOperator *op)
if(ob) {
lt= ob->data;
- resizelattice(lt->editlatt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
+ resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
}
else {
ob= CTX_data_active_object(C);
@@ -354,21 +364,21 @@ typedef struct UndoLattice {
static void undoLatt_to_editLatt(void *data, void *edata)
{
UndoLattice *ult= (UndoLattice*)data;
- Lattice *editlatt= (Lattice *)edata;
- int a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
+ EditLatt *editlatt= (EditLatt *)edata;
+ int a= editlatt->latt->pntsu*editlatt->latt->pntsv*editlatt->latt->pntsw;
- memcpy(editlatt->def, ult->def, a*sizeof(BPoint));
+ memcpy(editlatt->latt->def, ult->def, a*sizeof(BPoint));
}
static void *editLatt_to_undoLatt(void *edata)
{
UndoLattice *ult= MEM_callocN(sizeof(UndoLattice), "UndoLattice");
- Lattice *editlatt= (Lattice *)edata;
+ EditLatt *editlatt= (EditLatt *)edata;
- ult->def= MEM_dupallocN(editlatt->def);
- ult->pntsu= editlatt->pntsu;
- ult->pntsv= editlatt->pntsv;
- ult->pntsw= editlatt->pntsw;
+ ult->def= MEM_dupallocN(editlatt->latt->def);
+ ult->pntsu= editlatt->latt->pntsu;
+ ult->pntsv= editlatt->latt->pntsv;
+ ult->pntsw= editlatt->latt->pntsw;
return ult;
}
@@ -384,11 +394,11 @@ static void free_undoLatt(void *data)
static int validate_undoLatt(void *data, void *edata)
{
UndoLattice *ult= (UndoLattice*)data;
- Lattice *editlatt= (Lattice *)edata;
+ EditLatt *editlatt= (EditLatt *)edata;
- return (ult->pntsu == editlatt->pntsu &&
- ult->pntsv == editlatt->pntsv &&
- ult->pntsw == editlatt->pntsw);
+ return (ult->pntsu == editlatt->latt->pntsu &&
+ ult->pntsv == editlatt->latt->pntsv &&
+ ult->pntsw == editlatt->latt->pntsw);
}
static void *get_editlatt(bContext *C)
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 23bcf5309c5..6e9244e39ca 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -172,8 +172,8 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
else if(obedit->type==OB_LATTICE) {
Lattice *lt= obedit->data;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
- bp= lt->editlatt->def;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+ bp= lt->editlatt->latt->def;
while(a--) {
if(bp->f1 & SELECT) {
if(v1==0) v1= nr;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 86f0c5fa874..5cdabcab41a 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -73,7 +73,7 @@ static Lattice *vgroup_edit_lattice(Object *ob)
{
if(ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
- return (lt->editlatt)? lt->editlatt: lt;
+ return (lt->editlatt)? lt->editlatt->latt: lt;
}
return NULL;
@@ -169,7 +169,7 @@ int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_tot)
int i=0;
Lattice *lt= (Lattice *)id;
- lt= (lt->editlatt)? lt->editlatt: lt;
+ lt= (lt->editlatt)? lt->editlatt->latt: lt;
*dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
*dvert_arr= MEM_mallocN(sizeof(void*)*(*dvert_tot), "vgroup parray from me");
@@ -203,7 +203,7 @@ int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot)
case ID_LT:
{
Lattice *lt= (Lattice *)id;
- lt= (lt->editlatt)? lt->editlatt: lt;
+ lt= (lt->editlatt)? lt->editlatt->latt: lt;
*dvert_arr= lt->dvert;
*dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
return TRUE;
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 693cac01f07..0789114c054 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -225,7 +225,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
else if(obedit->type==OB_LATTICE) {
/* Lattice Edit */
Lattice *lt= obedit->data;
- Lattice *editlatt= lt->editlatt;
+ Lattice *editlatt= lt->editlatt->latt;
BPoint *bp;
int a;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index d8c4a38e2aa..e23276cecad 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1357,10 +1357,10 @@ void lattice_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BPo
{
Object *obedit= vc->obedit;
Lattice *lt= obedit->data;
- BPoint *bp = lt->editlatt->def;
+ BPoint *bp = lt->editlatt->latt->def;
DispList *dl = find_displist(&obedit->disp, DL_VERTS);
float *co = dl?dl->verts:NULL;
- int i, N = lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+ int i, N = lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
short s[2] = {IS_CLIPPED, 0};
ED_view3d_local_clipping(vc->rv3d, obedit->obmat); /* for local clipping lookups */
@@ -1408,7 +1408,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
dl= find_displist(&ob->disp, DL_VERTS);
if(is_edit) {
- lt= lt->editlatt;
+ lt= lt->editlatt->latt;
cpack(0x004000);
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 5f3565c1088..e6c8ff2c268 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -255,8 +255,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
BPoint *bp;
int a;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
- bp= lt->editlatt->def;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+ bp= lt->editlatt->latt->def;
while(a--) {
if(bp->f1 & SELECT) {
add_v3_v3(median, bp->vec);
@@ -457,8 +457,8 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
BPoint *bp;
int a;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
- bp= lt->editlatt->def;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+ bp= lt->editlatt->latt->def;
while(a--) {
if(bp->f1 & SELECT) {
add_v3_v3(bp->vec, median);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 35c4d10cb94..a4e893a6181 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -145,8 +145,8 @@ static void special_transvert_update(Scene *scene, Object *obedit)
else if(obedit->type==OB_LATTICE) {
Lattice *lt= obedit->data;
- if(lt->editlatt->flag & LT_OUTSIDE)
- outside_lattice(lt->editlatt);
+ if(lt->editlatt->latt->flag & LT_OUTSIDE)
+ outside_lattice(lt->editlatt->latt);
}
}
}
@@ -372,9 +372,9 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
else if(obedit->type==OB_LATTICE) {
Lattice *lt= obedit->data;
- bp= lt->editlatt->def;
+ bp= lt->editlatt->latt->def;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
tv=transvmain= MEM_callocN(a*sizeof(TransVert), "maketransverts curve");
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index e40c15de25d..a82037ead11 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1532,7 +1532,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
static void createTransLatticeVerts(bContext *C, TransInfo *t)
{
- Lattice *latt = ((Lattice*)t->obedit->data)->editlatt;
+ Lattice *latt = ((Lattice*)t->obedit->data)->editlatt->latt;
TransData *td = NULL;
BPoint *bp;
float mtx[3][3], smtx[3][3];
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 74f4b5cb52f..56a4eb846c0 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -659,7 +659,7 @@ void recalcData(TransInfo *t)
Lattice *la= t->obedit->data;
DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
- if(la->editlatt->flag & LT_OUTSIDE) outside_lattice(la->editlatt);
+ if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
}
else if (t->obedit->type == OB_MESH) {
EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index e6def04130c..27c3f056b9b 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -379,9 +379,9 @@ int calc_manipulator_stats(const bContext *C)
BPoint *bp;
Lattice *lt= obedit->data;
- bp= lt->editlatt->def;
+ bp= lt->editlatt->latt->def;
- a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
+ a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
while(a--) {
if(bp->f1 & SELECT) {
calc_tw_center(scene, bp->vec);
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index a013177e1b8..973ba896100 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -157,6 +157,11 @@ typedef struct EditNurb {
/* index data for shape keys */
struct GHash *keyindex;
+
+ /* shape key being edited */
+ int shapenr;
+
+ char pad[4];
} EditNurb;
typedef struct Curve {
diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h
index 3a0fcb3c38c..94fc9fefb66 100644
--- a/source/blender/makesdna/DNA_lattice_types.h
+++ b/source/blender/makesdna/DNA_lattice_types.h
@@ -36,6 +36,14 @@ struct Ipo;
struct Key;
struct MDeformVert;
+typedef struct EditLatt {
+ struct Lattice *latt;
+
+ int shapenr;
+
+ char pad[4];
+} EditLatt;
+
typedef struct Lattice {
ID id;
@@ -58,7 +66,7 @@ typedef struct Lattice {
float *latticedata;
float latmat[4][4];
- struct Lattice *editlatt;
+ struct EditLatt *editlatt;
} Lattice;
/* ***************** LATTICE ********************* */
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index c5132844016..9f979582165 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -79,8 +79,8 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN
Lattice *lt= (Lattice*)ptr->data;
int tot= lt->pntsu*lt->pntsv*lt->pntsw;
- if(lt->editlatt && lt->editlatt->def)
- rna_iterator_array_begin(iter, (void*)lt->editlatt->def, sizeof(BPoint), tot, 0, NULL);
+ if(lt->editlatt && lt->editlatt->latt->def)
+ rna_iterator_array_begin(iter, (void*)lt->editlatt->latt->def, sizeof(BPoint), tot, 0, NULL);
else if(lt->def)
rna_iterator_array_begin(iter, (void*)lt->def, sizeof(BPoint), tot, 0, NULL);
else
@@ -111,7 +111,7 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
if(ob->data == lt) {
resizelattice(lt, newu, newv, neww, ob);
if(lt->editlatt)
- resizelattice(lt->editlatt, newu, newv, neww, ob);
+ resizelattice(lt->editlatt->latt, newu, newv, neww, ob);
break;
}
}
@@ -120,7 +120,7 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
if(!ob) {
resizelattice(lt, newu, newv, neww, NULL);
if(lt->editlatt)
- resizelattice(lt->editlatt, newu, newv, neww, NULL);
+ resizelattice(lt->editlatt->latt, newu, newv, neww, NULL);
}
rna_Lattice_update_data(bmain, scene, ptr);
@@ -136,26 +136,39 @@ static void rna_Lattice_outside_set(PointerRNA *ptr, int value)
outside_lattice(lt);
if(lt->editlatt) {
- if(value) lt->editlatt->flag |= LT_OUTSIDE;
- else lt->editlatt->flag &= ~LT_OUTSIDE;
+ if(value) lt->editlatt->latt->flag |= LT_OUTSIDE;
+ else lt->editlatt->latt->flag &= ~LT_OUTSIDE;
- outside_lattice(lt->editlatt);
+ outside_lattice(lt->editlatt->latt);
}
}
+static int rna_Lattice_size_editable(PointerRNA *ptr)
+{
+ Lattice *lt= (Lattice*)ptr->data;
+
+ return lt->key == NULL;
+}
+
static void rna_Lattice_points_u_set(PointerRNA *ptr, int value)
{
- ((Lattice*)ptr->data)->opntsu= CLAMPIS(value, 1, 64);
+ Lattice *lt= (Lattice*)ptr->data;
+
+ lt->opntsu= CLAMPIS(value, 1, 64);
}
static void rna_Lattice_points_v_set(PointerRNA *ptr, int value)
{
- ((Lattice*)ptr->data)->opntsv= CLAMPIS(value, 1, 64);
+ Lattice *lt= (Lattice*)ptr->data;
+
+ lt->opntsv= CLAMPIS(value, 1, 64);
}
static void rna_Lattice_points_w_set(PointerRNA *ptr, int value)
{
- ((Lattice*)ptr->data)->opntsw= CLAMPIS(value, 1, 64);
+ Lattice *lt= (Lattice*)ptr->data;
+
+ lt->opntsw= CLAMPIS(value, 1, 64);
}
static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
@@ -164,7 +177,7 @@ static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
strcpy(lt->vgroup, value);
if(lt->editlatt)
- strcpy(lt->editlatt->vgroup, value);
+ strcpy(lt->editlatt->latt->vgroup, value);
}
@@ -216,22 +229,25 @@ static void rna_def_lattice(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "pntsu");
RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_u_set", NULL);
RNA_def_property_range(prop, 1, 64);
- RNA_def_property_ui_text(prop, "U", "Points in U direction");
+ RNA_def_property_ui_text(prop, "U", "Points in U direction (can't be changed when there are shape keys)");
RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
+ RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
prop= RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "pntsv");
RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_v_set", NULL);
RNA_def_property_range(prop, 1, 64);
- RNA_def_property_ui_text(prop, "V", "Points in V direction");
+ RNA_def_property_ui_text(prop, "V", "Points in V direction (can't be changed when there are shape keys)");
RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
+ RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
prop= RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "pntsw");
RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_w_set", NULL);
RNA_def_property_range(prop, 1, 64);
- RNA_def_property_ui_text(prop, "W", "Points in W direction");
+ RNA_def_property_ui_text(prop, "W", "Points in W direction (can't be changed when there are shape keys)");
RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
+ RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
prop= RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "typeu");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 51e2fc38014..ee38505d792 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -128,6 +128,8 @@ EnumPropertyItem object_type_curve_items[] = {
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_particle.h"
+#include "ED_curve.h"
+#include "ED_lattice.h"
static void rna_Object_internal_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
@@ -182,12 +184,24 @@ void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= ptr->id.data;
- int editmode= (scene->obedit == ob && ob->type == OB_MESH);
- if(editmode) {
+ if(scene->obedit == ob) {
/* exit/enter editmode to get new shape */
- load_editMesh(scene, ob);
- make_editMesh(scene, ob);
+ switch(ob->type) {
+ case OB_MESH:
+ load_editMesh(scene, ob);
+ make_editMesh(scene, ob);
+ break;
+ case OB_CURVE:
+ case OB_SURF:
+ load_editNurb(ob);
+ make_editNurb(ob);
+ break;
+ case OB_LATTICE:
+ load_editLatt(ob);
+ make_editLatt(ob);
+ break;
+ }
}
rna_Object_internal_update_data(bmain, scene, ptr);