diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-16 05:49:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-16 05:49:20 +0400 |
commit | cf20aa834484269eef39912162a91f4d198c0c7e (patch) | |
tree | 3d2c625e6a88c0742f644422a35122fb561dd83d /source/blender/editors/space_view3d/view3d_select.c | |
parent | 6026f133f23f5ff610720c60d4e21efeb9219808 (diff) |
move ED_armature_edit_bone_select() into a more general utility function so view3d-select bone operators can use it and get matching selection behavior when entering editmode.
- specifically - write to the connected parents tipsel flag when setting the rootsel flag.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 96cd5a22f58..3fd0f79b2f0 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -625,8 +625,8 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, INT_MAX)) { is_point_done = true; - if (data->select) ebone->flag |= BONE_ROOTSEL; - else ebone->flag &= ~BONE_ROOTSEL; + if (data->select) ED_armature_ebone_selectflag_enable(ebone, BONE_ROOTSEL); + else ED_armature_ebone_selectflag_disable(ebone, BONE_ROOTSEL); } } @@ -637,8 +637,8 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, INT_MAX)) { is_point_done = true; - if (data->select) ebone->flag |= BONE_TIPSEL; - else ebone->flag &= ~BONE_TIPSEL; + if (data->select) ED_armature_ebone_selectflag_enable(ebone, BONE_TIPSEL); + else ED_armature_ebone_selectflag_disable(ebone, BONE_TIPSEL); } } @@ -646,8 +646,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo if ((is_point_done == false) && (points_proj_tot == 2) && BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, INT_MAX)) { - if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + ED_armature_ebone_select_set(ebone, data->select); data->is_change = true; } @@ -1910,14 +1909,14 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) { if (index & BONESEL_TIP) { ebone->flag |= BONE_DONE; - if (select) ebone->flag |= BONE_TIPSEL; - else ebone->flag &= ~BONE_TIPSEL; + if (select) ED_armature_ebone_selectflag_enable(ebone, BONE_TIPSEL); + else ED_armature_ebone_selectflag_disable(ebone, BONE_TIPSEL); } if (index & BONESEL_ROOT) { ebone->flag |= BONE_DONE; - if (select) ebone->flag |= BONE_ROOTSEL; - else ebone->flag &= ~BONE_ROOTSEL; + if (select) ED_armature_ebone_selectflag_enable(ebone, BONE_ROOTSEL); + else ED_armature_ebone_selectflag_disable(ebone, BONE_ROOTSEL); } } } @@ -1939,10 +1938,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool if (index & BONESEL_BONE) { if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) { if (!(ebone->flag & BONE_DONE)) { - if (select) - ebone->flag |= (BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED); - else - ebone->flag &= ~(BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED); + ED_armature_ebone_select_set(ebone, select); } } } @@ -2602,16 +2598,12 @@ static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, cons if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) { if (head) { - if (data->select) - ebone->flag |= BONE_ROOTSEL; - else - ebone->flag &= ~BONE_ROOTSEL; + if (data->select) ED_armature_ebone_selectflag_enable(ebone, BONE_ROOTSEL); + else ED_armature_ebone_selectflag_disable(ebone, BONE_ROOTSEL); } else { - if (data->select) - ebone->flag |= BONE_TIPSEL; - else - ebone->flag &= ~BONE_TIPSEL; + if (data->select) ED_armature_ebone_selectflag_enable(ebone, BONE_TIPSEL); + else ED_armature_ebone_selectflag_disable(ebone, BONE_TIPSEL); } return 1; } @@ -2652,8 +2644,7 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB if ((is_point_done == false) && (points_proj_tot == 2) && edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) { - if (data->select) ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + ED_armature_ebone_select_set(ebone, data->select); data->is_change = true; } |