- added editmesh_[de]select_by_material function
- added mesh_set_smooth_flag, mesh_delete_material_index function - isolated some globals - got rid of reliance on meshdata in buttons_editing.c and material.c
This commit is contained in:
@@ -75,6 +75,8 @@ void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert);
|
|||||||
int mesh_uses_displist(struct Mesh *me);
|
int mesh_uses_displist(struct Mesh *me);
|
||||||
float get_mvert_weight (struct Object *ob, int vert, int defgroup);
|
float get_mvert_weight (struct Object *ob, int vert, int defgroup);
|
||||||
int update_realtime_texture(struct TFace *tface, double time);
|
int update_realtime_texture(struct TFace *tface, double time);
|
||||||
|
void mesh_delete_material_index(struct Mesh *me, int index);
|
||||||
|
void mesh_set_smooth_flag(struct Mesh *me, int enableSmooth);
|
||||||
|
|
||||||
/** Generate the mesh vertex normals by averaging over connected faces.
|
/** Generate the mesh vertex normals by averaging over connected faces.
|
||||||
*
|
*
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
#include "DNA_meshdata_types.h"
|
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_curve_types.h"
|
#include "DNA_curve_types.h"
|
||||||
#include "DNA_meta_types.h"
|
#include "DNA_meta_types.h"
|
||||||
@@ -679,10 +678,8 @@ void delete_material_index()
|
|||||||
{
|
{
|
||||||
Material *mao, ***matarar;
|
Material *mao, ***matarar;
|
||||||
Object *ob, *obt;
|
Object *ob, *obt;
|
||||||
Mesh *me;
|
|
||||||
Curve *cu;
|
Curve *cu;
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
MFace *mface;
|
|
||||||
short *totcolp;
|
short *totcolp;
|
||||||
int a, actcol;
|
int a, actcol;
|
||||||
|
|
||||||
@@ -745,13 +742,8 @@ void delete_material_index()
|
|||||||
/* check indices from mesh */
|
/* check indices from mesh */
|
||||||
|
|
||||||
if(ob->type==OB_MESH) {
|
if(ob->type==OB_MESH) {
|
||||||
me= get_mesh(ob);
|
Mesh *me= get_mesh(ob);
|
||||||
mface= me->mface;
|
mesh_delete_material_index(me, actcol-1);
|
||||||
a= me->totface;
|
|
||||||
while(a--) {
|
|
||||||
if(mface->mat_nr && mface->mat_nr>=actcol-1) mface->mat_nr--;
|
|
||||||
mface++;
|
|
||||||
}
|
|
||||||
makeDispList(ob);
|
makeDispList(ob);
|
||||||
}
|
}
|
||||||
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
|
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
|
||||||
|
@@ -1148,3 +1148,27 @@ void mesh_calculate_vertex_normals(Mesh *me)
|
|||||||
|
|
||||||
MEM_freeN(tempNorms);
|
MEM_freeN(tempNorms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mesh_delete_material_index(Mesh *me, int index) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i<me->totface; i++) {
|
||||||
|
MFace *mf = &((MFace*) me->mface)[i];
|
||||||
|
if (mf->mat_nr && mf->mat_nr>=index)
|
||||||
|
mf->mat_nr--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mesh_set_smooth_flag(Mesh *me, int enableSmooth) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i<me->totface; i++) {
|
||||||
|
MFace *mf = &((MFace*) me->mface)[i];
|
||||||
|
|
||||||
|
if (enableSmooth) {
|
||||||
|
mf->flag |= ME_SMOOTH;
|
||||||
|
} else {
|
||||||
|
mf->flag &= ~ME_SMOOTH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1025,7 +1025,6 @@ void ob_parlimb(Object *ob, Object *par, float mat[][4])
|
|||||||
void give_parvert(Object *par, int nr, float *vec)
|
void give_parvert(Object *par, int nr, float *vec)
|
||||||
{
|
{
|
||||||
Mesh *me;
|
Mesh *me;
|
||||||
MVert *mvert;
|
|
||||||
EditVert *eve;
|
EditVert *eve;
|
||||||
/* extern ListBase editNurb; already in bad lev calls */
|
/* extern ListBase editNurb; already in bad lev calls */
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
@@ -1065,7 +1064,7 @@ void give_parvert(Object *par, int nr, float *vec)
|
|||||||
VECCOPY(vec, fp);
|
VECCOPY(vec, fp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mvert= me->mvert + nr;
|
MVert *mvert= me->mvert + nr;
|
||||||
VECCOPY(vec, mvert->co);
|
VECCOPY(vec, mvert->co);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -164,5 +164,8 @@ void select_more(void);
|
|||||||
void select_less(void);
|
void select_less(void);
|
||||||
void selectrandom_mesh(void);
|
void selectrandom_mesh(void);
|
||||||
|
|
||||||
|
void editmesh_select_by_material(int index);
|
||||||
|
void editmesh_deselect_by_material(int index);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -152,12 +152,12 @@
|
|||||||
|
|
||||||
#include "butspace.h" // own module
|
#include "butspace.h" // own module
|
||||||
|
|
||||||
int decim_faces=0;
|
static int decim_faces=0;
|
||||||
short degr= 90, step= 9, turn= 1, editbutflag= 1;
|
static short degr= 90, step= 9, turn= 1;
|
||||||
float doublimit= 0.001;
|
static float extr_offs= 1.0;
|
||||||
float editbutvweight=1;
|
static float editbutweight=1.0;
|
||||||
float extr_offs= 1.0, editbutweight=1.0, editbutsize=0.1, cumapsize= 1.0;
|
short editbutflag= 1;
|
||||||
|
float doublimit= 0.001, editbutvweight=1, editbutsize=0.1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -95,7 +95,6 @@
|
|||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
#include "DNA_meta_types.h"
|
#include "DNA_meta_types.h"
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
#include "DNA_meshdata_types.h"
|
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_radio_types.h"
|
#include "DNA_radio_types.h"
|
||||||
#include "DNA_screen_types.h"
|
#include "DNA_screen_types.h"
|
||||||
@@ -131,7 +130,8 @@
|
|||||||
|
|
||||||
#include "butspace.h" // own module
|
#include "butspace.h" // own module
|
||||||
|
|
||||||
float hspeed=0.1, prspeed=0.0, prlen=0.0;
|
static float hspeed=0.1, prspeed=0.0;
|
||||||
|
float prlen=0.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -938,7 +938,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
|||||||
Mesh *me;
|
Mesh *me;
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
Curve *cu;
|
Curve *cu;
|
||||||
MFace *mface;
|
|
||||||
BezTriple *bezt;
|
BezTriple *bezt;
|
||||||
BPoint *bp;
|
BPoint *bp;
|
||||||
unsigned int local;
|
unsigned int local;
|
||||||
@@ -1017,23 +1016,10 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
|||||||
case B_MATDESEL:
|
case B_MATDESEL:
|
||||||
if(G.obedit) {
|
if(G.obedit) {
|
||||||
if(G.obedit->type == OB_MESH) {
|
if(G.obedit->type == OB_MESH) {
|
||||||
evl= G.edvl.first;
|
if (event==B_MATSEL) {
|
||||||
while(evl) {
|
editmesh_select_by_material(G.obedit->actcol-1);
|
||||||
if(evl->mat_nr== G.obedit->actcol-1) {
|
} else {
|
||||||
if(event==B_MATSEL) {
|
editmesh_deselect_by_material(G.obedit->actcol-1);
|
||||||
if(evl->v1->h==0) evl->v1->f |= 1;
|
|
||||||
if(evl->v2->h==0) evl->v2->f |= 1;
|
|
||||||
if(evl->v3->h==0) evl->v3->f |= 1;
|
|
||||||
if(evl->v4 && evl->v4->h==0) evl->v4->f |= 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(evl->v1->h==0) evl->v1->f &= ~1;
|
|
||||||
if(evl->v2->h==0) evl->v2->f &= ~1;
|
|
||||||
if(evl->v3->h==0) evl->v3->f &= ~1;
|
|
||||||
if(evl->v4 && evl->v4->h==0) evl->v4->f &= ~1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
evl= evl->next;
|
|
||||||
}
|
}
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
}
|
}
|
||||||
@@ -1151,12 +1137,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
|||||||
if(TESTBASELIB(base)) {
|
if(TESTBASELIB(base)) {
|
||||||
if(base->object->type==OB_MESH) {
|
if(base->object->type==OB_MESH) {
|
||||||
me= base->object->data;
|
me= base->object->data;
|
||||||
mface= me->mface;
|
mesh_set_smooth_flag(me, (event==B_SETSMOOTH));
|
||||||
for(a=0; a<me->totface; a++, mface++) {
|
|
||||||
if(event==B_SETSMOOTH) mface->flag |= ME_SMOOTH;
|
|
||||||
else mface->flag &= ~ME_SMOOTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
makeDispList(base->object);
|
makeDispList(base->object);
|
||||||
}
|
}
|
||||||
else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
|
else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
|
||||||
|
@@ -95,6 +95,7 @@
|
|||||||
#include "BSE_trans_types.h"
|
#include "BSE_trans_types.h"
|
||||||
#endif /* NAN_TPT */
|
#endif /* NAN_TPT */
|
||||||
|
|
||||||
|
static cumapsize= 1.0;
|
||||||
TFace *lasttface=0;
|
TFace *lasttface=0;
|
||||||
|
|
||||||
void set_lasttface()
|
void set_lasttface()
|
||||||
@@ -633,7 +634,6 @@ void uv_autocalc_tface()
|
|||||||
MFace *mface;
|
MFace *mface;
|
||||||
MVert *mv;
|
MVert *mv;
|
||||||
Object *ob;
|
Object *ob;
|
||||||
extern float cumapsize; /* buttons.c */
|
|
||||||
float dx, dy, min[3], cent[3], max[3], no[3], *loc, mat[4][4];
|
float dx, dy, min[3], cent[3], max[3], no[3], *loc, mat[4][4];
|
||||||
float fac = 1.0;
|
float fac = 1.0;
|
||||||
|
|
||||||
|
@@ -9638,3 +9638,29 @@ void vertex_loop_select()
|
|||||||
SetBlenderCursor(SYSCURSOR);
|
SetBlenderCursor(SYSCURSOR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void editmesh_select_by_material(int index) {
|
||||||
|
EditVlak *evl;
|
||||||
|
|
||||||
|
for (evl=G.edvl.first; evl; evl= evl->next) {
|
||||||
|
if (evl->mat_nr==index) {
|
||||||
|
if(evl->v1->h==0) evl->v1->f |= 1;
|
||||||
|
if(evl->v2->h==0) evl->v2->f |= 1;
|
||||||
|
if(evl->v3->h==0) evl->v3->f |= 1;
|
||||||
|
if(evl->v4 && evl->v4->h==0) evl->v4->f |= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void editmesh_deselect_by_material(int index) {
|
||||||
|
EditVlak *evl;
|
||||||
|
|
||||||
|
for (evl=G.edvl.first; evl; evl= evl->next) {
|
||||||
|
if (evl->mat_nr==index) {
|
||||||
|
if(evl->v1->h==0) evl->v1->f &= ~1;
|
||||||
|
if(evl->v2->h==0) evl->v2->f &= ~1;
|
||||||
|
if(evl->v3->h==0) evl->v3->f &= ~1;
|
||||||
|
if(evl->v4 && evl->v4->h==0) evl->v4->f &= ~1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1162,13 +1162,13 @@ void docentre(void)
|
|||||||
Object *ob;
|
Object *ob;
|
||||||
Mesh *me, *tme;
|
Mesh *me, *tme;
|
||||||
Curve *cu;
|
Curve *cu;
|
||||||
MVert *mvert;
|
|
||||||
// BezTriple *bezt;
|
// BezTriple *bezt;
|
||||||
// BPoint *bp;
|
// BPoint *bp;
|
||||||
Nurb *nu, *nu1;
|
Nurb *nu, *nu1;
|
||||||
EditVert *eve;
|
EditVert *eve;
|
||||||
float cent[3], centn[3], min[3], max[3], omat[3][3];
|
float cent[3], centn[3], min[3], max[3], omat[3][3];
|
||||||
int a;
|
int a;
|
||||||
|
MVert *mvert;
|
||||||
|
|
||||||
if(G.scene->id.lib) return;
|
if(G.scene->id.lib) return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user