Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_wireframe.c
| Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, | ||||
| OVERLAY_DupliData *dupli, | OVERLAY_DupliData *dupli, | ||||
| bool init_dupli) | bool init_dupli) | ||||
| { | { | ||||
| OVERLAY_PrivateData *pd = vedata->stl->pd; | OVERLAY_PrivateData *pd = vedata->stl->pd; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES) != 0; | const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES) != 0; | ||||
| const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0; | const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0; | ||||
| const bool is_mesh = ob->type == OB_MESH; | const bool is_mesh = ob->type == OB_MESH; | ||||
| const bool is_mesh_verts_only = is_mesh && (((Mesh *)ob->data)->totedge == 0 && | const bool is_edit_mode = DRW_object_is_in_edit_mode(ob); | ||||
| ((Mesh *)ob->data)->totvert > 0); | bool has_edit_mesh_cage = false; | ||||
| bool is_mesh_verts_only = false; | |||||
| if (is_mesh && is_edit_mode) { | |||||
| /* TODO: Should be its own function. */ | |||||
| Mesh *me = ob->data; | |||||
| BMEditMesh *embm = me->edit_mesh; | |||||
| if (embm) { | |||||
| has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final); | |||||
| me = embm->mesh_eval_final; | |||||
| } | |||||
| is_mesh_verts_only = me->totedge == 0 && me->totvert > 0; | |||||
| } | |||||
| const bool use_wire = !is_mesh_verts_only && ((pd->overlay.flag & V3D_OVERLAY_WIREFRAMES) || | const bool use_wire = !is_mesh_verts_only && ((pd->overlay.flag & V3D_OVERLAY_WIREFRAMES) || | ||||
| (ob->dtx & OB_DRAWWIRE) || (ob->dt == OB_WIRE)); | (ob->dtx & OB_DRAWWIRE) || (ob->dt == OB_WIRE)); | ||||
| if (use_wire && pd->wireframe_mode && ob->particlesystem.first) { | if (use_wire && pd->wireframe_mode && ob->particlesystem.first) { | ||||
| for (ParticleSystem *psys = ob->particlesystem.first; psys != NULL; psys = psys->next) { | for (ParticleSystem *psys = ob->particlesystem.first; psys != NULL; psys = psys->next) { | ||||
| if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { | if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | if (draw_as_points) { | ||||
| struct GPUBatch *geom = DRW_cache_object_face_wireframe_get(ob); | struct GPUBatch *geom = DRW_cache_object_face_wireframe_get(ob); | ||||
| if (geom) { | if (geom) { | ||||
| OVERLAY_extra_loose_points(cb, geom, ob->obmat, color); | OVERLAY_extra_loose_points(cb, geom, ob->obmat, color); | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| const bool is_edit_mode = DRW_object_is_in_edit_mode(ob); | |||||
| bool has_edit_mesh_cage = false; | |||||
| if (is_mesh && is_edit_mode) { | |||||
| /* TODO: Should be its own function. */ | |||||
| Mesh *me = (Mesh *)ob->data; | |||||
| BMEditMesh *embm = me->edit_mesh; | |||||
| if (embm) { | |||||
| has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final); | |||||
| } | |||||
| } | |||||
| /* Don't do that in edit Mesh mode, unless there is a modifier preview. */ | /* Don't do that in edit Mesh mode, unless there is a modifier preview. */ | ||||
| if (use_wire && (!is_mesh || (!is_edit_mode || has_edit_mesh_cage))) { | if (use_wire && (!is_mesh || (!is_edit_mode || has_edit_mesh_cage))) { | ||||
| const bool is_sculpt_mode = ((ob->mode & OB_MODE_SCULPT) != 0) && (ob->sculpt != NULL); | const bool is_sculpt_mode = ((ob->mode & OB_MODE_SCULPT) != 0) && (ob->sculpt != NULL); | ||||
| const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && | const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && | ||||
| !DRW_state_is_image_render(); | !DRW_state_is_image_render(); | ||||
| const bool use_coloring = (use_wire && !is_edit_mode && !is_sculpt_mode && | const bool use_coloring = (use_wire && !is_edit_mode && !is_sculpt_mode && | ||||
| !has_edit_mesh_cage); | !has_edit_mesh_cage); | ||||
| DRWShadingGroup *shgrp = NULL; | DRWShadingGroup *shgrp = NULL; | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||