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:
Diffstat (limited to 'source/blender/editors/armature/pose_select.c')
-rw-r--r--source/blender/editors/armature/pose_select.c33
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). */