diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-07-18 08:31:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-07-18 08:42:14 +0300 |
commit | bf8393c1c9d7af85b8efd0697b9d52747fcc8123 (patch) | |
tree | c8e2d5fc3c294cbe6bc45313f6122f111f1c8924 | |
parent | 8a083ef3b789d31d2f5a5f561ddfb39aac68bffa (diff) |
Fix weight-paint & pose-select & lock-mode combination
Extend pose object checks to all pose-mode objects
used by the mesh.
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 5865efa0ffa..c0902cd1cd5 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -30,6 +30,7 @@ #include "BLI_math.h" #include "BLI_rect.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" #include "BKE_action.h" #include "BKE_camera.h" @@ -38,6 +39,7 @@ #include "BKE_global.h" #include "BKE_layer.h" #include "BKE_main.h" +#include "BKE_modifier.h" #include "BKE_report.h" #include "BKE_scene.h" @@ -962,8 +964,8 @@ static bool drw_select_filter_object_mode_lock(Object *ob, void *user_data) * we want to select pose bones (this doesn't switch modes). */ static bool drw_select_filter_object_mode_lock_for_weight_paint(Object *ob, void *user_data) { - const Object *ob_pose = user_data; - return (DEG_get_original_object(ob) == ob_pose); + LinkNode *ob_pose_list = user_data; + return ob_pose_list && (BLI_linklist_index(ob_pose_list, DEG_get_original_object(ob)) != -1); } /** @@ -1044,10 +1046,22 @@ int view3d_opengl_select(ViewContext *vc, case VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK: { Object *obact = vc->obact; BLI_assert(obact && (obact->mode & OB_MODE_WEIGHT_PAINT)); - Object *ob_pose = BKE_object_pose_armature_get(obact); + /* While this uses 'alloca' in a loop (which we typically avoid), + * the number of items is nearly always 1, maybe 2..3 in rare cases. */ + LinkNode *ob_pose_list = NULL; + VirtualModifierData virtualModifierData; + const ModifierData *md = modifiers_getVirtualModifierList(obact, &virtualModifierData); + for (; md; md = md->next) { + if (md->type == eModifierType_Armature) { + ArmatureModifierData *amd = (ArmatureModifierData *)md; + if (amd->object && (amd->object->mode & OB_MODE_POSE)) { + BLI_linklist_prepend_alloca(&ob_pose_list, amd->object); + } + } + } object_filter.fn = drw_select_filter_object_mode_lock_for_weight_paint; - object_filter.user_data = ob_pose; + object_filter.user_data = ob_pose_list; break; } case VIEW3D_SELECT_FILTER_NOP: |