diff options
author | Sebastian Parborg <zeddb> | 2018-09-27 16:54:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-09-27 21:19:28 +0300 |
commit | a16e5b8efa8be09362d5e56812221db4705b0e26 (patch) | |
tree | 2ad732c5d0b78e345a1f0aaef1dbcc36bc1c509f /source/blender/editors | |
parent | 975a40dceb560a6bfc67b1562829acc541fa5716 (diff) |
Cleanup: remove unused DerivedMesh code.
Differential Revision: https://developer.blender.org/D3736
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 1 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 1 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 15 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_intern.h | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex_proj.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 276 |
7 files changed, 26 insertions, 288 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 8f5f25f887f..52e8c4eeace 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -86,7 +86,6 @@ void EDBM_selectmode_to_scene(struct bContext *C); void EDBM_mesh_make(struct Object *ob, const int select_mode, const bool add_key_index); void EDBM_mesh_free(struct BMEditMesh *em); void EDBM_mesh_load(struct Main *bmain, struct Object *ob); -struct DerivedMesh *EDBM_mesh_deform_dm_get(struct BMEditMesh *em); /* flushes based on the current select mode. if in vertex select mode, * verts select/deselect edges and faces, if in edge select mode, diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index f239ccc5be1..1ca3549090f 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -44,7 +44,6 @@ #include "BKE_modifier.h" #include "BKE_report.h" #include "BKE_editmesh.h" -#include "BKE_DerivedMesh.h" #include "BKE_unit.h" #include "BKE_layer.h" diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 37f5aa806de..7fdef86f7e5 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -328,7 +328,7 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index) } /** - * \warning This can invalidate the #DerivedMesh cache of other objects (for linked duplicates). + * \warning This can invalidate the #Mesh runtime cache of other objects (for linked duplicates). * Most callers should run #DEG_id_tag_update on \a ob->data, see: T46738, T46913 */ void EDBM_mesh_load(Main *bmain, Object *ob) @@ -1368,19 +1368,6 @@ void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_d /** \} */ /* -------------------------------------------------------------------- */ -/** \name Data Access - * \{ */ - -DerivedMesh *EDBM_mesh_deform_dm_get(BMEditMesh *em) -{ - return ((em->derivedFinal != NULL) && - (em->derivedFinal->type == DM_TYPE_EDITBMESH) && - (em->derivedFinal->deformedOnly != false)) ? em->derivedFinal : NULL; -} - -/** \} */ - -/* -------------------------------------------------------------------- */ /** \name Operator Helpers * \{ */ diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 7d3049434d6..c74dc252d0c 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -54,10 +54,14 @@ struct wmEvent; struct wmOperator; struct wmOperatorType; struct wmWindowManager; -struct DMCoNo; struct UndoStep; enum ePaintMode; +typedef struct CoNo { + float co[3]; + float no[3]; +} CoNo; + /* paint_stroke.c */ typedef bool (*StrokeGetLocation)(struct bContext *C, float location[3], const float mouse[2]); typedef bool (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, const float mouse[2]); @@ -161,7 +165,7 @@ void PAINT_OT_weight_sample_group(struct wmOperatorType *ot); struct VertProjHandle; struct VertProjHandle *ED_vpaint_proj_handle_create( struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, - struct DMCoNo **r_vcosnos); + struct CoNo **r_vcosnos); void ED_vpaint_proj_handle_update( struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle, /* runtime vars */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index d62865b44d0..4821fd4fef4 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2472,7 +2472,7 @@ struct VPaintData { uint paintcol; struct VertProjHandle *vp_handle; - struct DMCoNo *vertexcosnos; + struct CoNo *vertexcosnos; /* modify 'me->mcol' directly, since the derived mesh is drawing from this * array, otherwise we need to refresh the modifier stack */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c index 602bfe1ab8e..31ae12c112a 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c @@ -39,7 +39,6 @@ #include "DNA_mesh_types.h" #include "DNA_object_types.h" -#include "BKE_DerivedMesh.h" /* XXX To be removed, only used for DMCoNo struct */ #include "BKE_context.h" #include "BKE_mesh_iterators.h" #include "BKE_mesh_runtime.h" @@ -56,7 +55,7 @@ /* stored while painting */ struct VertProjHandle { - DMCoNo *vcosnos; + CoNo *vcosnos; bool use_update; @@ -85,7 +84,7 @@ static void vpaint_proj_dm_map_cosnos_init__map_cb( const float no_f[3], const short no_s[3]) { struct VertProjHandle *vp_handle = userData; - DMCoNo *co_no = &vp_handle->vcosnos[index]; + CoNo *co_no = &vp_handle->vcosnos[index]; /* check if we've been here before (normal should not be 0) */ if (!is_zero_v3(co_no->no)) { @@ -127,7 +126,7 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb( struct VertProjUpdate *vp_update = userData; struct VertProjHandle *vp_handle = vp_update->vp_handle; - DMCoNo *co_no = &vp_handle->vcosnos[index]; + CoNo *co_no = &vp_handle->vcosnos[index]; /* find closest vertex */ { @@ -187,13 +186,13 @@ static void vpaint_proj_dm_map_cosnos_update( struct VertProjHandle *ED_vpaint_proj_handle_create( struct Depsgraph *depsgraph, Scene *scene, Object *ob, - DMCoNo **r_vcosnos) + CoNo **r_vcosnos) { struct VertProjHandle *vp_handle = MEM_mallocN(sizeof(struct VertProjHandle), __func__); Mesh *me = ob->data; /* setup the handle */ - vp_handle->vcosnos = MEM_mallocN(sizeof(DMCoNo) * me->totvert, "vertexcosnos map"); + vp_handle->vcosnos = MEM_mallocN(sizeof(CoNo) * me->totvert, "vertexcosnos map"); vp_handle->use_update = false; /* sets 'use_update' if needed */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 616095188bb..03fc4ffb151 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -258,92 +258,15 @@ bool view3d_camera_border_hack_test = false; /* ***************** BACKBUF SEL (BBS) ********* */ -#ifdef USE_MESH_DM_SELECT -static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, const float co[3], - const float UNUSED(no_f[3]), const short UNUSED(no_s[3])) -{ - drawMVertOffset_userData *data = userData; - MVert *mv = &data->mvert[index]; - - if (!(mv->flag & ME_HIDE)) { - int selcol; - GPU_select_index_get(data->offset + index, &selcol); - immAttrib1u(data->col, selcol); - immVertex3fv(data->pos, co); - } -} - -static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) -{ - drawMVertOffset_userData data; - Mesh *me = ob->data; - MVert *mvert = me->mvert; - data.mvert = mvert; - data.offset = offset; - - const int imm_len = dm->getNumVerts(dm); - - if (imm_len == 0) return; - - GPUVertFormat *format = immVertexFormat(); - data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); - - immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - - GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); - - immBeginAtMost(GPU_PRIM_POINTS, imm_len); - dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); - immEnd(); - - immUnbindProgram(); -} -#else -static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *UNUSED(dm), int offset) +static void bbs_obmode_mesh_verts(Object *ob, int offset) { Mesh *me = ob->data; GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset); GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); GPU_batch_draw(batch); } -#endif - -#ifdef USE_MESH_DM_SELECT -static void bbs_mesh_verts__mapFunc(void *userData, int index, const float co[3], - const float UNUSED(no_f[3]), const short UNUSED(no_s[3])) -{ - drawBMOffset_userData *data = userData; - BMVert *eve = BM_vert_at_index(data->bm, index); - - if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { - int selcol; - GPU_select_index_get(data->offset + index, &selcol); - immAttrib1u(data->col, selcol); - immVertex3fv(data->pos, co); - } -} -static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) -{ - drawBMOffset_userData data; - data.bm = em->bm; - data.offset = offset; - GPUVertFormat *format = immVertexFormat(); - data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); - - immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - - GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GPU_PRIM_POINTS, em->bm->totvert); - dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); - immEnd(); - - immUnbindProgram(); -} -#else -static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) +static void bbs_mesh_verts(BMEditMesh *em, int offset) { GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); @@ -352,50 +275,8 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); GPU_batch_draw(batch); } -#endif - -#ifdef USE_MESH_DM_SELECT -static void bbs_mesh_wire__mapFunc(void *userData, int index, const float v0co[3], const float v1co[3]) -{ - drawBMOffset_userData *data = userData; - BMEdge *eed = BM_edge_at_index(data->bm, index); - - if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { - int selcol; - GPU_select_index_get(data->offset + index, &selcol); - immAttrib1u(data->col, selcol); - immVertex3fv(data->pos, v0co); - immVertex3fv(data->pos, v1co); - } -} - -static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset) -{ - drawBMOffset_userData data; - data.bm = em->bm; - data.offset = offset; - - GPUVertFormat *format = immVertexFormat(); - - const int imm_len = dm->getNumEdges(dm) * 2; - if (imm_len == 0) return; - - data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); - - immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - - GPU_line_width(1.0f); - - immBeginAtMost(GPU_PRIM_LINES, imm_len); - dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data); - immEnd(); - - immUnbindProgram(); -} -#else -static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) +static void bbs_mesh_wire(BMEditMesh *em, int offset) { GPU_line_width(1.0f); @@ -404,63 +285,8 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); GPU_batch_draw(batch); } -#endif - -#ifdef USE_MESH_DM_SELECT -static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *dm, const bool use_select) -{ - UNUSED_VARS(dm); - - drawBMOffset_userData data; - data.bm = em->bm; - - const int tri_len = em->tottri; - const int imm_len = tri_len * 3; - const char hflag_skip = use_select ? BM_ELEM_HIDDEN : (BM_ELEM_HIDDEN | BM_ELEM_SELECT); - - if (imm_len == 0) return; - GPUVertFormat *format = immVertexFormat(); - data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); - - immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - - immBeginAtMost(GPU_PRIM_TRIS, imm_len); - - if (use_select == false) { - int selcol; - GPU_select_index_get(0, &selcol); - immAttrib1u(data.col, selcol); - } - - int index = 0; - while (index < tri_len) { - const BMFace *f = em->looptris[index][0]->f; - const int ntris = f->len - 2; - if (!BM_elem_flag_test(f, hflag_skip)) { - if (use_select) { - int selcol; - GPU_select_index_get(BM_elem_index_get(f) + 1, &selcol); - immAttrib1u(data.col, selcol); - } - for (int t = 0; t < ntris; t++) { - immVertex3fv(data.pos, em->looptris[index][0]->v->co); - immVertex3fv(data.pos, em->looptris[index][1]->v->co); - immVertex3fv(data.pos, em->looptris[index][2]->v->co); - index++; - } - } - else { - index += ntris; - } - } - immEnd(); - - immUnbindProgram(); -} -#else -static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *UNUSED(dm), const bool use_select) +static void bbs_mesh_face(BMEditMesh *em, const bool use_select) { Mesh *me = em->ob->data; GPUBatch *batch; @@ -479,100 +305,31 @@ static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *UNUSED(dm), const bool us GPU_batch_draw(batch); } } -#endif - -#ifdef USE_MESH_DM_SELECT -static void bbs_mesh_solid__drawCenter(void *userData, int index, const float cent[3], const float UNUSED(no[3])) -{ - drawBMOffset_userData *data = (drawBMOffset_userData *)userData; - BMFace *efa = BM_face_at_index(userData, index); - - if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { - int selcol; - GPU_select_index_get(index + 1, &selcol); - immAttrib1u(data->col, selcol); - immVertex3fv(data->pos, cent); - } -} - -static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm) -{ - drawBMOffset_userData data; /* don't use offset */ - data.bm = em->bm; - GPUVertFormat *format = immVertexFormat(); - data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); - - immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - - GPU_point_size(UI_GetThemeValuef(TH_FACEDOT_SIZE)); - - immBeginAtMost(GPU_PRIM_POINTS, em->bm->totface); - dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP); - immEnd(); - immUnbindProgram(); -} -#else -static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *UNUSED(dm)) +static void bbs_mesh_face_dot(BMEditMesh *em) { Mesh *me = em->ob->data; GPUBatch *batch = DRW_mesh_batch_cache_get_facedots_with_select_id(me, 1); GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); GPU_batch_draw(batch); } -#endif /* two options, facecolors or black */ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d, - Object *ob, DerivedMesh *dm, bool use_faceselect) + Object *ob, bool use_faceselect) { if (use_faceselect) { - bbs_mesh_face(em, dm, true); + bbs_mesh_face(em, true); if (check_ob_drawface_dot(scene, v3d, ob->dt)) { - bbs_mesh_face_dot(em, dm); + bbs_mesh_face_dot(em); } } else { - bbs_mesh_face(em, dm, false); + bbs_mesh_face(em, false); } } -#ifdef USE_MESH_DM_SELECT -/* must have called GPU_framebuffer_index_set beforehand */ -static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index) -{ - Mesh *me = userData; - - if (!(me->mpoly[index].flag & ME_HIDE)) { - return DM_DRAW_OPTION_NORMAL; - } - else { - return DM_DRAW_OPTION_SKIP; - } -} - -static void bbs_mesh_solid_verts(Depsgraph *depsgraph, Scene *scene, Object *ob) -{ - Mesh *me = ob->data; - DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, scene->customdata_mask); - - DM_update_materials(dm, ob); - - /* Only draw faces to mask out verts, we don't want their selection ID's. */ - const int G_f_orig = G.f; - G.f &= ~G_BACKBUFSEL; - - dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, NULL, NULL, me, DM_DRAW_SKIP_HIDDEN); - - G.f |= (G_f_orig & G_BACKBUFSEL); - - bbs_obmode_mesh_verts(ob, dm, 1); - bm_vertoffs = me->totvert + 1; - dm->release(dm); -} -#else static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob) { Mesh *me = ob->data; @@ -593,10 +350,9 @@ static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(sce G.f |= (G_f_orig & G_BACKBUFSEL); - bbs_obmode_mesh_verts(ob, NULL, 1); + bbs_obmode_mesh_verts(ob, 1); bm_vertoffs = me->totvert + 1; } -#endif static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob) { @@ -632,13 +388,9 @@ void draw_object_backbufsel( Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; - DerivedMesh *dm = editbmesh_get_derived_cage(depsgraph, scene, ob, em, CD_MASK_BAREMESH); - BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE); - DM_update_materials(dm, ob); - - bbs_mesh_solid_EM(em, scene, v3d, ob, dm, (select_mode & SCE_SELECT_FACE) != 0); + bbs_mesh_solid_EM(em, scene, v3d, ob, (select_mode & SCE_SELECT_FACE) != 0); if (select_mode & SCE_SELECT_FACE) bm_solidoffs = 1 + em->bm->totface; else { @@ -649,7 +401,7 @@ void draw_object_backbufsel( /* we draw edges if edge select mode */ if (select_mode & SCE_SELECT_EDGE) { - bbs_mesh_wire(em, dm, bm_solidoffs); + bbs_mesh_wire(em, bm_solidoffs); bm_wireoffs = bm_solidoffs + em->bm->totedge; } else { @@ -659,7 +411,7 @@ void draw_object_backbufsel( /* we draw verts if vert select mode. */ if (select_mode & SCE_SELECT_VERTEX) { - bbs_mesh_verts(em, dm, bm_wireoffs); + bbs_mesh_verts(em, bm_wireoffs); bm_vertoffs = bm_wireoffs + em->bm->totvert; } else { @@ -667,8 +419,6 @@ void draw_object_backbufsel( } ED_view3d_polygon_offset(rv3d, 0.0); - - dm->release(dm); } else { Mesh *me = ob->data; |