diff options
Diffstat (limited to 'source/blender/editors/armature/armature_select.c')
-rw-r--r-- | source/blender/editors/armature/armature_select.c | 84 |
1 files changed, 56 insertions, 28 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index 0c493672d9e..95c10b79678 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -167,10 +167,12 @@ void *get_bone_from_selectbuffer(Base **bases, if (is_editmode == false) { base = ED_armature_base_and_bone_from_select_buffer(bases, bases_len, hitresult, &bone); if (bone != NULL) { - if (findunsel) + if (findunsel) { sel = (bone->flag & BONE_SELECTED); - else + } + else { sel = !(bone->flag & BONE_SELECTED); + } data = bone; } @@ -182,10 +184,12 @@ void *get_bone_from_selectbuffer(Base **bases, else { base = ED_armature_base_and_ebone_from_select_buffer( bases, bases_len, hitresult, &ebone); - if (findunsel) + if (findunsel) { sel = (ebone->flag & BONE_SELECTED); - else + } + else { sel = !(ebone->flag & BONE_SELECTED); + } data = ebone; } @@ -300,8 +304,9 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv Base *base = NULL; bone = get_nearest_bone(C, event->mval, true, &base); - if (!bone) + if (!bone) { return OPERATOR_CANCELLED; + } arm = base->object->data; @@ -316,10 +321,12 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv } } - if (curBone->flag & BONE_CONNECTED) + if (curBone->flag & BONE_CONNECTED) { next = curBone->parent; - else + } + else { next = NULL; + } } /* Select children */ @@ -343,8 +350,9 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv } } } - if (!curBone) + if (!curBone) { bone = NULL; + } } ED_armature_edit_sync_selection(arm->edbo); @@ -515,12 +523,15 @@ cache_end: if (hitresult & (BONESEL_ROOT | BONESEL_TIP)) { /* but also the unselected one */ if (findunsel) { - if ((hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL) == 0) + if ((hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL) == 0) { dep = 1; - else if ((hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL) == 0) + } + else if ((hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL) == 0) { dep = 1; - else + } + else { dep = 2; + } } else { dep = 1; @@ -529,10 +540,12 @@ cache_end: else { /* bone found */ if (findunsel) { - if ((ebone->flag & BONE_SELECTED) == 0) + if ((ebone->flag & BONE_SELECTED) == 0) { dep = 3; - else + } + else { dep = 4; + } } else { dep = 3; @@ -698,8 +711,9 @@ bool ED_armature_edit_select_pick( /* deselect this bone */ nearBone->flag &= ~(BONE_TIPSEL | BONE_SELECTED); /* only deselect parent tip if it is not selected */ - if (!(nearBone->parent->flag & BONE_SELECTED)) + if (!(nearBone->parent->flag & BONE_SELECTED)) { nearBone->parent->flag &= ~BONE_TIPSEL; + } } else if (toggle) { /* hold shift inverts this bone's selection */ @@ -707,8 +721,9 @@ bool ED_armature_edit_select_pick( /* deselect this bone */ nearBone->flag &= ~(BONE_TIPSEL | BONE_SELECTED); /* only deselect parent tip if it is not selected */ - if (!(nearBone->parent->flag & BONE_SELECTED)) + if (!(nearBone->parent->flag & BONE_SELECTED)) { nearBone->parent->flag &= ~BONE_TIPSEL; + } } else { /* select this bone */ @@ -731,24 +746,31 @@ bool ED_armature_edit_select_pick( } else if (toggle) { /* hold shift inverts this bone's selection */ - if (nearBone->flag & BONE_SELECTED) + if (nearBone->flag & BONE_SELECTED) { nearBone->flag &= ~(BONE_TIPSEL | BONE_ROOTSEL); - else + } + else { nearBone->flag |= (BONE_TIPSEL | BONE_ROOTSEL); + } } - else + else { nearBone->flag |= (BONE_TIPSEL | BONE_ROOTSEL); + } } } else { - if (extend) + if (extend) { nearBone->flag |= selmask; - else if (deselect) + } + else if (deselect) { nearBone->flag &= ~selmask; - else if (toggle && (nearBone->flag & selmask)) + } + else if (toggle && (nearBone->flag & selmask)) { nearBone->flag &= ~selmask; - else + } + else { nearBone->flag |= selmask; + } } ED_armature_edit_sync_selection(arm->edbo); @@ -1373,8 +1395,9 @@ static void select_similar_suffix(bContext *C) BLI_string_split_suffix(ebone_act->name, body_tmp, suffix_act, sizeof(ebone_act->name)); - if (suffix_act[0] == '\0') + if (suffix_act[0] == '\0') { return; + } uint objects_len = 0; Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data( @@ -1429,11 +1452,13 @@ static void select_similar_data_pchan(bContext *C, const size_t bytes_size, cons static void is_ancestor(EditBone *bone, EditBone *ancestor) { - if (bone->temp.ebone == ancestor || bone->temp.ebone == NULL) + if (bone->temp.ebone == ancestor || bone->temp.ebone == NULL) { return; + } - if (bone->temp.ebone->temp.ebone != NULL && bone->temp.ebone->temp.ebone != ancestor) + if (bone->temp.ebone->temp.ebone != NULL && bone->temp.ebone->temp.ebone != ancestor) { is_ancestor(bone->temp.ebone, ancestor); + } bone->temp.ebone = bone->temp.ebone->temp.ebone; } @@ -1451,8 +1476,9 @@ static void select_similar_children(bContext *C) for (EditBone *ebone_iter = arm->edbo->first; ebone_iter; ebone_iter = ebone_iter->next) { is_ancestor(ebone_iter, ebone_act); - if (ebone_iter->temp.ebone == ebone_act && EBONE_SELECTABLE(arm, ebone_iter)) + if (ebone_iter->temp.ebone == ebone_act && EBONE_SELECTABLE(arm, ebone_iter)) { ED_armature_ebone_select_set(ebone_iter, true); + } } WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); @@ -1757,8 +1783,9 @@ static bool armature_shortest_path_select( { do { - if (!use_parent && (ebone_child == ebone_parent)) + if (!use_parent && (ebone_child == ebone_parent)) { break; + } if (is_test) { if (!EBONE_SELECTABLE(arm, ebone_child)) { @@ -1769,8 +1796,9 @@ static bool armature_shortest_path_select( ED_armature_ebone_selectflag_set(ebone_child, (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)); } - if (ebone_child == ebone_parent) + if (ebone_child == ebone_parent) { break; + } ebone_child = ebone_child->parent; } while (true); |