diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-15 07:08:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-15 07:12:36 +0300 |
commit | 5b86899f21d61197acbc4e25ee54e03688803093 (patch) | |
tree | abb2453c56945f12b5a3a23e534904a1912770a8 /source/blender/editors | |
parent | f9f67e0239c7fe696872e9c06300b296799faa42 (diff) |
Mesh: remove DerivedMesh for face-map drawing
Diffstat (limited to 'source/blender/editors')
4 files changed, 19 insertions, 37 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c index bd047ba1da4..4eeddb92664 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_presets.c +++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c @@ -127,7 +127,7 @@ void ED_gizmo_draw_preset_circle( } void ED_gizmo_draw_preset_facemap( - const bContext *C, const struct wmGizmo *gz, struct Scene *scene, Object *ob, const int facemap, int select_id) + const bContext *C, const struct wmGizmo *gz, Object *ob, const int facemap, int select_id) { const bool is_select = (select_id != -1); const bool is_highlight = is_select && (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; @@ -141,7 +141,7 @@ void ED_gizmo_draw_preset_facemap( GPU_matrix_push(); GPU_matrix_mul(ob->obmat); - ED_draw_object_facemap(CTX_data_depsgraph(C), scene, ob, color, facemap); + ED_draw_object_facemap(CTX_data_depsgraph(C), ob, color, facemap); GPU_matrix_pop(); if (is_select) { diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index cdeaf648fbc..be772a6af98 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -68,7 +68,7 @@ void ED_gizmo_draw_preset_arrow( void ED_gizmo_draw_preset_circle( const struct wmGizmo *gz, float mat[4][4], int axis, int select_id); void ED_gizmo_draw_preset_facemap( - const struct bContext *C, const struct wmGizmo *gz, struct Scene *scene, + const struct bContext *C, const struct wmGizmo *gz, struct Object *ob, const int facemap, int select_id); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 560ed0cf0e0..88e914288d5 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -426,7 +426,7 @@ struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d); void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat); void ED_draw_object_facemap( - struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const float col[4], const int facemap); + struct Depsgraph *depsgraph, struct Object *ob, const float col[4], const int facemap); struct RenderEngineType *ED_view3d_engine_type(struct Scene *scene, int drawtype); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 03fc4ffb151..acb995b65b8 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -443,23 +443,20 @@ void draw_object_backbufsel( void ED_draw_object_facemap( - Depsgraph *depsgraph, Scene *scene, Object *ob, const float col[4], const int facemap) + Depsgraph *depsgraph, Object *ob, const float col[4], const int facemap) { - DerivedMesh *dm = NULL; - /* happens on undo */ - if (ob->type != OB_MESH || !ob->data) - return; - - /* Temporary, happens on undo, would resolve but will eventually move away from DM. */ - if (ob->derivedFinal == NULL) { + if (ob->type != OB_MESH || !ob->data) { return; } - dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH); - if (!dm || !CustomData_has_layer(&dm->polyData, CD_FACEMAP)) - return; - + Mesh *me = ob->data; + { + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + if (ob_eval->runtime.mesh_eval) { + me = ob_eval->runtime.mesh_eval; + } + } glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); @@ -494,7 +491,6 @@ void ED_draw_object_facemap( #else /* Just to create the data to pass to immediate mode, grr! */ - Mesh *me = ob->data; const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP); if (facemap_data) { GPUVertFormat *format = immVertexFormat(); @@ -515,26 +511,14 @@ void ED_draw_object_facemap( MLoop *mloop; int mloop_len; - if (dm && CustomData_has_layer(&dm->polyData, CD_FACEMAP)) { - mvert = dm->getVertArray(dm); - mpoly = dm->getPolyArray(dm); - mloop = dm->getLoopArray(dm); + mvert = me->mvert; + mpoly = me->mpoly; + mloop = me->mloop; - mpoly_len = dm->getNumPolys(dm); - mloop_len = dm->getNumLoops(dm); - - facemap_data = CustomData_get_layer(&dm->polyData, CD_FACEMAP); - } - else { - mvert = me->mvert; - mpoly = me->mpoly; - mloop = me->mloop; + mpoly_len = me->totpoly; + mloop_len = me->totloop; - mpoly_len = me->totpoly; - mloop_len = me->totloop; - - facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP); - } + facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP); /* use gawain immediate mode fore now */ const int looptris_len = poly_to_tri_count(mpoly_len, mloop_len); @@ -565,6 +549,4 @@ void ED_draw_object_facemap( GPU_blend(false); } #endif - - dm->release(dm); } |