Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_engine.cc
| Show All 10 Lines | |||||
| #include "DRW_render.h" | #include "DRW_render.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "BKE_duplilist.h" | |||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "DNA_space_types.h" | #include "DNA_space_types.h" | ||||
| #include "overlay_engine.h" | #include "overlay_engine.h" | ||||
| #include "overlay_private.hh" | #include "overlay_private.hh" | ||||
| ▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | switch (pd->ctx_mode) { | ||||
| case CTX_MODE_OBJECT: | case CTX_MODE_OBJECT: | ||||
| break; | break; | ||||
| default: | default: | ||||
| BLI_assert_msg(0, "Draw mode invalid"); | BLI_assert_msg(0, "Draw mode invalid"); | ||||
| break; | break; | ||||
| } | } | ||||
| OVERLAY_antialiasing_cache_init(data); | OVERLAY_antialiasing_cache_init(data); | ||||
| OVERLAY_armature_cache_init(data); | OVERLAY_armature_cache_init(data); | ||||
| OVERLAY_viewer_attribute_cache_init(data); | |||||
| OVERLAY_background_cache_init(data); | OVERLAY_background_cache_init(data); | ||||
| OVERLAY_fade_cache_init(data); | OVERLAY_fade_cache_init(data); | ||||
| OVERLAY_mode_transfer_cache_init(data); | OVERLAY_mode_transfer_cache_init(data); | ||||
| OVERLAY_extra_cache_init(data); | OVERLAY_extra_cache_init(data); | ||||
| OVERLAY_facing_cache_init(data); | OVERLAY_facing_cache_init(data); | ||||
| OVERLAY_gpencil_cache_init(data); | OVERLAY_gpencil_cache_init(data); | ||||
| OVERLAY_grid_cache_init(data); | OVERLAY_grid_cache_init(data); | ||||
| OVERLAY_image_cache_init(data); | OVERLAY_image_cache_init(data); | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | static void OVERLAY_cache_populate(void *vedata, Object *ob) | ||||
| OVERLAY_Data *data = static_cast<OVERLAY_Data *>(vedata); | OVERLAY_Data *data = static_cast<OVERLAY_Data *>(vedata); | ||||
| OVERLAY_PrivateData *pd = data->stl->pd; | OVERLAY_PrivateData *pd = data->stl->pd; | ||||
| if (pd->space_type == SPACE_IMAGE) { | if (pd->space_type == SPACE_IMAGE) { | ||||
| return; | return; | ||||
| } | } | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| DupliObject *dupli_object = DRW_object_get_dupli(ob); | |||||
| Object *dupli_parent = DRW_object_get_dupli_parent(ob); | |||||
| const bool is_select = DRW_state_is_select(); | const bool is_select = DRW_state_is_select(); | ||||
| const bool renderable = DRW_object_is_renderable(ob); | const bool renderable = DRW_object_is_renderable(ob); | ||||
| const bool is_preview = dupli_object != nullptr && | |||||
| dupli_object->preview_base_geometry != nullptr; | |||||
| const bool in_pose_mode = ob->type == OB_ARMATURE && OVERLAY_armature_is_pose_mode(ob, draw_ctx); | const bool in_pose_mode = ob->type == OB_ARMATURE && OVERLAY_armature_is_pose_mode(ob, draw_ctx); | ||||
| const bool in_edit_mode = overlay_object_is_edit_mode(pd, ob); | const bool in_edit_mode = overlay_object_is_edit_mode(pd, ob); | ||||
| const bool is_instance = (ob->base_flag & BASE_FROM_DUPLI); | const bool is_instance = (ob->base_flag & BASE_FROM_DUPLI); | ||||
| const bool instance_parent_in_edit_mode = is_instance ? | const bool instance_parent_in_edit_mode = is_instance ? | ||||
| overlay_object_is_edit_mode( | overlay_object_is_edit_mode( | ||||
| pd, DRW_object_get_dupli_parent(ob)) : | pd, DRW_object_get_dupli_parent(ob)) : | ||||
| false; | false; | ||||
| const bool in_particle_edit_mode = (ob->mode == OB_MODE_PARTICLE_EDIT) && | const bool in_particle_edit_mode = (ob->mode == OB_MODE_PARTICLE_EDIT) && | ||||
| (pd->ctx_mode == CTX_MODE_PARTICLE); | (pd->ctx_mode == CTX_MODE_PARTICLE); | ||||
| const bool in_paint_mode = (ob == draw_ctx->obact) && | const bool in_paint_mode = (ob == draw_ctx->obact) && | ||||
| (draw_ctx->object_mode & OB_MODE_ALL_PAINT); | (draw_ctx->object_mode & OB_MODE_ALL_PAINT); | ||||
| const bool in_sculpt_curve_mode = (ob == draw_ctx->obact) && | const bool in_sculpt_curve_mode = (ob == draw_ctx->obact || | ||||
| (is_preview && dupli_parent == draw_ctx->obact)) && | |||||
| (draw_ctx->object_mode & OB_MODE_SCULPT_CURVES); | (draw_ctx->object_mode & OB_MODE_SCULPT_CURVES); | ||||
| const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != nullptr) && | const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != nullptr) && | ||||
| (ob->sculpt->mode_type == OB_MODE_SCULPT); | (ob->sculpt->mode_type == OB_MODE_SCULPT); | ||||
| const bool in_curves_sculpt_mode = (ob == draw_ctx->obact) && | const bool in_curves_sculpt_mode = (ob == draw_ctx->obact) && | ||||
| (ob->mode == OB_MODE_SCULPT_CURVES); | (ob->mode == OB_MODE_SCULPT_CURVES); | ||||
| const bool has_surface = ELEM(ob->type, | const bool has_surface = ELEM(ob->type, | ||||
| OB_MESH, | OB_MESH, | ||||
| OB_CURVES_LEGACY, | OB_CURVES_LEGACY, | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | static void OVERLAY_cache_populate(void *vedata, Object *ob) | ||||
| } | } | ||||
| if (draw_outlines) { | if (draw_outlines) { | ||||
| OVERLAY_outline_cache_populate(data, ob, dupli, do_init); | OVERLAY_outline_cache_populate(data, ob, dupli, do_init); | ||||
| } | } | ||||
| if (draw_bone_selection) { | if (draw_bone_selection) { | ||||
| OVERLAY_pose_cache_populate(data, ob); | OVERLAY_pose_cache_populate(data, ob); | ||||
| } | } | ||||
| if (pd->overlay.flag & V3D_OVERLAY_VIEWER_ATTRIBUTE) { | |||||
| if (is_preview) { | |||||
| OVERLAY_viewer_attribute_cache_populate(data, ob); | |||||
| } | |||||
| } | |||||
| if (ob->type == OB_VOLUME) { | if (ob->type == OB_VOLUME) { | ||||
| OVERLAY_volume_cache_populate(data, ob); | OVERLAY_volume_cache_populate(data, ob); | ||||
| } | } | ||||
| if (in_edit_mode && !pd->hide_overlays) { | if (in_edit_mode && !pd->hide_overlays) { | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| OVERLAY_edit_mesh_cache_populate(data, ob); | OVERLAY_edit_mesh_cache_populate(data, ob); | ||||
| ▲ Show 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | static void OVERLAY_draw_scene(void *vedata) | ||||
| } | } | ||||
| OVERLAY_wireframe_draw(data); | OVERLAY_wireframe_draw(data); | ||||
| OVERLAY_armature_draw(data); | OVERLAY_armature_draw(data); | ||||
| OVERLAY_particle_draw(data); | OVERLAY_particle_draw(data); | ||||
| OVERLAY_metaball_draw(data); | OVERLAY_metaball_draw(data); | ||||
| OVERLAY_gpencil_draw(data); | OVERLAY_gpencil_draw(data); | ||||
| OVERLAY_extra_draw(data); | OVERLAY_extra_draw(data); | ||||
| if (pd->overlay.flag & V3D_OVERLAY_VIEWER_ATTRIBUTE) { | |||||
| OVERLAY_viewer_attribute_draw(data); | |||||
| } | |||||
| if (DRW_state_is_fbo()) { | if (DRW_state_is_fbo()) { | ||||
| GPU_framebuffer_bind(fbl->overlay_color_only_fb); | GPU_framebuffer_bind(fbl->overlay_color_only_fb); | ||||
| } | } | ||||
| OVERLAY_xray_fade_draw(data); | OVERLAY_xray_fade_draw(data); | ||||
| OVERLAY_grid_draw(data); | OVERLAY_grid_draw(data); | ||||
| ▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines | |||||