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 <campbell@blender.org>2022-03-22 05:13:11 +0300
committerCampbell Barton <campbell@blender.org>2022-03-22 05:39:01 +0300
commit59870796ea8c659bcb36b5d57377ac64ae1c3e63 (patch)
tree86e57f2d7835d82e98ada0377a0c5693d980db5f /source/blender/editors
parent4046f61b39c6ba7f12a2df888ada2ecbd52cac76 (diff)
Fix T96663: Selecting a pose-bone doesn't activate the object
Regression in [0] that removed object selection changes while remaining in pose-mode. This unintentionally removed object activation. [0]: 859c062a2a3083f53d801fce4b722dcc52482e7e
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c79
1 files changed, 45 insertions, 34 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 9dc5c9ea319..826cebe1276 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -2381,6 +2381,9 @@ static bool ed_object_select_pick(bContext *C,
float dist = ED_view3d_select_dist_px() * 1.3333f;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
+ /* Handle setting the new base active */
+ bool use_activate_selected_base = false;
+
/* When enabled, don't attempt any further selection. */
bool handled = false;
bool changed = false;
@@ -2526,34 +2529,39 @@ static bool ed_object_select_pick(bContext *C,
* not-selected active object in pose-mode won't work well for tools */
ED_object_base_select(basact, BA_SELECT);
- if (is_pose_mode && (basact->object->mode & OB_MODE_POSE)) {
- /* Within pose-mode, keep the current selection when switching pose bones,
- * this is noticeable when in pose mode with multiple objects at once.
- * Where selecting the bone of a different object would de-select this one.
- * After that, exiting pose-mode would only have the active armature selected.
- * This matches multi-object edit-mode behavior. */
- handled = true;
- }
- else {
- /* Don't set `handled` here as the object selection may be necessary
- * when starting out in object-mode and moving into pose-mode,
- * when moving from pose to object-mode using object selection also makes sense. */
- }
-
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
/* In weight-paint, we use selected bone to select vertex-group,
* so don't switch to new active object. */
- if (oldbasact && (oldbasact->object->mode & OB_MODE_ALL_WEIGHT_PAINT)) {
- /* Prevent activating.
- * Selection causes this to be considered the 'active' pose in weight-paint mode.
- * Eventually this limitation may be removed.
- * For now, de-select all other pose objects deforming this mesh. */
- ED_armature_pose_select_in_wpaint_mode(view_layer, basact);
-
- handled = true;
+ if (oldbasact) {
+ if (oldbasact->object->mode & OB_MODE_ALL_WEIGHT_PAINT) {
+ /* Prevent activating.
+ * Selection causes this to be considered the 'active' pose in weight-paint mode.
+ * Eventually this limitation may be removed.
+ * For now, de-select all other pose objects deforming this mesh. */
+ ED_armature_pose_select_in_wpaint_mode(view_layer, basact);
+
+ handled = true;
+ }
+ else if (is_pose_mode && (basact->object->mode & OB_MODE_POSE)) {
+ /* Within pose-mode, keep the current selection when switching pose bones,
+ * this is noticeable when in pose mode with multiple objects at once.
+ * Where selecting the bone of a different object would de-select this one.
+ * After that, exiting pose-mode would only have the active armature selected.
+ * This matches multi-object edit-mode behavior. */
+ handled = true;
+
+ if (oldbasact != basact) {
+ use_activate_selected_base = true;
+ }
+ }
+ else {
+ /* Don't set `handled` here as the object selection may be necessary
+ * when starting out in object-mode and moving into pose-mode,
+ * when moving from pose to object-mode using object selection also makes sense. */
+ }
}
}
}
@@ -2621,7 +2629,7 @@ static bool ed_object_select_pick(bContext *C,
}
/* Also prevent making it active on mouse selection. */
else if (BASE_SELECTABLE(v3d, basact)) {
- const bool use_activate_selected_base = (oldbasact != basact) && (is_obedit == false);
+ use_activate_selected_base |= (oldbasact != basact) && (is_obedit == false);
switch (params->sel_op) {
case SEL_OP_ADD: {
@@ -2657,14 +2665,22 @@ static bool ed_object_select_pick(bContext *C,
break;
}
}
+ }
- if (use_activate_selected_base) {
- ED_object_base_activate(C, basact); /* adds notifier */
- if ((scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) == 0) {
- WM_toolsystem_update_from_context_view3d(C);
- }
- }
+ DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ }
+
+ if (use_activate_selected_base && (basact != NULL)) {
+ changed = true;
+ ED_object_base_activate(C, basact); /* adds notifier */
+ if ((scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) == 0) {
+ WM_toolsystem_update_from_context_view3d(C);
+ }
+ }
+ if (changed) {
+ if (use_activate_selected_base) {
/* Set special modes for grease pencil
* The grease pencil modes are not real modes, but a hack to make the interface
* consistent, so need some tricks to keep UI synchronized */
@@ -2686,11 +2702,6 @@ static bool ed_object_select_pick(bContext *C,
}
}
- DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- }
-
- if (changed) {
if (vc.obact && vc.obact->mode & OB_MODE_POSE) {
ED_outliner_select_sync_from_pose_bone_tag(C);
}