Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py33
-rw-r--r--source/blender/blenloader/intern/versioning_300.c16
-rw-r--r--source/blender/draw/engines/overlay/overlay_armature.c196
-rw-r--r--source/blender/draw/engines/overlay/overlay_private.h24
-rw-r--r--source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl4
-rw-r--r--source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl2
-rw-r--r--source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl4
-rw-r--r--source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl4
-rw-r--r--source/blender/makesdna/DNA_view3d_defaults.h1
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_space.c9
11 files changed, 235 insertions, 60 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 3fd19dd70cf..7d8e74ed7ce 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6504,18 +6504,38 @@ class VIEW3D_PT_overlay_sculpt(Panel):
row.prop(overlay, "sculpt_mode_face_sets_opacity", text="Face Sets")
-class VIEW3D_PT_overlay_pose(Panel):
+class VIEW3D_PT_overlay_bones(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_parent_id = 'VIEW3D_PT_overlay'
- bl_label = "Pose Mode"
+ bl_label = "Bones"
+
+ @staticmethod
+ def is_using_wireframe(context):
+ shading = VIEW3D_PT_shading.get_shading(context)
+
+ if shading.type == 'WIREFRAME' or shading.show_xray:
+ return True
+
+ mode = context.mode
+
+ if mode in ('POSE', 'PAINT_WEIGHT'):
+ armature = context.pose_object
+ elif mode == 'EDIT_ARMATURE':
+ armature = context.edit_object
+ else:
+ return False
+
+ return armature and armature.display_type == 'WIRE'
@classmethod
def poll(cls, context):
mode = context.mode
return (
(mode == 'POSE') or
- (mode == 'PAINT_WEIGHT' and context.pose_object)
+ (mode == 'PAINT_WEIGHT' and context.pose_object) or
+ (mode in ('EDIT_ARMATURE', 'OBJECT') and
+ VIEW3D_PT_overlay_bones.is_using_wireframe(context))
)
def draw(self, context):
@@ -6534,10 +6554,13 @@ class VIEW3D_PT_overlay_pose(Panel):
sub = row.row()
sub.active = display_all and overlay.show_xray_bone
sub.prop(overlay, "xray_alpha_bone", text="Fade Geometry")
- else:
+ elif mode == 'PAINT_WEIGHT':
row = col.row()
row.prop(overlay, "show_xray_bone")
+ if VIEW3D_PT_overlay_bones.is_using_wireframe(context):
+ col.prop(overlay, "bone_wire_alpha")
+
class VIEW3D_PT_overlay_texture_paint(Panel):
bl_space_type = 'VIEW_3D'
@@ -7705,7 +7728,7 @@ classes = (
VIEW3D_PT_overlay_texture_paint,
VIEW3D_PT_overlay_vertex_paint,
VIEW3D_PT_overlay_weight_paint,
- VIEW3D_PT_overlay_pose,
+ VIEW3D_PT_overlay_bones,
VIEW3D_PT_overlay_sculpt,
VIEW3D_PT_snapping,
VIEW3D_PT_proportional_edit,
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 5a93e81d2b1..5cfc937acf1 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -45,6 +45,8 @@
#include "DNA_listBase.h"
#include "DNA_material_types.h"
#include "DNA_modifier_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "DNA_workspace_types.h"
@@ -2526,5 +2528,19 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Initialize the bone wireframe opacity setting. */
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "bone_wire_alpha")) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->overlay.bone_wire_alpha = 1.0f;
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c
index a754e81b949..6fdf410440d 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.c
+++ b/source/blender/draw/engines/overlay/overlay_armature.c
@@ -139,6 +139,10 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
pd->armature.do_pose_fade_geom = pd->armature.do_pose_xray &&
((draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) == 0) &&
draw_ctx->object_pose != NULL;
+
+ const float wire_alpha = pd->overlay.bone_wire_alpha;
+ const bool use_wire_alpha = (wire_alpha < 1.0f);
+
DRWState state;
if (pd->armature.do_pose_fade_geom) {
@@ -164,8 +168,8 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
OVERLAY_InstanceFormats *formats = OVERLAY_shader_instance_formats_get();
OVERLAY_ArmatureCallBuffers *cb = &pd->armature_call_buffers[i];
- cb->custom_shapes_ghash = BLI_ghash_ptr_new(__func__);
- cb->custom_shapes_transp_ghash = BLI_ghash_ptr_new(__func__);
+ cb->solid.custom_shapes_ghash = BLI_ghash_ptr_new(__func__);
+ cb->transp.custom_shapes_ghash = BLI_ghash_ptr_new(__func__);
DRWPass **p_armature_ps = &psl->armature_ps[i];
DRWState infront_state = (DRW_state_is_select() && (i == 1)) ? DRW_STATE_IN_FRONT_SELECT : 0;
@@ -189,44 +193,85 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
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->point_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get());
+ 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_float_copy(grp, "alpha", 0.4f);
- cb->point_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get());
+ 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->custom_solid = grp;
- cb->box_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get());
- cb->octa_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_get());
+ cb->solid.custom_fill = grp;
+ cb->solid.box_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get());
+ cb->solid.octa_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_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_float_copy(grp, "alpha", 0.6f);
- cb->custom_transp = grp;
- cb->box_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get());
- cb->octa_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_get());
+ 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());
+ cb->transp.octa_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_get());
sh = OVERLAY_shader_armature_sphere(true);
grp = DRW_shgroup_create(sh, armature_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
- cb->point_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_point_wire_outline_get());
+ DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ cb->solid.point_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_point_wire_outline_get());
+
+ if (use_wire_alpha) {
+ grp = DRW_shgroup_create(sh, armature_ps);
+ 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);
+ cb->transp.point_outline = BUF_INSTANCE(
+ grp, format, DRW_cache_bone_point_wire_outline_get());
+ }
+ else {
+ cb->transp.point_outline = cb->solid.point_outline;
+ }
sh = OVERLAY_shader_armature_shape(true);
- cb->custom_outline = grp = DRW_shgroup_create(sh, armature_ps);
+ cb->solid.custom_outline = grp = DRW_shgroup_create(sh, armature_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
- cb->box_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_box_wire_get());
- cb->octa_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_wire_get());
+ DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ cb->solid.box_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_box_wire_get());
+ cb->solid.octa_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_wire_get());
+
+ if (use_wire_alpha) {
+ cb->transp.custom_outline = grp = DRW_shgroup_create(sh, armature_ps);
+ 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);
+ cb->transp.box_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_box_wire_get());
+ cb->transp.octa_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_wire_get());
+ }
+ else {
+ cb->transp.custom_outline = cb->solid.custom_outline;
+ cb->transp.box_outline = cb->solid.box_outline;
+ cb->transp.octa_outline = cb->solid.octa_outline;
+ }
sh = OVERLAY_shader_armature_shape_wire();
- cb->custom_wire = grp = DRW_shgroup_create(sh, armature_ps);
+ cb->solid.custom_wire = 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);
+
+ if (use_wire_alpha) {
+ cb->transp.custom_wire = grp = DRW_shgroup_create(sh, armature_ps);
+ 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);
+ }
+ else {
+ cb->transp.custom_wire = cb->solid.custom_wire;
+ }
}
{
format = formats->instance_extra;
@@ -234,12 +279,35 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
sh = OVERLAY_shader_armature_degrees_of_freedom_wire();
grp = DRW_shgroup_create(sh, armature_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
- cb->dof_lines = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_lines_get());
+ DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ cb->solid.dof_lines = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_lines_get());
+
+ if (use_wire_alpha) {
+ grp = DRW_shgroup_create(sh, armature_ps);
+ 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);
+ cb->transp.dof_lines = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_lines_get());
+ }
+ else {
+ cb->transp.dof_lines = cb->solid.dof_lines;
+ }
sh = OVERLAY_shader_armature_degrees_of_freedom_solid();
grp = DRW_shgroup_create(sh, armature_transp_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
- cb->dof_sphere = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_sphere_get());
+ DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ cb->solid.dof_sphere = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_sphere_get());
+
+ if (use_wire_alpha) {
+ 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", wire_alpha);
+ cb->transp.dof_sphere = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_sphere_get());
+ }
+ else {
+ cb->transp.dof_sphere = cb->solid.dof_sphere;
+ }
}
{
format = formats->instance_bone_stick;
@@ -247,7 +315,19 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
sh = OVERLAY_shader_armature_stick();
grp = DRW_shgroup_create(sh, armature_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
- cb->stick = BUF_INSTANCE(grp, format, DRW_cache_bone_stick_get());
+ DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ cb->solid.stick = BUF_INSTANCE(grp, format, DRW_cache_bone_stick_get());
+
+ if (use_wire_alpha) {
+ grp = DRW_shgroup_create(sh, armature_ps);
+ 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);
+ cb->transp.stick = BUF_INSTANCE(grp, format, DRW_cache_bone_stick_get());
+ }
+ else {
+ cb->transp.stick = cb->solid.stick;
+ }
}
{
format = formats->instance_bone_envelope;
@@ -258,29 +338,57 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
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->envelope_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get());
+ cb->solid.envelope_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_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_STATE_CULL_BACK);
- DRW_shgroup_uniform_float_copy(grp, "alpha", 0.6f);
- cb->envelope_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get());
+ DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha * 0.6f);
+ cb->transp.envelope_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get());
format = formats->instance_bone_envelope_outline;
sh = OVERLAY_shader_armature_envelope(true);
grp = DRW_shgroup_create(sh, armature_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
- cb->envelope_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_outline_get());
+ DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ cb->solid.envelope_outline = BUF_INSTANCE(
+ grp, format, DRW_cache_bone_envelope_outline_get());
+
+ if (use_wire_alpha) {
+ grp = DRW_shgroup_create(sh, armature_ps);
+ 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);
+ cb->transp.envelope_outline = BUF_INSTANCE(
+ grp, format, DRW_cache_bone_envelope_outline_get());
+ }
+ else {
+ cb->transp.envelope_outline = cb->solid.envelope_outline;
+ }
format = formats->instance_bone_envelope_distance;
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);
- cb->envelope_distance = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get());
+ cb->solid.envelope_distance = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get());
+
+ if (use_wire_alpha) {
+ 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", wire_alpha);
+ DRW_shgroup_uniform_bool_copy(grp, "isDistance", true);
+ DRW_shgroup_state_enable(grp, DRW_STATE_CULL_FRONT);
+ cb->transp.envelope_distance = BUF_INSTANCE(
+ grp, format, DRW_cache_bone_envelope_solid_get());
+ }
+ else {
+ cb->transp.envelope_distance = cb->solid.envelope_distance;
+ }
}
{
format = formats->pos_color;
@@ -288,7 +396,19 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
sh = OVERLAY_shader_armature_wire();
grp = DRW_shgroup_create(sh, armature_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
- cb->wire = BUF_LINE(grp, format);
+ DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ cb->solid.wire = BUF_LINE(grp, format);
+
+ if (use_wire_alpha) {
+ grp = DRW_shgroup_create(sh, armature_ps);
+ 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);
+ cb->transp.wire = BUF_LINE(grp, format);
+ }
+ else {
+ cb->transp.wire = cb->solid.wire;
+ }
}
}
}
@@ -2161,16 +2281,15 @@ static void armature_context_setup(ArmatureDrawContext *ctx,
const bool is_filled = (!pd->armature.transparent && !draw_as_wire) || !is_object_mode;
const bool is_transparent = pd->armature.transparent || (draw_as_wire && !is_object_mode);
bArmature *arm = ob->data;
- OVERLAY_ArmatureCallBuffers *cb = &pd->armature_call_buffers[is_xray];
+ OVERLAY_ArmatureCallBuffers *cbo = &pd->armature_call_buffers[is_xray];
+ OVERLAY_ArmatureCallBuffersInner *cb = is_transparent ? &cbo->transp : &cbo->solid;
static const float select_const_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
switch (arm->drawtype) {
case ARM_ENVELOPE:
ctx->envelope_outline = cb->envelope_outline;
- ctx->envelope_solid = (is_filled) ?
- (is_transparent ? cb->envelope_transp : cb->envelope_solid) :
- NULL;
+ ctx->envelope_solid = (is_filled) ? cb->envelope_fill : NULL;
ctx->envelope_distance = (do_envelope_dist) ? cb->envelope_distance : NULL;
break;
case ARM_LINE:
@@ -2181,24 +2300,23 @@ static void armature_context_setup(ArmatureDrawContext *ctx,
break;
case ARM_B_BONE:
ctx->outline = cb->box_outline;
- ctx->solid = (is_filled) ? (is_transparent ? cb->box_transp : cb->box_solid) : NULL;
+ ctx->solid = (is_filled) ? cb->box_fill : NULL;
break;
case ARM_OCTA:
ctx->outline = cb->octa_outline;
- ctx->solid = (is_filled) ? (is_transparent ? cb->octa_transp : cb->octa_solid) : NULL;
+ ctx->solid = (is_filled) ? cb->octa_fill : NULL;
break;
}
ctx->ob = ob;
ctx->extras = &pd->extra_call_buffers[is_xray];
ctx->dof_lines = cb->dof_lines;
ctx->dof_sphere = cb->dof_sphere;
- ctx->point_solid = (is_filled) ? (is_transparent ? cb->point_transp : cb->point_solid) : NULL;
+ ctx->point_solid = (is_filled) ? cb->point_fill : NULL;
ctx->point_outline = cb->point_outline;
- ctx->custom_solid = (is_filled) ? (is_transparent ? cb->custom_transp : cb->custom_solid) : NULL;
+ ctx->custom_solid = (is_filled) ? cb->custom_fill : NULL;
ctx->custom_outline = cb->custom_outline;
ctx->custom_wire = cb->custom_wire;
- ctx->custom_shapes_ghash = is_transparent ? cb->custom_shapes_transp_ghash :
- cb->custom_shapes_ghash;
+ ctx->custom_shapes_ghash = cb->custom_shapes_ghash;
ctx->show_relations = pd->armature.show_relations;
ctx->do_relations = !DRW_state_is_select() && pd->armature.show_relations &&
(is_edit_mode | is_pose_mode);
@@ -2282,10 +2400,10 @@ void OVERLAY_armature_cache_finish(OVERLAY_Data *vedata)
OVERLAY_PrivateData *pd = vedata->stl->pd;
for (int i = 0; i < 2; i++) {
- if (pd->armature_call_buffers[i].custom_shapes_ghash) {
+ if (pd->armature_call_buffers[i].solid.custom_shapes_ghash) {
/* TODO(fclem): Do not free it for each frame but reuse it. Avoiding alloc cost. */
- BLI_ghash_free(pd->armature_call_buffers[i].custom_shapes_ghash, NULL, NULL);
- BLI_ghash_free(pd->armature_call_buffers[i].custom_shapes_transp_ghash, NULL, NULL);
+ BLI_ghash_free(pd->armature_call_buffers[i].solid.custom_shapes_ghash, NULL, NULL);
+ BLI_ghash_free(pd->armature_call_buffers[i].transp.custom_shapes_ghash, NULL, NULL);
}
}
}
diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h
index 8e7c3094062..6a322e300f5 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -216,37 +216,37 @@ typedef struct OVERLAY_ExtraCallBuffers {
DRWShadingGroup *extra_loose_points;
} OVERLAY_ExtraCallBuffers;
-typedef struct OVERLAY_ArmatureCallBuffers {
+typedef struct OVERLAY_ArmatureCallBuffersInner {
DRWCallBuffer *box_outline;
- DRWCallBuffer *box_solid;
- DRWCallBuffer *box_transp;
+ DRWCallBuffer *box_fill;
DRWCallBuffer *dof_lines;
DRWCallBuffer *dof_sphere;
DRWCallBuffer *envelope_distance;
DRWCallBuffer *envelope_outline;
- DRWCallBuffer *envelope_solid;
- DRWCallBuffer *envelope_transp;
+ DRWCallBuffer *envelope_fill;
DRWCallBuffer *octa_outline;
- DRWCallBuffer *octa_solid;
- DRWCallBuffer *octa_transp;
+ DRWCallBuffer *octa_fill;
DRWCallBuffer *point_outline;
- DRWCallBuffer *point_solid;
- DRWCallBuffer *point_transp;
+ DRWCallBuffer *point_fill;
DRWCallBuffer *stick;
DRWCallBuffer *wire;
DRWShadingGroup *custom_outline;
- DRWShadingGroup *custom_solid;
- DRWShadingGroup *custom_transp;
+ DRWShadingGroup *custom_fill;
DRWShadingGroup *custom_wire;
- GHash *custom_shapes_transp_ghash;
+
GHash *custom_shapes_ghash;
+} OVERLAY_ArmatureCallBuffersInner;
+
+typedef struct OVERLAY_ArmatureCallBuffers {
+ OVERLAY_ArmatureCallBuffersInner solid;
+ OVERLAY_ArmatureCallBuffersInner transp;
} OVERLAY_ArmatureCallBuffers;
typedef struct OVERLAY_PrivateData {
diff --git a/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl
index e511aab69c1..aedc9bcda61 100644
--- a/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl
@@ -1,4 +1,6 @@
+uniform float alpha = 1.0;
+
flat in vec4 finalColor;
layout(location = 0) out vec4 fragColor;
@@ -6,6 +8,6 @@ layout(location = 1) out vec4 lineOutput;
void main()
{
- fragColor = finalColor;
+ fragColor = vec4(finalColor.rgb, finalColor.a * alpha);
lineOutput = vec4(0.0);
}
diff --git a/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl
index e4a4f0875f8..51cfe6250be 100644
--- a/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl
@@ -14,7 +14,7 @@ void main()
float n = normalize(normalView).z;
if (isDistance) {
n = 1.0 - clamp(-n, 0.0, 1.0);
- fragColor = vec4(1.0, 1.0, 1.0, 0.2) * n;
+ fragColor = vec4(1.0, 1.0, 1.0, 0.33 * alpha) * n;
}
else {
/* Smooth lighting factor. */
diff --git a/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl
index e7696c1ea7d..85136672180 100644
--- a/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl
@@ -1,4 +1,6 @@
+uniform float alpha = 1.0;
+
noperspective in float colorFac;
flat in vec4 finalWireColor;
flat in vec4 finalInnerColor;
@@ -10,6 +12,6 @@ void main()
{
float fac = smoothstep(1.0, 0.2, colorFac);
fragColor.rgb = mix(finalInnerColor.rgb, finalWireColor.rgb, fac);
- fragColor.a = 1.0;
+ fragColor.a = alpha;
lineOutput = vec4(0.0);
}
diff --git a/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl
index 9413ac0f365..55278515f74 100644
--- a/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl
@@ -1,4 +1,6 @@
+uniform float alpha = 1.0;
+
flat in vec4 finalColor;
flat in vec2 edgeStart;
noperspective in vec2 edgePos;
@@ -9,5 +11,5 @@ layout(location = 1) out vec4 lineOutput;
void main()
{
lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos);
- fragColor = finalColor;
+ fragColor = vec4(finalColor.rgb, finalColor.a * alpha);
}
diff --git a/source/blender/makesdna/DNA_view3d_defaults.h b/source/blender/makesdna/DNA_view3d_defaults.h
index c4d0c83b346..870197a401c 100644
--- a/source/blender/makesdna/DNA_view3d_defaults.h
+++ b/source/blender/makesdna/DNA_view3d_defaults.h
@@ -53,6 +53,7 @@
.wireframe_threshold = 1.0f, \
.wireframe_opacity = 1.0f, \
.xray_alpha_bone = 0.5f, \
+ .bone_wire_alpha = 1.0f, \
.fade_alpha = 0.40f, \
.texture_paint_mode_opacity = 1.0f, \
.weight_paint_mode_opacity = 1.0f, \
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index ae95f58d4f0..2ec58181394 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -224,6 +224,8 @@ typedef struct View3DOverlay {
/** Armature edit/pose mode settings. */
float xray_alpha_bone;
+ float bone_wire_alpha;
+ char _pad1[4];
/** Darken Inactive. */
float fade_alpha;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 16e9a6208fb..05c1a645823 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -4301,6 +4301,15 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+ prop = RNA_def_property(srna, "bone_wire_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.bone_wire_alpha");
+ RNA_def_property_ui_text(
+ prop, "Bone Wireframe Opacity", "Maximim opacity of bones in wireframe display mode");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
prop = RNA_def_property(srna, "show_motion_paths", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(
prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_MOTION_PATHS);