diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-07-23 01:18:08 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-07-23 01:18:08 +0300 |
commit | a4310ba85f658406e8b6c3371ff3c75aea702a7f (patch) | |
tree | 6566d0e0a86ae3dac744e637cd9caee9187f3901 /source/blender/draw/intern | |
parent | bd42740ef1cfee580d166b003bf584d5c6a6be3e (diff) | |
parent | 8c618371507fc95d51671d2f807e864adf1f4791 (diff) |
Merge branch 'master' into soc-2019-openxr
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_armature.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index f97efa9aed9..30e51333f0f 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -1978,6 +1978,7 @@ static void draw_armature_edit(Object *ob) static void draw_armature_pose(Object *ob, const float const_color[4]) { const DRWContextState *draw_ctx = DRW_context_state_get(); + const Scene *scene = draw_ctx->scene; bArmature *arm = ob->data; bPoseChannel *pchan; int index = -1; @@ -1990,19 +1991,35 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) return; } - // if (!(base->flag & OB_FROMDUPLI)) // TODO - { + bool is_pose_select = false; + /* Object can be edited in the scene. */ + if ((ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI)) == 0) { if ((draw_ctx->object_mode & OB_MODE_POSE) || (ob == draw_ctx->object_pose)) { arm->flag |= ARM_POSEMODE; } + is_pose_select = + /* If we're in pose-mode or object-mode with the ability to enter pose mode. */ + ( + /* Draw as if in pose mode (when selection is possible). */ + (arm->flag & ARM_POSEMODE) || + /* When we're in object mode, which may select bones. */ + ((ob->mode & OB_MODE_POSE) && + ( + /* Switch from object mode when object lock is disabled. */ + ((draw_ctx->object_mode == OB_MODE_OBJECT) && + (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) == 0) || + /* Allow selection when in weight-paint mode + * (selection code ensures this wont become active). */ + ((draw_ctx->object_mode == OB_MODE_WEIGHT_PAINT) && + (draw_ctx->object_pose != NULL))))) && + DRW_state_is_select(); - if (arm->flag & ARM_POSEMODE) { + if (is_pose_select) { const Object *ob_orig = DEG_get_original_object(ob); index = ob_orig->runtime.select_id; } } - const bool is_pose_select = (arm->flag & ARM_POSEMODE) && DRW_state_is_select(); const bool show_text = DRW_state_show_text(); const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0); |