diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-07-18 07:18:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-07-18 08:45:39 +0300 |
commit | 5d4bd8f1bb3a77f501f03d2ed2fbdcbaf23d516e (patch) | |
tree | ca7121ae5c9a1ea901195772d8d9bfdee0be430f /source/blender/editors/armature/pose_select.c | |
parent | bf8393c1c9d7af85b8efd0697b9d52747fcc8123 (diff) |
Fix T66949: Can't select bones from multiple objects in wpaint mode
This fix relies on 2.7x logic, only de-selecting other armature objects,
making multiple armatures in weight paint mode usable.
Diffstat (limited to 'source/blender/editors/armature/pose_select.c')
-rw-r--r-- | source/blender/editors/armature/pose_select.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 5c20b03b908..8434fee6e78 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -40,6 +40,7 @@ #include "BKE_object.h" #include "BKE_report.h" #include "BKE_layer.h" +#include "BKE_modifier.h" #include "DEG_depsgraph.h" @@ -247,6 +248,38 @@ bool ED_armature_pose_select_pick_with_buffer(ViewLayer *view_layer, return nearBone != NULL; } +/** + * While in weight-paint mode, a single pose may be active as well. + * While not common, it's possible we have multiple armatures deforming a mesh. + * + * This function de-selects all other objects, and selects the new base. + * It can't be set to the active object because we need + * to keep this set to the weight paint object. + */ +void ED_armature_pose_select_in_wpaint_mode(ViewLayer *view_layer, Base *base_select) +{ + BLI_assert(base_select && (base_select->object->type == OB_ARMATURE)); + Object *ob_active = OBACT(view_layer); + BLI_assert(ob_active && (ob_active->mode & OB_MODE_WEIGHT_PAINT)); + VirtualModifierData virtualModifierData; + ModifierData *md = modifiers_getVirtualModifierList(ob_active, &virtualModifierData); + for (; md; md = md->next) { + if (md->type == eModifierType_Armature) { + ArmatureModifierData *amd = (ArmatureModifierData *)md; + Object *ob_arm = amd->object; + if (ob_arm != NULL) { + Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm); + if ((base_arm != NULL) && (base_arm != base_select) && (base_arm->flag & BASE_SELECTED)) { + ED_object_base_select(base_arm, BA_DESELECT); + } + } + } + } + if ((base_select->flag & BASE_SELECTED) == 0) { + ED_object_base_select(base_select, BA_SELECT); + } +} + /* 'select_mode' is usual SEL_SELECT/SEL_DESELECT/SEL_TOGGLE/SEL_INVERT. * When true, 'ignore_visibility' makes this func also affect invisible bones * (hidden or on hidden layers). */ |