diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 05:17:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 05:19:22 +0300 |
commit | 1ffb2bf917acf19aa5d3c0b9215371a771a2ccb1 (patch) | |
tree | 5a7822b7266f85c404ebdb4251181e074da28acb | |
parent | e829e47b55813aaeb3aeff7cba9d1ccae354a731 (diff) |
Pose: make pose-bone xray usable in wpaint mode
Update UI, draw-manager and operator to support with pose-bone-xray
when in weight paint mode.
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 23 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 1 | ||||
-rw-r--r-- | source/blender/draw/modes/pose_mode.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 5 |
4 files changed, 27 insertions, 13 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index e7541729bfd..27013081ce4 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -4812,11 +4812,16 @@ class VIEW3D_PT_overlay_pose(Panel): @classmethod def poll(cls, context): - return context.mode == 'POSE' + mode = context.mode + return ( + (mode == 'POSE') or + (mode == 'PAINT_WEIGHT' and context.active_object.find_armature()) + ) def draw(self, context): layout = self.layout view = context.space_data + mode = context.mode overlay = view.overlay display_all = overlay.show_overlays @@ -4824,11 +4829,15 @@ class VIEW3D_PT_overlay_pose(Panel): col.active = display_all col.prop(overlay, "show_transparent_bones") - row = col.row() - row.prop(overlay, "show_bone_select", text="") - sub = row.row() - sub.active = display_all and overlay.show_bone_select - sub.prop(overlay, "bone_select_alpha", text="Fade Geometry") + if mode == 'POSE': + row = col.row() + row.prop(overlay, "show_bone_select", text="") + sub = row.row() + sub.active = display_all and overlay.show_bone_select + sub.prop(overlay, "bone_select_alpha", text="Fade Geometry") + else: + row = col.row() + row.prop(overlay, "show_bone_select") class VIEW3D_PT_overlay_edit_armature(Panel): @@ -5461,8 +5470,8 @@ classes = ( VIEW3D_PT_overlay_edit_mesh_developer, VIEW3D_PT_overlay_edit_curve, VIEW3D_PT_overlay_edit_armature, - VIEW3D_PT_overlay_pose, VIEW3D_PT_overlay_paint, + VIEW3D_PT_overlay_pose, VIEW3D_PT_overlay_sculpt, VIEW3D_PT_pivot_point, VIEW3D_PT_snapping, diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index c84dd69125c..8846b6f1dc3 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1986,6 +1986,7 @@ void DRW_draw_select_loop( } if (v3d->overlay.flag & V3D_OVERLAY_BONE_SELECT) { if (!(v3d->flag2 & V3D_RENDER_OVERRIDE)) { + /* Note: don't use "BKE_object_pose_armature_get" here, it breaks selection. */ Object *obpose = OBPOSE_FROM_OBACT(obact); if (obpose) { use_obedit = true; diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c index c9a31e616bb..81466f19128 100644 --- a/source/blender/draw/modes/pose_mode.c +++ b/source/blender/draw/modes/pose_mode.c @@ -86,9 +86,9 @@ static struct { /* *********** FUNCTIONS *********** */ static bool POSE_is_bone_selection_overlay_active(void) { - const DRWContextState *dcs = DRW_context_state_get(); - const View3D *v3d = dcs->v3d; - return v3d && (v3d->overlay.flag & V3D_OVERLAY_BONE_SELECT) && OBPOSE_FROM_OBACT(dcs->obact); + const DRWContextState *draw_ctx = DRW_context_state_get(); + const View3D *v3d = draw_ctx->v3d; + return v3d && (v3d->overlay.flag & V3D_OVERLAY_BONE_SELECT) && draw_ctx->object_pose; } static void POSE_engine_init(void *UNUSED(vedata)) @@ -147,8 +147,9 @@ static void POSE_cache_init(void *vedata) { if (POSE_is_bone_selection_overlay_active()) { - copy_v4_fl4(ppd->blend_color, 0.0f, 0.0f, 0.0f, v3d->overlay.bone_select_alpha); - copy_v4_fl4(ppd->blend_color_invert, 0.0f, 0.0f, 0.0f, pow(v3d->overlay.bone_select_alpha, 4)); + const float alpha = (draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) ? 0.0f : v3d->overlay.bone_select_alpha; + copy_v4_fl4(ppd->blend_color, 0.0f, 0.0f, 0.0f, alpha); + copy_v4_fl4(ppd->blend_color_invert, 0.0f, 0.0f, 0.0f, pow(alpha, 4)); DRWShadingGroup *grp; psl->bone_selection = DRW_pass_create( "Bone Selection", diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 82e0511afe5..c94aab1a3c1 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4930,7 +4930,10 @@ static int toggle_xray_exec(bContext *C, wmOperator *op) ScrArea *sa = CTX_wm_area(C); Object *obact = CTX_data_active_object(C); - if (obact && obact->mode & OB_MODE_POSE) { + if (obact && + ((obact->mode & OB_MODE_POSE) || + ((obact->mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(obact)))) + { v3d->overlay.flag ^= V3D_OVERLAY_BONE_SELECT; } else { |