remove mesh PartialVisibility, it wasnt being version patches or used anywhere, other then save/load/free.

This commit is contained in:
Campbell Barton 2011-12-04 19:49:35 +00:00
parent 229dd30f37
commit bf77a177d4
8 changed files with 8 additions and 136 deletions

@ -132,12 +132,6 @@ void create_vert_face_map(ListBase **map, IndexNode **mem, const struct MFace *m
void create_vert_edge_map(ListBase **map, IndexNode **mem, const struct MEdge *medge,
const int totvert, const int totedge);
/* Partial Mesh Visibility */
struct PartialVisibility *mesh_pmv_copy(struct PartialVisibility *);
void mesh_pmv_free(struct PartialVisibility *);
void mesh_pmv_revert(struct Mesh *me);
void mesh_pmv_off(struct Mesh *me);
/* functions for making menu's from customdata layers */
int mesh_layers_menu_charlen(struct CustomData *data, int type); /* use this to work out how many chars to allocate */
void mesh_layers_menu_concat(struct CustomData *data, int type, char *str);

@ -113,23 +113,11 @@ void unlink_mesh(Mesh *me)
if(me->texcomesh) me->texcomesh= NULL;
}
/* do not free mesh itself */
void free_mesh(Mesh *me)
{
unlink_mesh(me);
if(me->pv) {
if(me->pv->vert_map) MEM_freeN(me->pv->vert_map);
if(me->pv->edge_map) MEM_freeN(me->pv->edge_map);
if(me->pv->old_faces) MEM_freeN(me->pv->old_faces);
if(me->pv->old_edges) MEM_freeN(me->pv->old_edges);
me->totvert= me->pv->totvert;
me->totedge= me->pv->totedge;
me->totface= me->pv->totface;
MEM_freeN(me->pv);
}
CustomData_free(&me->vdata, me->totvert);
CustomData_free(&me->edata, me->totedge);
CustomData_free(&me->fdata, me->totface);
@ -230,7 +218,6 @@ Mesh *copy_mesh(Mesh *me)
men->mselect= NULL;
men->edit_mesh= NULL;
men->pv= NULL; /* looks like this is no-longer supported but NULL just incase */
men->bb= MEM_dupallocN(men->bb);
@ -1456,72 +1443,6 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const MEdge *medge, c
}
}
/* Partial Mesh Visibility */
PartialVisibility *mesh_pmv_copy(PartialVisibility *pmv)
{
PartialVisibility *n= MEM_dupallocN(pmv);
n->vert_map= MEM_dupallocN(pmv->vert_map);
n->edge_map= MEM_dupallocN(pmv->edge_map);
n->old_edges= MEM_dupallocN(pmv->old_edges);
n->old_faces= MEM_dupallocN(pmv->old_faces);
return n;
}
void mesh_pmv_free(PartialVisibility *pv)
{
MEM_freeN(pv->vert_map);
MEM_freeN(pv->edge_map);
MEM_freeN(pv->old_faces);
MEM_freeN(pv->old_edges);
MEM_freeN(pv);
}
void mesh_pmv_revert(Mesh *me)
{
if(me->pv) {
unsigned i;
MVert *nve, *old_verts;
/* Reorder vertices */
nve= me->mvert;
old_verts = MEM_mallocN(sizeof(MVert)*me->pv->totvert,"PMV revert verts");
for(i=0; i<me->pv->totvert; ++i)
old_verts[i]= nve[me->pv->vert_map[i]];
/* Restore verts, edges and faces */
CustomData_free_layer_active(&me->vdata, CD_MVERT, me->totvert);
CustomData_free_layer_active(&me->edata, CD_MEDGE, me->totedge);
CustomData_free_layer_active(&me->fdata, CD_MFACE, me->totface);
CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, old_verts, me->pv->totvert);
CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->pv->old_edges, me->pv->totedge);
CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->pv->old_faces, me->pv->totface);
mesh_update_customdata_pointers(me);
me->totvert= me->pv->totvert;
me->totedge= me->pv->totedge;
me->totface= me->pv->totface;
me->pv->old_edges= NULL;
me->pv->old_faces= NULL;
/* Free maps */
MEM_freeN(me->pv->edge_map);
me->pv->edge_map= NULL;
MEM_freeN(me->pv->vert_map);
me->pv->vert_map= NULL;
}
}
void mesh_pmv_off(Mesh *me)
{
if(me->pv) {
mesh_pmv_revert(me);
MEM_freeN(me->pv);
me->pv= NULL;
}
}
/* basic vertex data functions */
int minmax_mesh(Mesh *me, float min[3], float max[3])
{

@ -3718,22 +3718,13 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
mesh->adt= newdataadr(fd, mesh->adt);
direct_link_animdata(fd, mesh->adt);
/* Partial-mesh visibility (do this before using totvert, totface, or totedge!) */
mesh->pv= newdataadr(fd, mesh->pv);
if(mesh->pv) {
mesh->pv->vert_map= newdataadr(fd, mesh->pv->vert_map);
mesh->pv->edge_map= newdataadr(fd, mesh->pv->edge_map);
mesh->pv->old_faces= newdataadr(fd, mesh->pv->old_faces);
mesh->pv->old_edges= newdataadr(fd, mesh->pv->old_edges);
}
/* normally direct_link_dverts should be called in direct_link_customdata,
but for backwards compat in do_versions to work we do it here */
direct_link_dverts(fd, mesh->pv ? mesh->pv->totvert : mesh->totvert, mesh->dvert);
direct_link_dverts(fd, mesh->totvert, mesh->dvert);
direct_link_customdata(fd, &mesh->vdata, mesh->pv ? mesh->pv->totvert : mesh->totvert);
direct_link_customdata(fd, &mesh->edata, mesh->pv ? mesh->pv->totedge : mesh->totedge);
direct_link_customdata(fd, &mesh->fdata, mesh->pv ? mesh->pv->totface : mesh->totface);
direct_link_customdata(fd, &mesh->vdata, mesh->totvert);
direct_link_customdata(fd, &mesh->edata, mesh->totedge);
direct_link_customdata(fd, &mesh->fdata, mesh->totface);
mesh->bb= NULL;
mesh->mselect = NULL;
@ -3787,7 +3778,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
TFace *tf= mesh->tface;
unsigned int i;
for (i=0; i< (mesh->pv ? mesh->pv->totface : mesh->totface); i++, tf++) {
for (i=0; i< (mesh->totface); i++, tf++) {
SWITCH_INT(tf->col[0]);
SWITCH_INT(tf->col[1]);
SWITCH_INT(tf->col[2]);

@ -1691,27 +1691,9 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
if(mesh->pv) {
write_customdata(wd, &mesh->id, mesh->pv->totvert, &mesh->vdata, -1, 0);
write_customdata(wd, &mesh->id, mesh->pv->totedge, &mesh->edata,
CD_MEDGE, mesh->totedge);
write_customdata(wd, &mesh->id, mesh->pv->totface, &mesh->fdata,
CD_MFACE, mesh->totface);
}
else {
write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, -1, 0);
write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, -1, 0);
write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, -1, 0);
}
/* PMV data */
if(mesh->pv) {
writestruct(wd, DATA, "PartialVisibility", 1, mesh->pv);
writedata(wd, DATA, sizeof(unsigned int)*mesh->pv->totvert, mesh->pv->vert_map);
writedata(wd, DATA, sizeof(int)*mesh->pv->totedge, mesh->pv->edge_map);
writestruct(wd, DATA, "MFace", mesh->pv->totface, mesh->pv->old_faces);
writestruct(wd, DATA, "MEdge", mesh->pv->totedge, mesh->pv->old_edges);
}
write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, -1, 0);
write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, -1, 0);
write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, -1, 0);
}
mesh= mesh->id.next;
}

@ -439,9 +439,6 @@ void ED_object_enter_editmode(bContext *C, int flag)
ob->mode= OB_MODE_EDIT;
if(ob->type==OB_MESH) {
Mesh *me= ob->data;
if(me->pv) mesh_pmv_off(me);
ok= 1;
scene->obedit= ob; // context sees this

@ -456,7 +456,6 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes");
return 0;
}
mesh_pmv_off(me);
dm = mesh_create_derived_for_modifier(scene, ob, md);
if (!dm) {
@ -506,8 +505,6 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
return 0;
}
mesh_pmv_off(me);
/* Multires: ensure that recent sculpting is applied */
if(md->type == eModifierType_Multires)
multires_force_update(ob);

@ -48,7 +48,6 @@ struct MSticky;
struct Mesh;
struct OcInfo;
struct Multires;
struct PartialVisibility;
struct EditMesh;
struct AnimData;
@ -100,7 +99,6 @@ typedef struct Mesh {
short totcol;
struct Multires *mr DNA_DEPRECATED; /* deprecated multiresolution modeling data, only keep for loading old files */
struct PartialVisibility *pv;
} Mesh;
/* deprecated by MTFace, only here for file reading */

@ -174,14 +174,6 @@ typedef struct Multires {
/** End Multires **/
typedef struct PartialVisibility {
unsigned int *vert_map; /* vert_map[Old Index]= New Index */
int *edge_map; /* edge_map[Old Index]= New Index, -1= hidden */
MFace *old_faces;
MEdge *old_edges;
unsigned int totface, totedge, totvert, pad;
} PartialVisibility;
typedef struct MRecast{
int i;
} MRecast;