forked from bartvdbraak/blender
svn merge ^/trunk/blender -r42416:42422
This commit is contained in:
commit
3267a619f1
@ -174,12 +174,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);
|
||||
|
@ -387,24 +387,12 @@ void unlink_mesh(Mesh *me)
|
||||
if(me->texcomesh) me->texcomesh= NULL;
|
||||
}
|
||||
|
||||
|
||||
/* do not free mesh itself */
|
||||
void free_mesh(Mesh *me, int unlink)
|
||||
{
|
||||
if (unlink)
|
||||
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);
|
||||
@ -520,7 +508,6 @@ Mesh *copy_mesh(Mesh *me)
|
||||
|
||||
men->mselect= NULL;
|
||||
men->edit_btmesh= NULL;
|
||||
men->pv= NULL; /* looks like this is no-longer supported but NULL just incase */
|
||||
|
||||
men->bb= MEM_dupallocN(men->bb);
|
||||
|
||||
@ -2109,72 +2096,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;
|
||||
}
|
||||
}
|
||||
|
||||
void mesh_loops_to_tri_corners(CustomData *fdata, CustomData *ldata,
|
||||
CustomData *pdata, int lindex[3], int findex,
|
||||
int polyindex)
|
||||
|
@ -3798,22 +3798,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);
|
||||
direct_link_customdata(fd, &mesh->ldata, mesh->totloop);
|
||||
direct_link_customdata(fd, &mesh->pdata, mesh->totpoly);
|
||||
|
||||
@ -3869,7 +3860,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,30 +1691,11 @@ 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);
|
||||
/* BMESH_TODO: probably need to deal with polys here */
|
||||
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);
|
||||
write_customdata(wd, &mesh->id, mesh->totloop, &mesh->ldata, -1, 0);
|
||||
write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, -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);
|
||||
write_customdata(wd, &mesh->id, mesh->totloop, &mesh->ldata, -1, 0);
|
||||
write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, -1, 0);
|
||||
}
|
||||
mesh= mesh->id.next;
|
||||
}
|
||||
|
@ -1475,14 +1475,18 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float zoomx, float zoomy)
|
||||
{
|
||||
ImBuf *scaleibuf;
|
||||
int x, y, w= ibuf->x*zoomx, h= ibuf->y*zoomy;
|
||||
const float scalex= 1.0f/zoomx;
|
||||
const float scaley= 1.0f/zoomy;
|
||||
|
||||
scaleibuf= IMB_allocImBuf(w, h, 32, IB_rect);
|
||||
|
||||
for(y= 0; y<scaleibuf->y; y++) {
|
||||
for (x= 0; x<scaleibuf->x; x++) {
|
||||
int pixel= scaleibuf->x*y + x;
|
||||
int orig_pixel= ibuf->x*(int)(((float)y)/zoomy) + (int)(((float)x)/zoomx);
|
||||
int orig_pixel= ibuf->x*(int)(scaley*(float)y) + (int)(scalex*(float)x);
|
||||
char *rrgb= (char*)scaleibuf->rect + pixel*4;
|
||||
char *orig_rrgb= (char*)ibuf->rect + orig_pixel*4;
|
||||
|
||||
rrgb[0]= orig_rrgb[0];
|
||||
rrgb[1]= orig_rrgb[1];
|
||||
rrgb[2]= orig_rrgb[2];
|
||||
|
@ -440,9 +440,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
|
||||
|
||||
|
@ -468,7 +468,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, 0);
|
||||
if (!dm) {
|
||||
@ -518,8 +517,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);
|
||||
|
@ -53,7 +53,6 @@ struct MLoop;
|
||||
struct MLoopUV;
|
||||
struct MLoopCol;
|
||||
struct Multires;
|
||||
struct PartialVisibility;
|
||||
struct EditMesh;
|
||||
struct AnimData;
|
||||
|
||||
@ -117,7 +116,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 */
|
||||
|
@ -199,14 +199,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;
|
||||
|
Loading…
Reference in New Issue
Block a user