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>2018-11-23 02:00:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-23 02:03:04 +0300
commit7b4f545e282fcd0b2402c45faf13642bc047d1a5 (patch)
treee709d057d856cbb3a1743004b152210528a82935 /source/blender/editors/space_view3d/view3d_view.c
parent7c74f5006a888a4c42c407752fb53c1da8796a9d (diff)
Fix bone selection w/ mixed wpaint & pose mode
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_view.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 73823791e6c..af52eb15304 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -893,6 +893,19 @@ static bool drw_select_loop_pass(eDRWSelectStage stage, void *user_data)
}
+eV3DSelectObjectFilter ED_view3d_select_filter_from_mode(const Scene *scene, const Object *obact)
+{
+ if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) {
+ if ((obact->mode & OB_MODE_WEIGHT_PAINT) &&
+ BKE_object_pose_armature_get((Object *)obact))
+ {
+ return VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK;
+ }
+ return VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK;
+ }
+ return VIEW3D_SELECT_FILTER_NOP;
+}
+
/** Implement #VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK. */
static bool drw_select_filter_object_mode_lock(Object *ob, void *user_data)
{
@@ -900,6 +913,15 @@ static bool drw_select_filter_object_mode_lock(Object *ob, void *user_data)
return BKE_object_is_mode_compat(ob, obact->mode);
}
+/** Implement #VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK for special case when
+ * 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) ||
+ BKE_object_is_mode_compat(ob, OB_MODE_WEIGHT_PAINT));
+}
+
/**
* \warning be sure to account for a negative return value
* This is an error, "Too many objects in select buffer"
@@ -972,6 +994,16 @@ int view3d_opengl_select(
}
break;
}
+ case VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK:
+ {
+ Object *obact = OBACT(vc->view_layer);
+ BLI_assert(obact && (obact->mode & OB_MODE_WEIGHT_PAINT));
+ Object *ob_pose = BKE_object_pose_armature_get(obact);
+
+ object_filter.fn = drw_select_filter_object_mode_lock_for_weight_paint;
+ object_filter.user_data = ob_pose;
+ break;
+ }
case VIEW3D_SELECT_FILTER_NOP:
break;