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:
authorDaniel Dunbar <daniel@zuster.org>2005-07-28 00:16:41 +0400
committerDaniel Dunbar <daniel@zuster.org>2005-07-28 00:16:41 +0400
commit4b1588e277d6a6e6bc7dc9553652d2ca4aad2d73 (patch)
tree39310f93a57a9d3cbac4be639723a5aed2eb6291 /source/blender
parent410512e2656007587cc1671c71c37cbc0b5bda4f (diff)
- update storage.c to use standard time codes (should fix issue
with MSVS 8) - broke mesh_create_shadedColors out of shadeDispList, used to build vertex colors for mesh in vpaint as well (also fixed bug where they were not initialized correctly for subsurfs) - added modifier_copyData and modifier_findByType functions - change editmode modifiers to only calculate if Realtime and Editmode bits are both set, makes more sense for copying modifiers - update object_copy to correctly copy modifiers - removed duplicate redefinition of ME_ attributes in python, this is a horrible idea, why was it done in the first place? - update armature auto vertex group code to check for subsurf in modifier stack - fixed flip_subdivision to work with move to modifier stack - added copymenu_modifiers, can copy all modifiers or just data from first modifier of a certain type (not sure how to deal with multiple modifiers of same type... not a big issue though I think)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_displist.h2
-rw-r--r--source/blender/blenkernel/BKE_modifier.h9
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c1
-rw-r--r--source/blender/blenkernel/intern/displist.c273
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenkernel/intern/modifier.c91
-rw-r--r--source/blender/blenkernel/intern/object.c9
-rw-r--r--source/blender/blenlib/intern/storage.c7
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/include/BDR_editobject.h4
-rw-r--r--source/blender/python/api2_2x/NMesh.c28
-rw-r--r--source/blender/src/editarmature.c4
-rw-r--r--source/blender/src/editobject.c128
-rw-r--r--source/blender/src/header_view3d.c26
-rw-r--r--source/blender/src/toolbox.c2
-rw-r--r--source/blender/src/vpaint.c40
16 files changed, 419 insertions, 209 deletions
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index eb66397fb37..463b7b22e1d 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -147,5 +147,7 @@ void imagestodisplist(void);
void reshadeall_displist(void);
void filldisplist(struct ListBase *dispbase, struct ListBase *to);
+void mesh_create_shadedColors(struct Object *ob, int onlyForMesh, unsigned int **col1_r, unsigned int **col2_r);
+
#endif
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index e407c04159c..94e174f0e0e 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -38,6 +38,7 @@ struct ModifierData;
struct DagForest;
struct DagNode;
struct Object;
+struct ListBase;
typedef enum {
/* Should not be used, only for None modifier type */
@@ -91,6 +92,11 @@ typedef struct ModifierTypeInfo {
*/
void (*initData)(struct ModifierData *md);
+ /* Copy instance data for this modifier type. Should copy all user
+ * level settings to the target modifier.
+ */
+ void (*copyData)(struct ModifierData *md, struct ModifierData *target);
+
/* Free internal modifier data variables, this function should
* not free the _md_ variable itself.
*
@@ -171,7 +177,10 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type);
struct ModifierData* modifier_new (int type);
void modifier_free (struct ModifierData *md);
+void modifier_copyData (struct ModifierData *md, struct ModifierData *target);
int modifier_dependsOnTime (struct ModifierData *md);
+struct ModifierData* modifiers_findByType (struct ListBase *lb, ModifierType type);
+
#endif
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 3b00fb034a0..615429bee9f 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1393,6 +1393,7 @@ static void editmesh_calc_modifiers(DerivedMesh **cage_r, DerivedMesh **final_r)
for (; md; md=md->next) {
ModifierTypeInfo *mti = modifierType_get_info(md->type);
+ if (!(md->mode&eModifierMode_Realtime)) continue;
if (!(md->mode&eModifierMode_Editmode)) continue;
if (mti->isDisabled && mti->isDisabled(md)) continue;
if (!(mti->flags&eModifierTypeFlag_SupportsEditmode)) continue;
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 15c16db3142..bebd7bf4d93 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -603,7 +603,7 @@ void addnormalsDispList(Object *ob, ListBase *lb)
float *n1, *n2, *n3, *n4;
int a, b, p1, p2, p3, p4;
-
+
dl= lb->first;
while(dl) {
@@ -661,18 +661,11 @@ void addnormalsDispList(Object *ob, ListBase *lb)
}
}
-
-void shadeDispList(Object *ob)
+static void init_fastshade_for_ob(Object *ob, int *need_orco_r, float mat[4][4], float imat[3][3])
{
- DispList *dl, *dlob;
- Material *ma = NULL;
- Curve *cu;
- float *orco=NULL, imat[3][3], tmat[4][4], mat[4][4], vec[3], xn, yn, zn;
- float *fp, *nor, n1[3];
- unsigned int *col1;
- int a, need_orco = 0;
+ float tmat[4][4];
+ int a;
- if(ob->flag & OB_FROMDUPLI) return;
initfastshade();
Mat4MulMat4(mat, ob->obmat, fviewmat);
@@ -680,129 +673,176 @@ void shadeDispList(Object *ob)
Mat4Invert(tmat, mat);
Mat3CpyMat4(imat, tmat);
if(ob->transflag & OB_NEG_SCALE) Mat3MulFloat((float *)imat, -1.0);
-
- dl = find_displist(&ob->disp, DL_VERTCOL);
- if (dl) {
- BLI_remlink(&ob->disp, dl);
- free_disp_elem(dl);
- }
- need_orco= 0;
+ if (need_orco_r) *need_orco_r= 0;
for(a=0; a<ob->totcol; a++) {
- ma= give_current_material(ob, a+1);
+ Material *ma= give_current_material(ob, a+1);
if(ma) {
init_render_material(ma);
- if(ma->texco & TEXCO_ORCO) need_orco= 1;
+ if(ma->texco & TEXCO_ORCO) {
+ if (need_orco_r) *need_orco_r= 1;
+ }
}
}
+}
+static void end_fastshade_for_ob(Object *ob)
+{
+ int a;
- if(ob->type==OB_MESH) {
- Mesh *me= ob->data;
- int dmNeedsFree;
- DerivedMesh *dm= mesh_get_derived_final(ob, &dmNeedsFree);
- DispListMesh *dlm;
- MVert *mvert;
- float *vnors, *vn;
- int i;
-
- if (need_orco) {
- orco = mesh_create_orco(ob);
- }
+ for(a=0; a<ob->totcol; a++) {
+ Material *ma= give_current_material(ob, a+1);
+ if(ma) end_render_material(ma);
+ }
+}
- dlm= dm->convertToDispListMesh(dm);
+void mesh_create_shadedColors(Object *ob, int onlyForMesh, unsigned int **col1_r, unsigned int **col2_r)
+{
+ Mesh *me= ob->data;
+ int dmNeedsFree;
+ DerivedMesh *dm;
+ DispListMesh *dlm;
+ unsigned int *col1, *col2;
+ float *orco, *vnors, imat[3][3], mat[4][4], vec[3];
+ int a, i, need_orco;
+
+ init_fastshade_for_ob(ob, &need_orco, mat, imat);
+
+ if (need_orco) {
+ orco = mesh_create_orco(ob);
+ } else {
+ orco = NULL;
+ }
+
+ if (onlyForMesh) {
+ dm = mesh_get_derived_deform(ob, &dmNeedsFree);
+ } else {
+ dm = mesh_get_derived_final(ob, &dmNeedsFree);
+ }
+ dlm= dm->convertToDispListMesh(dm);
- dlob= MEM_callocN(sizeof(DispList), "displistshade");
- BLI_addtail(&ob->disp, dlob);
- dlob->type= DL_VERTCOL;
+ col1 = MEM_mallocN(sizeof(*col1)*dlm->totface*4, "col1");
+ if (col2_r && (me->flag & ME_TWOSIDED)) {
+ col2 = MEM_mallocN(sizeof(*col2)*dlm->totface*4, "col1");
+ } else {
+ col2 = NULL;
+ }
- dlob->col1= MEM_mallocN(sizeof(*dlob->col1)*dlm->totface*4, "col1");
- if (me->flag & ME_TWOSIDED)
- dlob->col2= MEM_mallocN(sizeof(*dlob->col2)*dlm->totface*4, "col1");
-
+ *col1_r = col1;
+ if (col2_r) *col2_r = col2;
+
/* vertexnormals */
- vn=vnors= MEM_mallocN(dlm->totvert*3*sizeof(float), "vnors disp");
- mvert= dlm->mvert;
- a= dlm->totvert;
- while(a--) {
-
- xn= mvert->no[0];
- yn= mvert->no[1];
- zn= mvert->no[2];
-
+ vnors= MEM_mallocN(dlm->totvert*3*sizeof(float), "vnors disp");
+ for (a=0; a<dlm->totvert; a++) {
+ MVert *mv = &dlm->mvert[a];
+ float *vn= &vnors[a*3];
+ float xn= mv->no[0];
+ float yn= mv->no[1];
+ float zn= mv->no[2];
+
/* transpose ! */
- vn[0]= imat[0][0]*xn+imat[0][1]*yn+imat[0][2]*zn;
- vn[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
- vn[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
- Normalise(vn);
+ vn[0]= imat[0][0]*xn+imat[0][1]*yn+imat[0][2]*zn;
+ vn[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
+ vn[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
+ Normalise(vn);
+ }
+
+ for (i=0; i<dlm->totface; i++) {
+ MFace *mf= &dlm->mface[i];
+
+ if (mf->v3) {
+ int j, vidx[4], nverts= mf->v4?4:3;
+ unsigned char *col1base= (unsigned char*) &col1[i*4];
+ unsigned char *col2base= (unsigned char*) (col2?&col2[i*4]:NULL);
+ unsigned char *mcolbase;
+ Material *ma= give_current_material(ob, mf->mat_nr+1);
+ float nor[3], n1[3];
- mvert++; vn+=3;
- }
-
- for (i=0; i<dlm->totface; i++) {
- MFace *mf= &dlm->mface[i];
-
- if (mf->v3) {
- int j, vidx[4], nverts= mf->v4?4:3;
- unsigned char *col1base= (unsigned char*) &dlob->col1[i*4];
- unsigned char *col2base= (unsigned char*) (dlob->col2?&dlob->col2[i*4]:NULL);
- unsigned char *mcolbase;
- float nor[3];
-
- if (dlm->tface) {
- mcolbase = (unsigned char*) dlm->tface[i].col;
- } else if (dlm->mcol) {
- mcolbase = (unsigned char*) &dlm->mcol[i*4];
- } else {
- mcolbase = NULL;
- }
+ if(ma==0) ma= &defmaterial;
+
+ if (dlm->tface) {
+ mcolbase = (unsigned char*) dlm->tface[i].col;
+ } else if (dlm->mcol) {
+ mcolbase = (unsigned char*) &dlm->mcol[i*4];
+ } else {
+ mcolbase = NULL;
+ }
- ma= give_current_material(ob, mf->mat_nr+1);
- if(ma==0) ma= &defmaterial;
-
- vidx[0]= mf->v1;
- vidx[1]= mf->v2;
- vidx[2]= mf->v3;
- vidx[3]= mf->v4;
-
- // XXX, should all DLM's have normals?
- if (dlm->nors) {
- VECCOPY(nor, &dlm->nors[i*3]);
- } else {
- if (mf->v4)
- CalcNormFloat4(dlm->mvert[mf->v1].co, dlm->mvert[mf->v2].co, dlm->mvert[mf->v3].co, dlm->mvert[mf->v4].co, nor);
- else
- CalcNormFloat(dlm->mvert[mf->v1].co, dlm->mvert[mf->v2].co, dlm->mvert[mf->v3].co, nor);
- }
+ vidx[0]= mf->v1;
+ vidx[1]= mf->v2;
+ vidx[2]= mf->v3;
+ vidx[3]= mf->v4;
+
+ // XXX, should all DLM's have normals?
+ if (dlm->nors) {
+ VECCOPY(nor, &dlm->nors[i*3]);
+ } else {
+ if (mf->v4)
+ CalcNormFloat4(dlm->mvert[mf->v1].co, dlm->mvert[mf->v2].co, dlm->mvert[mf->v3].co, dlm->mvert[mf->v4].co, nor);
+ else
+ CalcNormFloat(dlm->mvert[mf->v1].co, dlm->mvert[mf->v2].co, dlm->mvert[mf->v3].co, nor);
+ }
- n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
- n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
- n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
- Normalise(n1);
-
- vn = n1;
- for (j=0; j<nverts; j++) {
- MVert *mv= &dlm->mvert[vidx[j]];
- unsigned char *col1= &col1base[j*4];
- unsigned char *col2= col2base?&col2base[j*4]:NULL;
- unsigned char *mcol= mcolbase?&mcolbase[j*4]:NULL;
-
- VECCOPY(vec, mv->co);
- Mat4MulVecfl(mat, vec);
- if(mf->flag & ME_SMOOTH) vn= vnors+3*vidx[j];
- fastshade(vec, vn, orco?&orco[vidx[j]*3]:mv->co, ma, col1, col2, mcol);
- }
+ n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
+ n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
+ n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
+ Normalise(n1);
+
+ for (j=0; j<nverts; j++) {
+ MVert *mv= &dlm->mvert[vidx[j]];
+ unsigned char *col1= &col1base[j*4];
+ unsigned char *col2= col2base?&col2base[j*4]:NULL;
+ unsigned char *mcol= mcolbase?&mcolbase[j*4]:NULL;
+ float *vn = (mf->flag & ME_SMOOTH)?&vnors[3*vidx[j]]:n1;
+
+ VECCOPY(vec, mv->co);
+ Mat4MulVecfl(mat, vec);
+ fastshade(vec, vn, orco?&orco[vidx[j]*3]:mv->co, ma, col1, col2, mcol);
}
}
- MEM_freeN(vnors);
- displistmesh_free(dlm);
+ }
+ MEM_freeN(vnors);
+ displistmesh_free(dlm);
- if (orco) {
- MEM_freeN(orco);
- }
+ if (orco) {
+ MEM_freeN(orco);
+ }
+
+ if (dmNeedsFree) dm->release(dm);
+
+ end_fastshade_for_ob(ob);
+}
- if (dmNeedsFree) dm->release(dm);
+void shadeDispList(Object *ob)
+{
+ DispList *dl, *dlob;
+ Material *ma = NULL;
+ Curve *cu;
+ float imat[3][3], mat[4][4], vec[3];
+ float *fp, *nor, n1[3];
+ unsigned int *col1;
+ int a;
+
+ if(ob->flag & OB_FROMDUPLI) return;
+
+ dl = find_displist(&ob->disp, DL_VERTCOL);
+ if (dl) {
+ BLI_remlink(&ob->disp, dl);
+ free_disp_elem(dl);
+ }
+
+ if(ob->type==OB_MESH) {
+ dl= MEM_callocN(sizeof(DispList), "displistshade");
+ BLI_addtail(&ob->disp, dl);
+ dl->type= DL_VERTCOL;
+
+ mesh_create_shadedColors(ob, 0, &dl->col1, &dl->col2);
+
+ return;
}
- else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
+
+ init_fastshade_for_ob(ob, NULL, mat, imat);
+
+ if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
/* now we need the normals */
cu= ob->data;
@@ -910,10 +950,7 @@ void shadeDispList(Object *ob)
}
}
- for(a=0; a<ob->totcol; a++) {
- ma= give_current_material(ob, a+1);
- if(ma) end_render_material(ma);
- }
+ end_fastshade_for_ob(ob);
}
void reshadeall_displist(void)
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 41e9d0b4c70..c61797f2396 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -197,8 +197,6 @@ Mesh *add_mesh()
me->smoothresh= 30;
me->texflag= AUTOSPACE;
me->flag= ME_TWOSIDED;
- me->subdiv= 1;
- me->subdivr = 1;
me->bb= unit_boundbox();
return me;
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 7f60fdda187..0c43b128141 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -39,6 +39,14 @@ static int noneModifier_isDisabled(ModifierData *md)
/* Curve */
+static void curveModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ CurveModifierData *cmd = (CurveModifierData*) md;
+ CurveModifierData *tcmd = (CurveModifierData*) target;
+
+ tcmd->object = cmd->object;
+}
+
static int curveModifier_isDisabled(ModifierData *md)
{
CurveModifierData *cmd = (CurveModifierData*) md;
@@ -73,6 +81,14 @@ static void curveModifier_deformVertsEM(ModifierData *md, Object *ob, void *edit
/* Lattice */
+static void latticeModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ LatticeModifierData *lmd = (LatticeModifierData*) md;
+ LatticeModifierData *tlmd = (LatticeModifierData*) target;
+
+ tlmd->object = lmd->object;
+}
+
static int latticeModifier_isDisabled(ModifierData *md)
{
LatticeModifierData *lmd = (LatticeModifierData*) md;
@@ -115,6 +131,17 @@ static void subsurfModifier_initData(ModifierData *md)
smd->renderLevels = 2;
}
+static void subsurfModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ SubsurfModifierData *smd = (SubsurfModifierData*) md;
+ SubsurfModifierData *tsmd = (SubsurfModifierData*) target;
+
+ tsmd->flags = smd->flags;
+ tsmd->levels = smd->levels;
+ tsmd->renderLevels = smd->renderLevels;
+ tsmd->subdivType = smd->subdivType;
+}
+
static void subsurfModifier_freeData(ModifierData *md)
{
SubsurfModifierData *smd = (SubsurfModifierData*) md;
@@ -192,6 +219,17 @@ static void buildModifier_initData(ModifierData *md)
bmd->length = 100.0;
}
+static void buildModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ BuildModifierData *bmd = (BuildModifierData*) md;
+ BuildModifierData *tbmd = (BuildModifierData*) target;
+
+ tbmd->start = bmd->start;
+ tbmd->length = bmd->length;
+ tbmd->randomize = bmd->randomize;
+ tbmd->seed = bmd->seed;
+}
+
static int buildModifier_dependsOnTime(ModifierData *md)
{
return 1;
@@ -421,6 +459,15 @@ static void mirrorModifier_initData(ModifierData *md)
mmd->tolerance = 0.001;
}
+static void mirrorModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ MirrorModifierData *mmd = (MirrorModifierData*) md;
+ MirrorModifierData *tmmd = (MirrorModifierData*) target;
+
+ tmmd->axis = mmd->axis;
+ tmmd->tolerance = mmd->tolerance;
+}
+
static void mirrorModifier__doMirror(MirrorModifierData *mmd, DispListMesh *ndlm, float (*vertexCos)[3])
{
int totvert=ndlm->totvert, totedge=ndlm->totedge, totface=ndlm->totface;
@@ -874,6 +921,23 @@ static void waveModifier_initData(ModifierData *md)
wmd->damp= 10.0f;
}
+static void waveModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ WaveModifierData *wmd = (WaveModifierData*) md;
+ WaveModifierData *twmd = (WaveModifierData*) target;
+
+ twmd->damp = wmd->damp;
+ twmd->flag = wmd->flag;
+ twmd->height = wmd->height;
+ twmd->lifetime = wmd->lifetime;
+ twmd->narrow = wmd->narrow;
+ twmd->speed = wmd->speed;
+ twmd->startx = wmd->startx;
+ twmd->starty = wmd->starty;
+ twmd->timeoffs = wmd->timeoffs;
+ twmd->width = wmd->width;
+}
+
static int waveModifier_dependsOnTime(ModifierData *md)
{
return 1;
@@ -972,6 +1036,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type)
mti = INIT_TYPE(Curve);
mti->type = eModifierTypeType_OnlyDeform;
mti->flags = eModifierTypeFlag_AcceptsCVs | eModifierTypeFlag_SupportsEditmode;
+ mti->copyData = curveModifier_copyData;
mti->isDisabled = curveModifier_isDisabled;
mti->updateDepgraph = curveModifier_updateDepgraph;
mti->deformVerts = curveModifier_deformVerts;
@@ -980,6 +1045,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type)
mti = INIT_TYPE(Lattice);
mti->type = eModifierTypeType_OnlyDeform;
mti->flags = eModifierTypeFlag_AcceptsCVs | eModifierTypeFlag_SupportsEditmode;
+ mti->copyData = latticeModifier_copyData;
mti->isDisabled = latticeModifier_isDisabled;
mti->updateDepgraph = latticeModifier_updateDepgraph;
mti->deformVerts = latticeModifier_deformVerts;
@@ -989,6 +1055,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type)
mti->type = eModifierTypeType_Constructive;
mti->flags = eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsMapping | eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_EnableInEditmode;
mti->initData = subsurfModifier_initData;
+ mti->copyData = subsurfModifier_copyData;
mti->freeData = subsurfModifier_freeData;
mti->applyModifier = subsurfModifier_applyModifier;
mti->applyModifierEM = subsurfModifier_applyModifierEM;
@@ -997,6 +1064,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type)
mti->type = eModifierTypeType_Nonconstructive;
mti->flags = eModifierTypeFlag_AcceptsMesh;
mti->initData = buildModifier_initData;
+ mti->copyData = buildModifier_copyData;
mti->dependsOnTime = buildModifier_dependsOnTime;
mti->applyModifier = buildModifier_applyModifier;
@@ -1004,6 +1072,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type)
mti->type = eModifierTypeType_Constructive;
mti->flags = eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_EnableInEditmode;
mti->initData = mirrorModifier_initData;
+ mti->copyData = mirrorModifier_copyData;
mti->applyModifier = mirrorModifier_applyModifier;
mti->applyModifierEM = mirrorModifier_applyModifierEM;
@@ -1017,6 +1086,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type)
mti->type = eModifierTypeType_OnlyDeform;
mti->flags = eModifierTypeFlag_AcceptsCVs | eModifierTypeFlag_SupportsEditmode;
mti->initData = waveModifier_initData;
+ mti->copyData = waveModifier_copyData;
mti->dependsOnTime = waveModifier_dependsOnTime;
mti->deformVerts = waveModifier_deformVerts;
mti->deformVertsEM = waveModifier_deformVertsEM;
@@ -1063,3 +1133,24 @@ int modifier_dependsOnTime(ModifierData *md)
return mti->dependsOnTime && mti->dependsOnTime(md);
}
+
+ModifierData *modifiers_findByType(struct ListBase *lb, ModifierType type)
+{
+ ModifierData *md = lb->first;
+
+ for (; md; md=md->next)
+ if (md->type==type)
+ break;
+
+ return md;
+}
+
+void modifier_copyData(ModifierData *md, ModifierData *target)
+{
+ ModifierTypeInfo *mti = modifierType_get_info(md->type);
+
+ target->mode = md->mode;
+
+ if (mti->copyData)
+ mti->copyData(md, target);
+}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 7b601bfbe43..2b8b14429ef 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -823,6 +823,7 @@ SoftBody *copy_softbody(SoftBody *sb)
Object *copy_object(Object *ob)
{
Object *obn;
+ ModifierData *md;
int a;
bConstraintChannel *actcon;
@@ -837,7 +838,13 @@ Object *copy_object(Object *ob)
obn->flag &= ~OB_FROMGROUP;
copy_effects(&obn->effect, &ob->effect);
- obn->modifiers.first = obn->modifiers.last= NULL; // XXX fixme
+ obn->modifiers.first = obn->modifiers.last= NULL;
+
+ for (md=ob->modifiers.first; md; md=md->next) {
+ ModifierData *nmd = modifier_new(md->type);
+ modifier_copyData(md, nmd);
+ BLI_addtail(&obn->modifiers, nmd);
+ }
obn->network.first= obn->network.last= 0;
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 5123098e522..8b45bfe0420 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -393,12 +393,7 @@ void BLI_adddirstrings()
else if(num1) sprintf(files[num].size, "%15d", num1);
else sprintf(files[num].size, "0");
-#if 1400 >= _MSC_VER
- //visual studio 8 crashes on 'R', todo: check for replacement
- strftime(datum, 32, "%d-%b-%y ", tm);
-#else
- strftime(datum, 32, "%d-%b-%y %R", tm);
-#endif
+ strftime(datum, 32, "%d-%b-%y %H:%M", tm);
if (st_size < 1000) {
sprintf(size, "%10d", (int) st_size);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index b916914fd50..43c6a284f9f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3606,7 +3606,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(main->versionfile <= 169) {
Mesh *me= main->mesh.first;
while(me) {
- if(me->subdiv==0) me->subdiv= 3;
+ if(me->subdiv==0) me->subdiv= 1;
me= me->id.next;
}
}
diff --git a/source/blender/include/BDR_editobject.h b/source/blender/include/BDR_editobject.h
index f67fc40ec4d..f6abd6707f1 100644
--- a/source/blender/include/BDR_editobject.h
+++ b/source/blender/include/BDR_editobject.h
@@ -63,7 +63,6 @@ void docentre_cursor(void);
void movetolayer(void);
void special_editmenu(void);
void convertmenu(void);
-void copymenu_properties(struct Object *ob);
void copy_attr_menu(void);
void copy_attr(short event);
void link_to_scene(unsigned short nr);
@@ -72,9 +71,6 @@ void make_links(short event);
void make_duplilist_real(void);
void apply_object(void);
-void copymenu_logicbricks(struct Object *ob);
-
-
/* old transform */
void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert);
void compatible_eul(float *eul, float *oldrot);
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c
index c80702dc641..531a06fdc5d 100644
--- a/source/blender/python/api2_2x/NMesh.c
+++ b/source/blender/python/api2_2x/NMesh.c
@@ -73,12 +73,6 @@ extern void countall(void);
/* EXPP Mesh defines */
-#define EXPP_NMESH_MODE_NOPUNOFLIP ME_NOPUNOFLIP
-#define EXPP_NMESH_MODE_TWOSIDED ME_TWOSIDED
-#define EXPP_NMESH_MODE_AUTOSMOOTH ME_AUTOSMOOTH
-#define EXPP_NMESH_MODE_SUBSURF ME_SUBSURF
-#define EXPP_NMESH_MODE_OPTIMAL ME_OPT_EDGES
-
#define NMESH_FRAME_MAX 30000
#define NMESH_SMOOTHRESH 30
#define NMESH_SMOOTHRESH_MIN 1
@@ -1544,15 +1538,15 @@ static PyObject *NMesh_setMode( PyObject * self, PyObject * args )
for( i = 0; i < 5; i++ ) {
if( !m[i] ) break;
else if( strcmp( m[i], "NoVNormalsFlip" ) == 0 )
- mode |= EXPP_NMESH_MODE_NOPUNOFLIP;
+ mode |= ME_NOPUNOFLIP;
else if( strcmp( m[i], "TwoSided" ) == 0 )
- mode |= EXPP_NMESH_MODE_TWOSIDED;
+ mode |= ME_TWOSIDED;
else if( strcmp( m[i], "AutoSmooth" ) == 0 )
- mode |= EXPP_NMESH_MODE_AUTOSMOOTH;
+ mode |= ME_AUTOSMOOTH;
else if( strcmp( m[i], "SubSurf" ) == 0 )
- mode |= EXPP_NMESH_MODE_SUBSURF;
+ mode |= ME_SUBSURF;
else if( strcmp( m[i], "Optimal" ) == 0 )
- mode |= EXPP_NMESH_MODE_OPTIMAL;
+ mode |= ME_OPT_EDGES;
else if( m[i][0] == '\0' )
mode = 0;
else
@@ -1994,7 +1988,7 @@ static PyObject *new_NMesh_internal( Mesh * oldmesh,
{
BPy_NMesh *me = PyObject_NEW( BPy_NMesh, &NMesh_Type );
me->flags = 0;
- me->mode = EXPP_NMESH_MODE_TWOSIDED; /* default for new meshes */
+ me->mode = ME_TWOSIDED; /* default for new meshes */
me->subdiv[0] = NMESH_SUBDIV;
me->subdiv[1] = NMESH_SUBDIV;
me->smoothresh = NMESH_SMOOTHRESH;
@@ -2948,16 +2942,16 @@ static PyObject *M_NMesh_Modes( void )
constant_insert( d, "NOVNORMALSFLIP",
PyInt_FromLong
- ( EXPP_NMESH_MODE_NOPUNOFLIP ) );
+ ( ME_NOPUNOFLIP ) );
constant_insert( d, "TWOSIDED",
- PyInt_FromLong( EXPP_NMESH_MODE_TWOSIDED ) );
+ PyInt_FromLong( ME_TWOSIDED ) );
constant_insert( d, "AUTOSMOOTH",
PyInt_FromLong
- ( EXPP_NMESH_MODE_AUTOSMOOTH ) );
+ ( ME_AUTOSMOOTH ) );
constant_insert( d, "SUBSURF",
- PyInt_FromLong( EXPP_NMESH_MODE_SUBSURF ) );
+ PyInt_FromLong( ME_SUBSURF ) );
constant_insert( d, "OPTIMAL",
- PyInt_FromLong( EXPP_NMESH_MODE_OPTIMAL ) );
+ PyInt_FromLong( ME_OPT_EDGES ) );
}
return Modes;
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 06827b2bdf1..5f4e9ff72fa 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -54,6 +54,7 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
+#include "DNA_modifier_types.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -69,6 +70,7 @@
#include "BKE_object.h"
#include "BKE_subsurf.h"
#include "BKE_utildefines.h"
+#include "BKE_modifier.h"
#include "BIF_editaction.h"
#include "BIF_editmode_undo.h"
@@ -1993,7 +1995,7 @@ static void add_verts_to_closest_dgroup(Object *ob, Object *par)
mesh = (Mesh*)ob->data;
/* Is subsurf on? Lets use the verts on the limit surface then */
- if (mesh->flag&ME_SUBSURF) {
+ if (modifiers_findByType(&ob->modifiers, eModifierType_Subsurf)) {
subverts = MEM_mallocN(3*mesh->totvert*sizeof(float), "subverts");
subsurf_calculate_limit_positions(mesh, (void *)subverts); /* (ton) made void*, dunno how to cast */
}
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 17976a61a4a..9590be53b1e 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -81,6 +81,7 @@
#include "DNA_view3d_types.h"
#include "DNA_vfont_types.h"
#include "DNA_world_types.h"
+#include "DNA_modifier_types.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -117,6 +118,7 @@
#include "BKE_subsurf.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
+#include "BKE_modifier.h"
#include "BIF_gl.h"
#include "BIF_graphics.h"
@@ -2315,23 +2317,40 @@ void convertmenu(void)
*/
void flip_subdivison(Object *ob, int level)
{
- Mesh *me = ob->data;
+ ModifierData *md = modifiers_findByType(&ob->modifiers, eModifierType_Subsurf);
- if (level == -1) {
- me->flag ^= ME_SUBSURF;
+ if (md) {
+ SubsurfModifierData *smd = (SubsurfModifierData*) md;
+
+ if (level == -1) {
+ if (smd->modifier.mode&(eModifierMode_Render|eModifierMode_Realtime)) {
+ smd->modifier.mode &= ~(eModifierMode_Render|eModifierMode_Realtime);
+ } else {
+ smd->modifier.mode |= (eModifierMode_Render|eModifierMode_Realtime);
+ }
+ } else {
+ smd->levels = level;
+ }
} else {
- me->subdiv = level;
+ SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf);
+
+ BLI_addtail(&ob->modifiers, smd);
+
+ if (level!=-1) {
+ smd->levels = level;
+ }
}
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWOOPS, 0);
allqueue(REDRAWBUTSEDIT, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
BIF_undo_push("Switch subsurf on/off");
}
-void copymenu_properties(Object *ob)
+static void copymenu_properties(Object *ob)
{
bProperty *prop, *propn, *propc;
Base *base;
@@ -2397,7 +2416,7 @@ void copymenu_properties(Object *ob)
BIF_undo_push("Copy properties");
}
-void copymenu_logicbricks(Object *ob)
+static void copymenu_logicbricks(Object *ob)
{
Base *base;
@@ -2431,11 +2450,79 @@ void copymenu_logicbricks(Object *ob)
BIF_undo_push("Copy logic");
}
+static void copymenu_modifiers(Object *ob)
+{
+ char str[512];
+ int i, event;
+ Base *base;
+
+ strcpy(str, "Copy Modifiers %t");
+
+ sprintf(str+strlen(str), "|All%%x%d|%%l", NUM_MODIFIER_TYPES);
+
+ for (i=eModifierType_None+1; i<NUM_MODIFIER_TYPES; i++) {
+ ModifierTypeInfo *mti = modifierType_get_info(i);
+
+ if ( (mti->flags&eModifierTypeFlag_AcceptsCVs) ||
+ (ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
+ sprintf(str+strlen(str), "|%s%%x%d", mti->name, i);
+ }
+ }
+
+ event = pupmenu(str);
+ if(event<=0) return;
+
+ for (base= FIRSTBASE; base; base= base->next) {
+ if(base->object != ob) {
+ if(TESTBASELIB(base)) {
+ ModifierData *md;
+
+ base->object->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
+
+ if (base->object->type==OB_MESH) {
+ if (event==NUM_MODIFIER_TYPES) {
+ while (base->object->modifiers.first) {
+ md = base->object->modifiers.first;
+ BLI_remlink(&base->object->modifiers, md);
+ modifier_free(md);
+ }
+
+ for (md=ob->modifiers.first; md; md=md->next) {
+ ModifierData *nmd = modifier_new(md->type);
+ modifier_copyData(md, nmd);
+ BLI_addtail(&base->object->modifiers, nmd);
+ }
+ } else {
+ ModifierData *md = modifiers_findByType(&ob->modifiers, event);
+
+ if (md) {
+ ModifierData *tmd = modifiers_findByType(&base->object->modifiers, event);
+
+ if (!tmd) {
+ tmd = modifier_new(event);
+ BLI_addtail(&base->object->modifiers, tmd);
+ }
+
+ modifier_copyData(md, tmd);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
+ DAG_scene_sort(G.scene);
+
+ BIF_undo_push("Copy modifiers");
+}
+
void copy_attr_menu()
{
Object *ob;
short event;
- char str[256];
+ char str[512];
/* If you change this menu, don't forget to update the menu in header_view3d.c
* view3d_edit_object_copyattrmenu() and in toolbox.c
@@ -2461,6 +2548,10 @@ void copy_attr_menu()
if(ob->soft) strcat(str, "|Soft Body Settings%x23");
+ if(ob->type==OB_MESH){
+ strcat(str, "|Modifiers ...%x24");
+ }
+
event= pupmenu(str);
if(event<= 0) return;
@@ -2497,6 +2588,10 @@ void copy_attr(short event)
copymenu_logicbricks(ob);
return;
}
+ else if(event==24) {
+ copymenu_modifiers(ob);
+ return;
+ }
base= FIRSTBASE;
while(base) {
@@ -2635,14 +2730,19 @@ void copy_attr(short event)
}
else if(event==21){
if (base->object->type==OB_MESH) {
- Mesh *targetme= base->object->data;
- Mesh *sourceme= ob->data;
+ ModifierData *md = modifiers_findByType(&ob->modifiers, eModifierType_Subsurf);
- targetme->flag= (targetme->flag&~ME_SUBSURF) | (sourceme->flag&ME_SUBSURF);
- targetme->subsurftype = sourceme->subsurftype;
- targetme->subdiv= sourceme->subdiv;
- targetme->subdivr= sourceme->subdivr;
- base->object->recalc |= OB_RECALC_DATA;
+ if (md) {
+ ModifierData *tmd = modifiers_findByType(&base->object->modifiers, eModifierType_Subsurf);
+
+ if (!tmd) {
+ tmd = modifier_new(eModifierType_Subsurf);
+ BLI_addtail(&base->object->modifiers, tmd);
+ }
+
+ modifier_copyData(md, tmd);
+ base->object->recalc |= OB_RECALC_DATA;
+ }
}
}
else if(event==22) {
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 0fd155fa855..1b4bf46003e 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -1710,6 +1710,8 @@ static void do_view3d_edit_object_copyattrmenu(void *arg, int event)
case 20:
case 21:
case 22:
+ case 23:
+ case 24:
copy_attr((short)event);
break;
}
@@ -1733,7 +1735,7 @@ static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Size|Ctrl C, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Drawtype|Ctrl C, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Time Offset|Ctrl C, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dupli|Ctrl C, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dupli|Ctrl C, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -1744,29 +1746,30 @@ static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Constraints|Ctrl C, 11", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Constraints|Ctrl C, 22", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
if (ob) {
if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
(ob->type == OB_FONT) || (ob->type == OB_MBALL)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Texture Space|Ctrl C, 12", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Texture Space|Ctrl C, 17", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
}
if(ob->type == OB_FONT) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Font Settings|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 14", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Font Settings|Ctrl C, 18", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 19", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
}
if(ob->type == OB_CURVE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 19", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
}
if(ob->type==OB_MESH) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdiv|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdiv|Ctrl C, 21", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Modifiers ...|Ctrl C, 24", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 24, "");
}
if( give_parteff(ob) ) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Particle Settings|Ctrl C, 14", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Particle Settings|Ctrl C, 20", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, "");
}
}
@@ -2161,10 +2164,9 @@ static uiBlock *view3d_edit_mesh_edgesmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mark Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- if (me->flag & ME_SUBSURF) {
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Crease SubSurf|Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- }
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Crease SubSurf|Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
+
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Edge CW|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index e104b404f39..9bf5468bf1e 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -1807,7 +1807,7 @@ static void tb_do_mesh(void *arg, int event){
case 2: G.f ^= G_DRAWEDGES; break;
case 3: G.f ^= G_DRAWFACES; break;
case 4: G.f ^= G_DRAWNORMALS; break;
- case 5: me->flag ^= ME_SUBSURF; DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); break;
+ case 5: flip_subdivison(OBACT, -1); break;
case 6: me->flag ^= ME_OPT_EDGES; DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); break;
}
addqueue(curarea->win, REDRAW, 1);
diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c
index 49395b17a98..c993564cd3d 100644
--- a/source/blender/src/vpaint.c
+++ b/source/blender/src/vpaint.c
@@ -225,8 +225,8 @@ void make_vertexcol() /* single ob */
{
Object *ob;
Mesh *me;
- DispList *dl;
-
+ int i;
+
/*
* Always copies from shadedisplist to mcol.
* When there are tfaces, it copies the colors and frees mcol
@@ -241,38 +241,14 @@ void make_vertexcol() /* single ob */
me= get_mesh(ob);
if(me==0) return;
- /* to be able to copy lighting info, we only use it from single side (ton) */
- if(me->flag & ME_TWOSIDED) {
- me->flag &= ~ME_TWOSIDED;
- }
-
- /* but subsurf vertex colors are wrong */
- if (me->flag & ME_SUBSURF) {
- if(me->mcol) MEM_freeN(me->mcol);
- me->mcol= MEM_callocN(4*me->totface*sizeof(MCol), "mcol");
- }
- else {
- dl= ob->disp.first;
-
- if(dl==NULL || dl->col1==NULL) {
- shadeDispList(ob);
- dl= find_displist(&ob->disp, DL_VERTCOL);
- }
- if(dl && dl->col1) {
- if(me->mcol) MEM_freeN(me->mcol);
- me->mcol= MEM_dupallocN(dl->col1);
- }
+ if(me->mcol) MEM_freeN(me->mcol);
+ mesh_create_shadedColors(ob, 1, (unsigned int**) &me->mcol, NULL);
+
+ for (i=0; i<me->totface*4; i++) {
+ me->mcol[i].a = 255;
}
-
- if(me->mcol) {
- int i;
- for (i=0; i<me->totface*4; i++) {
- MCol *mcol= &me->mcol[i];
- mcol->a= 255;
- }
- if(me->tface) mcol_to_tface(me, 1);
- }
+ if(me->tface) mcol_to_tface(me, 1);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);