diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-11-20 07:28:02 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-11-20 07:28:02 +0300 |
commit | e435fbc3c5a00e5b63c1cd2609ab6828187660d3 (patch) | |
tree | 3f1da9c51451dee55a203cd001d37f8774d2582f /source/blender/src/editmesh_mods.c | |
parent | 0a7c43c6e5fc7d5d75a4645eca1164cede2d03a6 (diff) |
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
Diffstat (limited to 'source/blender/src/editmesh_mods.c')
-rw-r--r-- | source/blender/src/editmesh_mods.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 95a0e85a20d..f0b1aa7ebd6 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -625,8 +625,7 @@ static void draw_dm_mapped_face_center(DerivedMesh *dm, EditFace *efa) static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa) { - int dmNeedsFree; - DerivedMesh *dm = editmesh_get_derived_cage(&dmNeedsFree); + DerivedMesh *dm = editmesh_get_derived_cage(); glDrawBuffer(GL_FRONT); @@ -714,9 +713,7 @@ static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa) /* signal that frontbuf differs from back */ curarea->win_swap= WIN_FRONT_OK; - if (dmNeedsFree) { - dm->release(dm); - } + dm->release(dm); } @@ -825,18 +822,18 @@ int facegroup_select(short mode) } } } else if (mode==2) { /* same image */ - TFace *tf, *base_tf; + MTFace *tf, *base_tf; - base_tf = (TFace*)CustomData_em_get(&em->fdata, base_efa->data, - LAYERTYPE_TFACE); + base_tf = (MTFace*)CustomData_em_get(&em->fdata, base_efa->data, + CD_MTFACE); if(!base_tf) return selcount; for(efa= em->faces.first; efa; efa= efa->next) { if (!(efa->f & SELECT) && !efa->h) { - tf = (TFace*)CustomData_em_get(&em->fdata, efa->data, - LAYERTYPE_TFACE); + tf = (MTFace*)CustomData_em_get(&em->fdata, efa->data, + CD_MTFACE); if(base_tf->tpage == tf->tpage) { EM_select_face(efa, 1); @@ -1172,14 +1169,14 @@ int vertgroup_select(short mode) short i, j; /* weight index */ base_dvert= CustomData_em_get(&em->vdata, base_eve->data, - LAYERTYPE_MDEFORMVERT); + CD_MDEFORMVERT); if (!base_dvert || base_dvert->totweight == 0) return selcount; for(eve= em->verts.first; eve; eve= eve->next) { dvert= CustomData_em_get(&em->vdata, eve->data, - LAYERTYPE_MDEFORMVERT); + CD_MDEFORMVERT); if (dvert && !(eve->f & SELECT) && !eve->h && dvert->totweight) { /* do the extra check for selection in the following if, so were not @@ -2903,7 +2900,7 @@ static void editmesh_calc_selvert_center(float cent_r[3]) } } -static int tface_is_selected(TFace *tf) +static int tface_is_selected(MTFace *tf) { return (!(tf->flag & TF_HIDE) && (tf->flag & TF_SELECT)); } @@ -2921,7 +2918,7 @@ void faceselect_align_view_to_selected(View3D *v3d, Mesh *me, int axis) norm[0]= norm[1]= norm[2]= 0.0; for (i=0; i<me->totface; i++) { MFace *mf= ((MFace*) me->mface) + i; - TFace *tf= ((TFace*) me->tface) + i; + MTFace *tf= ((MTFace*) me->mtface) + i; if (tface_is_selected(tf)) { float *v1, *v2, *v3, fno[3]; |