diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-30 23:20:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-30 23:20:17 +0400 |
commit | 00acdb629254b680992f1863a1d62cd2985198af (patch) | |
tree | e29b23a247a6111dc47f508cab01e2a5d955b983 /source/blender/editors/space_view3d/drawobject.c | |
parent | 6bd18e357563f6b28f7cfdf6da8a032bab947172 (diff) |
remove CD_POLYINDEX customdata layer:
reported as [#29376] BMESH_TODO: remove tessface CD_ORIGINDEX layer
for a single mesh there could be 3 origindex mappings stored, one on the polygons and 2 on the tessfaces.
(CD_POLYINDEX and CD_ORIGINDEX).
as Andrew suggests, now tessfaces (which are really a cache of polygons), using origindex to point to polygons on
the same derived mesh, and polygons only store the original index values.
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 04549b53b6a..16d66eb6f9a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -132,7 +132,8 @@ typedef struct drawDMFacesSel_userData { BMEditMesh *em; /* BMESH BRANCH ONLY */ BMFace *efa_act; - int *orig_index; + int *orig_index_mf_to_mpoly; + int *orig_index_mp_to_orig; } drawDMFacesSel_userData; typedef struct drawDMNormal_userData { @@ -2310,11 +2311,11 @@ static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int unsigned char *col, *next_col; - if (!data->orig_index) + if (!data->orig_index_mf_to_mpoly) return 0; - efa = EDBM_face_at_index(data->em, data->orig_index[index]); - next_efa = EDBM_face_at_index(data->em, data->orig_index[next_index]); + efa = EDBM_face_at_index(data->em, DM_origindex_mface_mpoly(data->orig_index_mf_to_mpoly, data->orig_index_mp_to_orig, index)); + next_efa = EDBM_face_at_index(data->em, DM_origindex_mface_mpoly(data->orig_index_mf_to_mpoly, data->orig_index_mp_to_orig, next_index)); if (efa == next_efa) return 1; @@ -2342,7 +2343,12 @@ static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba data.cols[1] = selCol; data.cols[2] = actCol; data.efa_act = efa_act; - data.orig_index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX); + /* double lookup */ + data.orig_index_mf_to_mpoly = DM_get_tessface_data_layer(dm, CD_ORIGINDEX); + data.orig_index_mp_to_orig = DM_get_poly_data_layer(dm, CD_ORIGINDEX); + if ((data.orig_index_mf_to_mpoly && data.orig_index_mp_to_orig) == FALSE) { + data.orig_index_mf_to_mpoly = data.orig_index_mp_to_orig = NULL; + } dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions, &data, 0); } |