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:
authorCampbell Barton <ideasman42@gmail.com>2019-07-18 06:10:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-18 07:26:34 +0300
commit0b4c0472a3aac40a77ea97485755bc79880d80b9 (patch)
tree599b5d61725c91a79578c3c7c2e89be50eb7c959
parent112f0db40d4b4a335bcbb97ce7ca34391dc4408f (diff)
Fix T61117: Selecting an armature doesn't select the bone
Regression from 2.7x caused by 28dfc47cf0b06
-rw-r--r--source/blender/draw/intern/draw_armature.c25
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);