Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_engine.c
| Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | if (v3d->shading.type == OB_WIRE) { | ||||
| pd->overlay.flag |= V3D_OVERLAY_WIREFRAMES; | pd->overlay.flag |= V3D_OVERLAY_WIREFRAMES; | ||||
| } | } | ||||
| pd->wireframe_mode = (v3d->shading.type == OB_WIRE); | pd->wireframe_mode = (v3d->shading.type == OB_WIRE); | ||||
| pd->clipping_state = RV3D_CLIPPING_ENABLED(v3d, rv3d) ? DRW_STATE_CLIP_PLANES : 0; | pd->clipping_state = RV3D_CLIPPING_ENABLED(v3d, rv3d) ? DRW_STATE_CLIP_PLANES : 0; | ||||
| pd->xray_enabled = XRAY_ACTIVE(v3d); | pd->xray_enabled = XRAY_ACTIVE(v3d); | ||||
| pd->xray_enabled_and_not_wire = pd->xray_enabled && v3d->shading.type > OB_WIRE; | pd->xray_enabled_and_not_wire = pd->xray_enabled && v3d->shading.type > OB_WIRE; | ||||
| pd->clear_in_front = (v3d->shading.type != OB_SOLID); | pd->clear_in_front = (v3d->shading.type != OB_SOLID); | ||||
| pd->retopology.enabled = (pd->ctx_mode == CTX_MODE_EDIT_MESH) && | |||||
| ((pd->overlay.edit_flag & V3D_OVERLAY_EDIT_RETOPOLOGY) != 0); | |||||
jbakker: We should use pd->overlay.edit_flag. Otherwise the `Viewport Hide Overlays` has no effect | |||||
| OVERLAY_antialiasing_init(vedata); | OVERLAY_antialiasing_init(vedata); | ||||
| switch (stl->pd->ctx_mode) { | switch (stl->pd->ctx_mode) { | ||||
| case CTX_MODE_EDIT_MESH: | case CTX_MODE_EDIT_MESH: | ||||
| OVERLAY_edit_mesh_init(vedata); | OVERLAY_edit_mesh_init(vedata); | ||||
| break; | break; | ||||
| default: | default: | ||||
| /* Nothing to do. */ | /* Nothing to do. */ | ||||
| break; | break; | ||||
| } | } | ||||
| if (pd->retopology.enabled) { | |||||
| OVERLAY_retopology_init(vedata); | |||||
| } | |||||
| OVERLAY_facing_init(vedata); | OVERLAY_facing_init(vedata); | ||||
| OVERLAY_grid_init(vedata); | OVERLAY_grid_init(vedata); | ||||
| OVERLAY_image_init(vedata); | OVERLAY_image_init(vedata); | ||||
| OVERLAY_outline_init(vedata); | OVERLAY_outline_init(vedata); | ||||
| OVERLAY_wireframe_init(vedata); | OVERLAY_wireframe_init(vedata); | ||||
| } | } | ||||
| static void OVERLAY_cache_init(void *vedata) | static void OVERLAY_cache_init(void *vedata) | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | switch (pd->ctx_mode) { | ||||
| default: | default: | ||||
| BLI_assert(!"Draw mode invalid"); | BLI_assert(!"Draw mode invalid"); | ||||
| break; | break; | ||||
| } | } | ||||
| OVERLAY_antialiasing_cache_init(vedata); | OVERLAY_antialiasing_cache_init(vedata); | ||||
| OVERLAY_armature_cache_init(vedata); | OVERLAY_armature_cache_init(vedata); | ||||
| OVERLAY_extra_cache_init(vedata); | OVERLAY_extra_cache_init(vedata); | ||||
| OVERLAY_facing_cache_init(vedata); | OVERLAY_facing_cache_init(vedata); | ||||
| if (pd->retopology.enabled) { | |||||
| OVERLAY_retopology_cache_init(vedata); | |||||
| } | |||||
| OVERLAY_grid_cache_init(vedata); | OVERLAY_grid_cache_init(vedata); | ||||
| OVERLAY_image_cache_init(vedata); | OVERLAY_image_cache_init(vedata); | ||||
| OVERLAY_metaball_cache_init(vedata); | OVERLAY_metaball_cache_init(vedata); | ||||
| OVERLAY_motion_path_cache_init(vedata); | OVERLAY_motion_path_cache_init(vedata); | ||||
| OVERLAY_outline_cache_init(vedata); | OVERLAY_outline_cache_init(vedata); | ||||
| OVERLAY_particle_cache_init(vedata); | OVERLAY_particle_cache_init(vedata); | ||||
| OVERLAY_wireframe_cache_init(vedata); | OVERLAY_wireframe_cache_init(vedata); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | const bool draw_bone_selection = (ob->type == OB_MESH) && pd->armature.do_pose_fade_geom && | ||||
| !is_select; | !is_select; | ||||
| const bool draw_extras = | const bool draw_extras = | ||||
| (!pd->hide_overlays) && | (!pd->hide_overlays) && | ||||
| (((pd->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) == 0) || | (((pd->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) == 0) || | ||||
| /* Show if this is the camera we're looking through since it's useful for selecting. */ | /* Show if this is the camera we're looking through since it's useful for selecting. */ | ||||
| ((draw_ctx->rv3d->persp == RV3D_CAMOB) && ((ID *)draw_ctx->v3d->camera == ob->id.orig_id))); | ((draw_ctx->rv3d->persp == RV3D_CAMOB) && ((ID *)draw_ctx->v3d->camera == ob->id.orig_id))); | ||||
| const bool draw_motion_paths = (pd->overlay.flag & V3D_OVERLAY_HIDE_MOTION_PATHS) == 0; | const bool draw_motion_paths = (pd->overlay.flag & V3D_OVERLAY_HIDE_MOTION_PATHS) == 0; | ||||
| const bool draw_retopology_overlay = pd->retopology.enabled; | |||||
| bool do_init; | bool do_init; | ||||
| OVERLAY_DupliData *dupli = OVERLAY_duplidata_get(ob, vedata, &do_init); | OVERLAY_DupliData *dupli = OVERLAY_duplidata_get(ob, vedata, &do_init); | ||||
| if (draw_facing) { | if (draw_facing) { | ||||
| OVERLAY_facing_cache_populate(vedata, ob); | OVERLAY_facing_cache_populate(vedata, ob); | ||||
| } | } | ||||
| if (draw_wires) { | if (draw_wires) { | ||||
| OVERLAY_wireframe_cache_populate(vedata, ob, dupli, do_init); | OVERLAY_wireframe_cache_populate(vedata, ob, dupli, do_init); | ||||
| } | } | ||||
| if (draw_outlines) { | if (draw_outlines) { | ||||
| OVERLAY_outline_cache_populate(vedata, ob, dupli, do_init); | OVERLAY_outline_cache_populate(vedata, ob, dupli, do_init); | ||||
| } | } | ||||
| if (draw_bone_selection) { | if (draw_bone_selection) { | ||||
| OVERLAY_pose_cache_populate(vedata, ob); | OVERLAY_pose_cache_populate(vedata, ob); | ||||
| } | } | ||||
| if (draw_retopology_overlay) { | |||||
| OVERLAY_retopology_cache_populate(vedata, 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(vedata, ob); | OVERLAY_edit_mesh_cache_populate(vedata, ob); | ||||
| break; | break; | ||||
| case OB_ARMATURE: | case OB_ARMATURE: | ||||
| if (draw_bones) { | if (draw_bones) { | ||||
| OVERLAY_edit_armature_cache_populate(vedata, ob); | OVERLAY_edit_armature_cache_populate(vedata, ob); | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | GPU_framebuffer_ensure_config( | ||||
| &dfbl->in_front_fb, | &dfbl->in_front_fb, | ||||
| {GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front), GPU_ATTACHMENT_TEXTURE(dtxl->color)}); | {GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front), GPU_ATTACHMENT_TEXTURE(dtxl->color)}); | ||||
| } | } | ||||
| OVERLAY_antialiasing_cache_finish(vedata); | OVERLAY_antialiasing_cache_finish(vedata); | ||||
| OVERLAY_armature_cache_finish(vedata); | OVERLAY_armature_cache_finish(vedata); | ||||
| OVERLAY_image_cache_finish(vedata); | OVERLAY_image_cache_finish(vedata); | ||||
| } | } | ||||
Done Inline ActionsRemove comment, doesn't seem to be needed. jbakker: Remove comment, doesn't seem to be needed. | |||||
| static void OVERLAY_draw_scene(void *vedata) | static void OVERLAY_draw_scene(void *vedata) | ||||
| { | { | ||||
| OVERLAY_Data *data = vedata; | OVERLAY_Data *data = vedata; | ||||
| OVERLAY_PrivateData *pd = data->stl->pd; | OVERLAY_PrivateData *pd = data->stl->pd; | ||||
| OVERLAY_FramebufferList *fbl = data->fbl; | OVERLAY_FramebufferList *fbl = data->fbl; | ||||
| OVERLAY_antialiasing_start(vedata); | OVERLAY_antialiasing_start(vedata); | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | static void OVERLAY_draw_scene(void *vedata) | ||||
| if (DRW_state_is_select()) { | if (DRW_state_is_select()) { | ||||
| /* Edit modes have their own selection code. */ | /* Edit modes have their own selection code. */ | ||||
| return; | return; | ||||
| } | } | ||||
| /* Functions after this point can change FBO freely. */ | /* Functions after this point can change FBO freely. */ | ||||
| if (pd->retopology.enabled) { | |||||
| OVERLAY_retopology_draw(vedata); | |||||
| } | |||||
| switch (pd->ctx_mode) { | switch (pd->ctx_mode) { | ||||
| case CTX_MODE_EDIT_MESH: | case CTX_MODE_EDIT_MESH: | ||||
| OVERLAY_edit_mesh_draw(vedata); | OVERLAY_edit_mesh_draw(vedata); | ||||
| break; | break; | ||||
| case CTX_MODE_EDIT_SURFACE: | case CTX_MODE_EDIT_SURFACE: | ||||
| case CTX_MODE_EDIT_CURVE: | case CTX_MODE_EDIT_CURVE: | ||||
| OVERLAY_edit_curve_draw(vedata); | OVERLAY_edit_curve_draw(vedata); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines | |||||
We should use pd->overlay.edit_flag. Otherwise the Viewport Hide Overlays has no effect