diff options
Diffstat (limited to 'source/blender/editors/armature/armature_select.c')
-rw-r--r-- | source/blender/editors/armature/armature_select.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index fc295647ed5..b87942fed84 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -53,6 +53,8 @@ #include "ED_screen.h" #include "ED_view3d.h" +#include "DEG_depsgraph.h" + #include "armature_intern.h" /* utility macros for storing a temp int in the bone (selection flag) */ @@ -98,7 +100,7 @@ void *get_bone_from_selectbuffer( /* Determine what the current bone is */ if (obedit == NULL || base->object != obedit) { /* no singular posemode, so check for correct object */ - if (base->selcol == (hitresult & 0xFFFF)) { + if (base->object->select_color == (hitresult & 0xFFFF)) { bone = get_indexed_bone(base->object, hitresult); if (findunsel) @@ -166,21 +168,23 @@ void *get_bone_from_selectbuffer( /* x and y are mouse coords (area space) */ void *get_nearest_bone(bContext *C, const int xy[2], bool findunsel) { + EvaluationContext eval_ctx; ViewContext vc; rcti rect; unsigned int buffer[MAXPICKBUF]; short hits; - + + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); // rect.xmin = ... mouseco! rect.xmin = rect.xmax = xy[0]; rect.ymin = rect.ymax = xy[1]; - hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); + hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST); if (hits > 0) - return get_bone_from_selectbuffer(vc.scene, vc.scene->basact, buffer, hits, findunsel, true); + return get_bone_from_selectbuffer(vc.scene, vc.view_layer->basact, buffer, hits, findunsel, true); return NULL; } @@ -291,7 +295,7 @@ static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits12, const /* does bones and points */ /* note that BONE ROOT only gets drawn for root bones (or without IK) */ static EditBone *get_nearest_editbonepoint( - ViewContext *vc, const int mval[2], + const EvaluationContext *eval_ctx, ViewContext *vc, const int mval[2], ListBase *edbo, bool findunsel, bool use_cycle, int *r_selmask) { bArmature *arm = (bArmature *)vc->obedit->data; @@ -344,7 +348,7 @@ static EditBone *get_nearest_editbonepoint( view3d_opengl_select_cache_begin(); BLI_rcti_init_pt_radius(&rect, mval, 12); - hits12 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, select_mode); + hits12 = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, &rect, select_mode); if (hits12 == 1) { hits = selectbuffer_ret_hits_12(buffer, hits12); goto cache_end; @@ -354,7 +358,7 @@ static EditBone *get_nearest_editbonepoint( offs = 4 * hits12; BLI_rcti_init_pt_radius(&rect, mval, 5); - hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); + hits5 = view3d_opengl_select(eval_ctx, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); if (hits5 == 1) { hits = selectbuffer_ret_hits_5(buffer, hits12, hits5); @@ -482,17 +486,19 @@ bool ED_armature_select_pick(bContext *C, const int mval[2], bool extend, bool d { Object *obedit = CTX_data_edit_object(C); bArmature *arm = obedit->data; + EvaluationContext eval_ctx; ViewContext vc; EditBone *nearBone = NULL; int selmask; + CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); - + if (BIF_sk_selectStroke(C, mval, extend)) { return true; } - nearBone = get_nearest_editbonepoint(&vc, mval, arm->edbo, true, true, &selmask); + nearBone = get_nearest_editbonepoint(&eval_ctx, &vc, mval, arm->edbo, true, true, &selmask); if (nearBone) { if (!extend && !deselect && !toggle) { |