diff options
Diffstat (limited to 'source/blender/draw/engines/overlay')
10 files changed, 49 insertions, 46 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index 668a1255843..ccf8f9e0c36 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -191,20 +191,17 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_armature_sphere(false); grp = DRW_shgroup_create(sh, armature_ps); - DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); cb->solid.point_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get()); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_state_disable(grp, DRW_STATE_WRITE_DEPTH); DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); - DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha * 0.4f); cb->transp.point_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get()); sh = OVERLAY_shader_armature_shape(false); grp = DRW_shgroup_create(sh, armature_ps); - DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); cb->solid.custom_fill = grp; cb->solid.box_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get()); @@ -213,7 +210,6 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_state_disable(grp, DRW_STATE_WRITE_DEPTH); DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); - DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha * 0.6f); cb->transp.custom_fill = grp; cb->transp.box_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get()); @@ -335,7 +331,6 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_armature_envelope(false); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_state_enable(grp, DRW_STATE_CULL_BACK); - DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_bool_copy(grp, "isDistance", false); DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); cb->solid.envelope_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get()); @@ -371,7 +366,6 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_armature_envelope(false); grp = DRW_shgroup_create(sh, armature_transp_ps); - DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); DRW_shgroup_uniform_bool_copy(grp, "isDistance", true); DRW_shgroup_state_enable(grp, DRW_STATE_CULL_FRONT); @@ -667,7 +661,7 @@ static void drw_shgroup_bone_custom_solid(ArmatureDrawContext *ctx, /* TODO(fclem): arg... less than ideal but we never iter on this object * to assure batch cache is valid. */ - DRW_mesh_batch_cache_validate(mesh); + DRW_mesh_batch_cache_validate(custom, mesh); struct GPUBatch *surf = DRW_mesh_batch_cache_get_surface(mesh); struct GPUBatch *edges = DRW_mesh_batch_cache_get_edge_detection(mesh, NULL); @@ -715,7 +709,7 @@ static void drw_shgroup_bone_custom_wire(ArmatureDrawContext *ctx, } /* TODO(fclem): arg... less than ideal but we never iter on this object * to assure batch cache is valid. */ - DRW_mesh_batch_cache_validate(mesh); + DRW_mesh_batch_cache_validate(custom, mesh); struct GPUBatch *geom = DRW_mesh_batch_cache_get_all_edges(mesh); if (geom) { @@ -2084,7 +2078,9 @@ static void draw_armature_edit(ArmatureDrawContext *ctx) boneflag &= ~BONE_DRAW_LOCKED_WEIGHT; - draw_bone_relations(ctx, eBone, NULL, arm, boneflag, constflag); + if (!is_select) { + draw_bone_relations(ctx, eBone, NULL, arm, boneflag, constflag); + } if (arm->drawtype == ARM_ENVELOPE) { draw_bone_update_disp_matrix_default(eBone, NULL); @@ -2107,12 +2103,14 @@ static void draw_armature_edit(ArmatureDrawContext *ctx) draw_bone_octahedral(ctx, eBone, NULL, arm, boneflag, constflag, select_id); } - if (show_text && (arm->flag & ARM_DRAWNAMES)) { - draw_bone_name(ctx, eBone, NULL, arm, boneflag); - } + if (!is_select) { + if (show_text && (arm->flag & ARM_DRAWNAMES)) { + draw_bone_name(ctx, eBone, NULL, arm, boneflag); + } - if (arm->flag & ARM_DRAWAXES) { - draw_axes(ctx, eBone, NULL, arm); + if (arm->flag & ARM_DRAWAXES) { + draw_axes(ctx, eBone, NULL, arm); + } } } } @@ -2221,7 +2219,9 @@ static void draw_armature_pose(ArmatureDrawContext *ctx) boneflag &= ~BONE_DRAW_LOCKED_WEIGHT; } - draw_bone_relations(ctx, NULL, pchan, arm, boneflag, constflag); + if (!is_pose_select) { + draw_bone_relations(ctx, NULL, pchan, arm, boneflag, constflag); + } if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) { draw_bone_update_disp_matrix_custom(pchan); @@ -2248,16 +2248,19 @@ static void draw_armature_pose(ArmatureDrawContext *ctx) draw_bone_octahedral(ctx, NULL, pchan, arm, boneflag, constflag, select_id); } - if (draw_dofs) { - draw_bone_degrees_of_freedom(ctx, pchan); - } + /* These aren't included in the selection. */ + if (!is_pose_select) { + if (draw_dofs) { + draw_bone_degrees_of_freedom(ctx, pchan); + } - if (show_text && (arm->flag & ARM_DRAWNAMES)) { - draw_bone_name(ctx, NULL, pchan, arm, boneflag); - } + if (show_text && (arm->flag & ARM_DRAWNAMES)) { + draw_bone_name(ctx, NULL, pchan, arm, boneflag); + } - if (arm->flag & ARM_DRAWAXES) { - draw_axes(ctx, NULL, pchan, arm); + if (arm->flag & ARM_DRAWAXES) { + draw_axes(ctx, NULL, pchan, arm); + } } } } @@ -2365,9 +2368,6 @@ static bool POSE_is_driven_by_active_armature(Object *ob) if (ob_arm) { const DRWContextState *draw_ctx = DRW_context_state_get(); bool is_active = OVERLAY_armature_is_pose_mode(ob_arm, draw_ctx); - if (!is_active && ob_arm->proxy_from) { - is_active = OVERLAY_armature_is_pose_mode(ob_arm->proxy_from, draw_ctx); - } return is_active; } diff --git a/source/blender/draw/engines/overlay/overlay_edit_mesh.c b/source/blender/draw/engines/overlay/overlay_edit_mesh.c index 3a2871249a2..ad929cc0835 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_mesh.c +++ b/source/blender/draw/engines/overlay/overlay_edit_mesh.c @@ -28,6 +28,7 @@ #include "BKE_customdata.h" #include "BKE_editmesh.h" +#include "BKE_object.h" #include "draw_cache_impl.h" #include "draw_manager_text.h" @@ -229,7 +230,10 @@ static void overlay_edit_mesh_add_ob_to_pass(OVERLAY_PrivateData *pd, Object *ob 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); + Mesh *editmesh_eval_final = BKE_object_get_editmesh_eval_final(ob); + Mesh *editmesh_eval_cage = BKE_object_get_editmesh_eval_cage(ob); + + has_edit_mesh_cage = editmesh_eval_cage && (editmesh_eval_cage != editmesh_eval_final); has_skin_roots = CustomData_get_offset(&embm->bm->vdata, CD_MVERT_SKIN) != -1; } diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c b/source/blender/draw/engines/overlay/overlay_edit_uv.c index 983df1ceac8..f51df908fbf 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.c +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c @@ -412,7 +412,7 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata) draw_ctx->view_layer, NULL, &objects_len, draw_ctx->object_mode); for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *object_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, objects[ob_index]); - DRW_mesh_batch_cache_validate((Mesh *)object_eval->data); + DRW_mesh_batch_cache_validate(object_eval, (Mesh *)object_eval->data); overlay_edit_uv_cache_populate(vedata, object_eval); } MEM_freeN(objects); @@ -441,22 +441,22 @@ static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob) if (has_active_edit_uvmap) { if (pd->edit_uv.do_uv_overlay) { - geom = DRW_mesh_batch_cache_get_edituv_edges(ob->data); + geom = DRW_mesh_batch_cache_get_edituv_edges(ob, ob->data); if (geom) { DRW_shgroup_call_obmat(pd->edit_uv_edges_grp, geom, NULL); } - geom = DRW_mesh_batch_cache_get_edituv_verts(ob->data); + geom = DRW_mesh_batch_cache_get_edituv_verts(ob, ob->data); if (geom) { DRW_shgroup_call_obmat(pd->edit_uv_verts_grp, geom, NULL); } if (pd->edit_uv.do_faces) { - geom = DRW_mesh_batch_cache_get_edituv_faces(ob->data); + geom = DRW_mesh_batch_cache_get_edituv_faces(ob, ob->data); if (geom) { DRW_shgroup_call_obmat(pd->edit_uv_faces_grp, geom, NULL); } } if (pd->edit_uv.do_face_dots) { - geom = DRW_mesh_batch_cache_get_edituv_facedots(ob->data); + geom = DRW_mesh_batch_cache_get_edituv_facedots(ob, ob->data); if (geom) { DRW_shgroup_call_obmat(pd->edit_uv_face_dots_grp, geom, NULL); } @@ -465,14 +465,14 @@ static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob) if (pd->edit_uv.do_uv_stretching_overlay) { if (pd->edit_uv.draw_type == SI_UVDT_STRETCH_ANGLE) { - geom = DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(me); + geom = DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(ob, me); } else /* SI_UVDT_STRETCH_AREA */ { OVERLAY_StretchingAreaTotals *totals = MEM_mallocN(sizeof(OVERLAY_StretchingAreaTotals), __func__); BLI_addtail(&pd->edit_uv.totals, totals); geom = DRW_mesh_batch_cache_get_edituv_faces_stretch_area( - me, &totals->total_area, &totals->total_area_uv); + ob, me, &totals->total_area, &totals->total_area_uv); } if (geom) { DRW_shgroup_call_obmat(pd->edit_uv_stretching_grp, geom, NULL); @@ -482,7 +482,7 @@ static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob) if (draw_shadows && (has_active_object_uvmap || has_active_edit_uvmap)) { if (pd->edit_uv.do_uv_shadow_overlay) { - geom = DRW_mesh_batch_cache_get_uv_edges(ob->data); + geom = DRW_mesh_batch_cache_get_uv_edges(ob, ob->data); if (geom) { DRW_shgroup_call_obmat(pd->edit_uv_shadow_edges_grp, geom, NULL); } diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c index 12db2bd02cf..54e8ef80854 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.c +++ b/source/blender/draw/engines/overlay/overlay_engine.c @@ -262,7 +262,7 @@ static bool overlay_object_is_edit_mode(const OVERLAY_PrivateData *pd, const Obj return pd->ctx_mode == CTX_MODE_EDIT_METABALL; case OB_FONT: return pd->ctx_mode == CTX_MODE_EDIT_TEXT; - case OB_HAIR: + case OB_CURVES: case OB_POINTCLOUD: case OB_VOLUME: /* No edit mode yet. */ @@ -316,7 +316,7 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) OB_MBALL, OB_FONT, OB_GPENCIL, - OB_HAIR, + OB_CURVES, OB_POINTCLOUD, OB_VOLUME); const bool draw_surface = (ob->dt >= OB_WIRE) && (renderable || (ob->dt == OB_WIRE)); diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index a2362cd8850..de0003625a2 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -484,7 +484,7 @@ static void OVERLAY_texture_space(OVERLAY_ExtraCallBuffers *cb, Object *ob, cons texcosize = mb->size; break; } - case ID_HA: + case ID_CV: case ID_PT: case ID_VO: { /* No user defined texture space support. */ diff --git a/source/blender/draw/engines/overlay/overlay_fade.c b/source/blender/draw/engines/overlay/overlay_fade.c index 0971021f1c0..557a8976ff7 100644 --- a/source/blender/draw/engines/overlay/overlay_fade.c +++ b/source/blender/draw/engines/overlay/overlay_fade.c @@ -43,7 +43,6 @@ void OVERLAY_fade_cache_init(OVERLAY_Data *vedata) GPUShader *sh = OVERLAY_shader_uniform_color(); pd->fade_grp[i] = DRW_shgroup_create(sh, psl->fade_ps[i]); - DRW_shgroup_uniform_block(pd->fade_grp[i], "globalsBlock", G_draw.block_ubo); const DRWContextState *draw_ctx = DRW_context_state_get(); float color[4]; diff --git a/source/blender/draw/engines/overlay/overlay_shader.c b/source/blender/draw/engines/overlay/overlay_shader.c index 9899dce5df6..4c09349c35d 100644 --- a/source/blender/draw/engines/overlay/overlay_shader.c +++ b/source/blender/draw/engines/overlay/overlay_shader.c @@ -385,7 +385,7 @@ GPUShader *OVERLAY_shader_armature_sphere(bool use_outline) const DRWContextState *draw_ctx = DRW_context_state_get(); const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; - const char extensions[] = "#extension GL_ARB_conservative_depth : enable\n"; + const char extensions[] = ""; if (use_outline && !sh_data->armature_sphere_outline) { sh_data->armature_sphere_outline = GPU_shader_create_from_arrays({ .vert = (const char *[]){sh_cfg->lib, diff --git a/source/blender/draw/engines/overlay/overlay_volume.c b/source/blender/draw/engines/overlay/overlay_volume.c index ad0ccf1c7c4..b13351984a3 100644 --- a/source/blender/draw/engines/overlay/overlay_volume.c +++ b/source/blender/draw/engines/overlay/overlay_volume.c @@ -37,7 +37,6 @@ void OVERLAY_volume_cache_init(OVERLAY_Data *vedata) GPUShader *sh = OVERLAY_shader_depth_only(); DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->volume_ps); pd->volume_selection_surface_grp = grp; - DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); } else { psl->volume_ps = NULL; diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c index 449130c4c5b..1eb8fc981cf 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.c +++ b/source/blender/draw/engines/overlay/overlay_wireframe.c @@ -185,10 +185,11 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, Mesh *me = ob->data; if (is_edit_mode) { BLI_assert(me->edit_mesh); - BMEditMesh *embm = me->edit_mesh; - has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final); - if (embm->mesh_eval_final) { - me = embm->mesh_eval_final; + Mesh *editmesh_eval_final = BKE_object_get_editmesh_eval_final(ob); + Mesh *editmesh_eval_cage = BKE_object_get_editmesh_eval_cage(ob); + has_edit_mesh_cage = editmesh_eval_cage && (editmesh_eval_cage != editmesh_eval_final); + if (editmesh_eval_final) { + me = editmesh_eval_final; } } is_mesh_verts_only = me->totedge == 0 && me->totvert > 0; diff --git a/source/blender/draw/engines/overlay/shaders/edit_uv_edges_frag.glsl b/source/blender/draw/engines/overlay/shaders/edit_uv_edges_frag.glsl index f7792dc0371..8f90c1acbbb 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_uv_edges_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_uv_edges_frag.glsl @@ -40,7 +40,7 @@ void main() } else if (lineStyle == OVERLAY_UV_LINE_STYLE_DASH) { if (fract(line_distance / dashLength) < 0.5) { - inner_color = mix(vec4(1.0), colorEdgeSelect, selectionFac_f); + inner_color = mix(vec4(vec3(0.35), 1.0), colorEdgeSelect, selectionFac_f); } } else if (lineStyle == OVERLAY_UV_LINE_STYLE_BLACK) { |