Anim: armature edit mode 'select by bone collection' operator
In the armature edit mode 'select similar' operator, replace 'select by layer' with 'select by bone collection.
This commit is contained in:
parent
c230c52626
commit
d5329eeea2
@ -1596,7 +1596,7 @@ enum {
|
||||
SIMEDBONE_DIRECTION,
|
||||
SIMEDBONE_PREFIX,
|
||||
SIMEDBONE_SUFFIX,
|
||||
SIMEDBONE_LAYER,
|
||||
SIMEDBONE_COLLECTION,
|
||||
SIMEDBONE_GROUP,
|
||||
SIMEDBONE_SHAPE,
|
||||
};
|
||||
@ -1609,7 +1609,7 @@ static const EnumPropertyItem prop_similar_types[] = {
|
||||
{SIMEDBONE_DIRECTION, "DIRECTION", 0, "Direction (Y Axis)", ""},
|
||||
{SIMEDBONE_PREFIX, "PREFIX", 0, "Prefix", ""},
|
||||
{SIMEDBONE_SUFFIX, "SUFFIX", 0, "Suffix", ""},
|
||||
{SIMEDBONE_LAYER, "LAYER", 0, "Layer", ""},
|
||||
{SIMEDBONE_COLLECTION, "BONE_COLLECTION", 0, "Bone Collection", ""},
|
||||
{SIMEDBONE_GROUP, "GROUP", 0, "Group", ""},
|
||||
{SIMEDBONE_SHAPE, "SHAPE", 0, "Shape", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
@ -1713,12 +1713,18 @@ static void select_similar_direction(bContext *C, const float thresh)
|
||||
MEM_freeN(objects);
|
||||
}
|
||||
|
||||
static void select_similar_layer(bContext *C)
|
||||
static void select_similar_bone_collection(bContext *C)
|
||||
{
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
EditBone *ebone_act = CTX_data_active_bone(C);
|
||||
|
||||
/* Build a set of bone collection names, to allow cross-Armature selection. */
|
||||
blender::Set<std::string> collection_names;
|
||||
LISTBASE_FOREACH (BoneCollectionReference *, bcoll_ref, &ebone_act->bone_collections) {
|
||||
collection_names.add(bcoll_ref->bcoll->name);
|
||||
}
|
||||
|
||||
uint objects_len = 0;
|
||||
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
|
||||
scene, view_layer, CTX_wm_view3d(C), &objects_len);
|
||||
@ -1728,11 +1734,18 @@ static void select_similar_layer(bContext *C)
|
||||
bool changed = false;
|
||||
|
||||
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
|
||||
if (EBONE_SELECTABLE(arm, ebone)) {
|
||||
if (ebone->layer & ebone_act->layer) {
|
||||
ED_armature_ebone_select_set(ebone, true);
|
||||
changed = true;
|
||||
if (!EBONE_SELECTABLE(arm, ebone)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (BoneCollectionReference *, bcoll_ref, &ebone->bone_collections) {
|
||||
if (!collection_names.contains(bcoll_ref->bcoll->name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ED_armature_ebone_select_set(ebone, true);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1970,8 +1983,8 @@ static int armature_select_similar_exec(bContext *C, wmOperator *op)
|
||||
case SIMEDBONE_SUFFIX:
|
||||
select_similar_suffix(C);
|
||||
break;
|
||||
case SIMEDBONE_LAYER:
|
||||
select_similar_layer(C);
|
||||
case SIMEDBONE_COLLECTION:
|
||||
select_similar_bone_collection(C);
|
||||
break;
|
||||
case SIMEDBONE_GROUP:
|
||||
select_similar_data_pchan(C, STRUCT_SIZE_AND_OFFSET(bPoseChannel, agrp_index));
|
||||
|
Loading…
x
Reference in New Issue
Block a user