diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-11 09:16:41 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-11 09:17:05 +0300 |
commit | 6d155dc46206f69aa704c184d40f74274a4ec0cd (patch) | |
tree | 964f499416c7eb952db74210a7518ead7e42d4be /source/blender/editors/armature/pose_edit.c | |
parent | 266638d7832b7794a315fff0c6cec347fc917602 (diff) |
T54983: Bone selection overlay
Bone selection overlay is only available in pose mode.
and when active overrules the selection buffer.
This is currently `tricked` by switching the draw engines, but this is
an exception. Not sure how to solve this in a better way.
After this is solved we can look at how to localize the dim effect to only the objects connected to the active armatures. Currently it dims the whole screen (including background).
@campbellbarton I added you as reviewer as it you have done a lot in the DRW_draw_select_loop
Reviewers: campbellbarton, fclem
Reviewed By: fclem
Subscribers: campbellbarton
Tags: #bf_blender_2.8, #code_quest
Maniphest Tasks: T54983
Differential Revision: https://developer.blender.org/D3241
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index d20a9b7ee8a..5e62210e2e2 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -63,6 +63,7 @@ #include "ED_keyframing.h" #include "ED_screen.h" #include "ED_object.h" +#include "ED_view3d.h" #include "UI_interface.h" @@ -1240,3 +1241,34 @@ void POSE_OT_quaternions_flip(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +/* -------------------------------------------------------------------- */ +/** \name Toggle Bone selection Overlay Operator + * \{ */ + +static int toggle_bone_selection_exec(bContext *C, wmOperator *UNUSED(op)) +{ + View3D *v3d = CTX_wm_view3d(C); + v3d->overlay.flag ^= V3D_OVERLAY_BONE_SELECTION; + ED_view3d_shade_update(CTX_data_main(C), v3d, CTX_wm_area(C)); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); + return OPERATOR_FINISHED; +} + +static int pose_select_linked_poll(bContext *C) +{ + return (ED_operator_view3d_active(C) && ED_operator_posemode(C)); +} + +void POSE_OT_toggle_bone_selection_overlay(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Toggle Bone Selection Overlay"; + ot->description = "Toggle bone selection overlay of the viewport"; + ot->idname = "POSE_OT_toggle_bone_selection_overlay"; + + /* api callbacks */ + ot->exec = toggle_bone_selection_exec; + ot->poll = pose_select_linked_poll; +} + +/** \} */ |