64 switch (select_mode) {
140 bool changed =
false;
152 else if (found ||
params.deselect_all) {
157 Object *ob_iter = base_iter->object;
254 return changed || found;
269 if (!ob || !ob->
pose) {
274 Base *base_dummy =
nullptr;
276 {base}, hit_results, hits,
true, do_nearest, &base_dummy);
292 for (; md; md = md->
next) {
296 if (ob_arm !=
nullptr) {
298 if ((base_arm !=
nullptr) && (base_arm != base_select) && (base_arm->
flag &
BASE_SELECTED))
315 if (ob->
pose ==
nullptr) {
333 bool changed =
false;
341 int flag_prev = pchan->bone->flag;
343 changed = (changed || flag_prev != pchan->bone->flag);
364 for (
Base *base : bases) {
365 Object *ob_iter = base->object;
375 const bool ignore_visibility)
382 bool changed_multi =
false;
383 for (
Base *base : bases) {
384 Object *ob_iter = base->object;
387 changed_multi =
true;
390 return changed_multi;
429 Bone *bone, *curBone, *
next =
nullptr;
434 Base *base =
nullptr;
442 for (curBone = bone; curBone; curBone =
next) {
486 ot->name =
"Select Connected";
487 ot->idname =
"POSE_OT_select_linked_pick";
488 ot->description =
"Select bones linked by parent/child connections under the mouse cursor";
503 "Extend selection instead of deselecting everything first");
519 for (curBone = pchan->bone; curBone; curBone =
next) {
551 ot->name =
"Select Connected";
552 ot->idname =
"POSE_OT_select_linked";
553 ot->description =
"Select all bones linked by parent/child connections to the current selection";
576 Object *ob_prev =
nullptr;
605 ot->name =
"(De)select All";
606 ot->idname =
"POSE_OT_select_all";
607 ot->description =
"Toggle selection status of all bones";
652 ot->name =
"Select Parent Bone";
653 ot->idname =
"POSE_OT_select_parent";
654 ot->description =
"Select bones that are parents of the currently selected bones";
673 ListBase targets = {
nullptr,
nullptr};
679 if ((ct->subtarget[0] !=
'\0') && (ob !=
nullptr) && (ob->
type ==
OB_ARMATURE) &&
710 ot->name =
"Select Constraint Target";
711 ot->idname =
"POSE_OT_select_constraint_target";
712 ot->description =
"Select bones used as targets for the currently selected bones";
733 bool changed =
false;
736 if (pchan_act ==
nullptr) {
757 Bone *bone_child =
nullptr;
761 for (pass = 0; pass < 2 && (bone_child ==
nullptr); pass++) {
765 if (pchan_iter->parent == pchan_act) {
767 bone_child = pchan_iter->bone;
787 if (changed ==
false) {
803 {0,
nullptr, 0,
nullptr,
nullptr},
807 ot->name =
"Select Hierarchy";
808 ot->idname =
"POSE_OT_select_hierarchy";
809 ot->description =
"Select immediate parent/children of selected bones";
842 bool changed_any_selection =
false;
857 updated_objects.
add(ob);
858 changed_any_selection =
true;
866 used_colors.
add(color);
870 Bone *bone = pchan->bone;
882 changed_any_selection =
true;
883 updated_objects.
add(ob);
887 if (!changed_any_selection) {
891 for (
Object *ob : updated_objects) {
899 bool changed_any_selection =
false;
912 updated_objects.
add(ob);
913 changed_any_selection =
true;
922 collection_names.
add(bcoll_ref->bcoll->name);
927 Bone *bone = pchan->bone;
933 if (!collection_names.
contains(bcoll_ref->bcoll->name)) {
938 changed_any_selection =
true;
939 updated_objects.
add(ob);
944 for (
Object *ob : updated_objects) {
948 return changed_any_selection;
958 selected_pose_bones.
add(pchan);
961 return selected_pose_bones;
969 if (potential_parents.
contains(bone_iter)) {
972 bone_iter = bone_iter->
parent;
996 bool changed_any_selection =
false;
998 for (
Object *pose_object : objects) {
1012 changed_any_selection =
true;
1016 if (selected_pose_bones.
contains(pchan->parent)) {
1018 changed_any_selection =
true;
1025 return changed_any_selection;
1033 bool changed_any_selection =
false;
1034 for (
Object *pose_object : objects) {
1042 if (!pchan->parent) {
1049 changed_any_selection =
true;
1053 return changed_any_selection;
1061 bool changed_any_selection =
false;
1062 for (
Object *pose_object : objects) {
1068 parents_of_selected.
add(pchan->parent);
1082 changed_any_selection =
true;
1087 return changed_any_selection;
1095 bool changed_multi =
false;
1099 if (ks ==
nullptr) {
1108 "Use another Keying Set, as the active one depends on the currently "
1109 "selected items or cannot find any targets due to unsuitable context");
1119 if (extend ==
false) {
1130 for (
const int ob_index : objects.
index_range()) {
1133 bPose *pose = (ob) ? ob->
pose :
nullptr;
1134 bool changed =
false;
1137 if (
ELEM(
nullptr, ob, pose, arm)) {
1146 if ((ksp->id == &ob->
id) && (ksp->rna_path !=
nullptr)) {
1148 char boneName[
sizeof(pchan->
name)];
1164 if (changed || !extend) {
1166 changed_multi =
true;
1170 return changed_multi;
1178 bool changed =
false;
1181 if (ob->
pose ==
nullptr) {
1216 printf(
"pose_select_grouped() - Unknown selection type %d\n",
int(mode));
1236 "Same collections as the active bone"},
1242 "All bones affected by active Keying Set"},
1247 "Select all children of currently selected bones"},
1249 "CHILDREN_IMMEDIATE",
1251 "Immediate Children",
1252 "Select direct children of currently selected bones"},
1257 "Select the parents of currently selected bones"},
1262 "Select all bones that have the same parent as currently selected bones"},
1263 {0,
nullptr, 0,
nullptr,
nullptr},
1267 ot->name =
"Select Grouped";
1268 ot->description =
"Select all visible bones grouped by similar properties";
1269 ot->idname =
"POSE_OT_select_grouped";
1284 "Extend selection instead of deselecting everything first");
1285 ot->prop =
RNA_def_enum(
ot->srna,
"type", prop_select_grouped_types, 0,
"Type",
"");
1320 for (
Object *ob : objects) {
1340 if (!pchan_mirror) {
1347 if (pchan->bone == arm->
act_bone) {
1348 pchan_mirror_act = pchan_mirror;
1352 if (active_only && !
ELEM(arm->
act_bone, pchan->bone, pchan_mirror->
bone)) {
1357 set_bone_selection_flags(pchan, flags_mirror);
1360 if (pchan_mirror_act) {
1364 if (is_weight_paint) {
1384 ot->name =
"Select Mirror";
1385 ot->idname =
"POSE_OT_select_mirror";
1386 ot->description =
"Mirror the bone selection";
1397 ot->srna,
"only_active",
false,
"Active Only",
"Only operate on the active bone");
Functions to deal with Armatures.
C++ part of the BoneColor DNA struct.
Functionality to interact with keying sets.
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
bPoseChannel * BKE_pose_channel_get_mirrored(const bPose *pose, const char *name) ATTR_WARN_UNUSED_RESULT
bPoseChannel * BKE_pose_channel_active_if_bonecoll_visible(Object *ob) ATTR_WARN_UNUSED_RESULT
#define PBONE_SELECTED(arm, bone)
#define PBONE_SELECTABLE(arm, bone)
void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy)
int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets)
#define CTX_DATA_BEGIN_WITH_ID(C, Type, instance, member, Type_id, instance_id)
bPoseChannel * CTX_data_active_pose_bone(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
#define CTX_DATA_COUNT(C, member)
Scene * CTX_data_scene(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
#define FOREACH_VISIBLE_BASE_END
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
#define FOREACH_VISIBLE_BASE_BEGIN(_scene, _view_layer, _v3d, _instance)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
Object * BKE_view_layer_edit_object_get(const ViewLayer *view_layer)
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
General operations, lookup, etc. for blender objects.
blender::Vector< Base * > BKE_object_pose_base_array_get_unique(const Scene *scene, ViewLayer *view_layer, View3D *v3d)
Object * BKE_object_pose_armature_get(Object *ob)
blender::Vector< Object * > BKE_object_pose_array_get_unique(const Scene *scene, ViewLayer *view_layer, View3D *v3d)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
bool bool BLI_str_quoted_substr(const char *__restrict str, const char *__restrict prefix, char *result, size_t result_maxncpy)
void DEG_id_tag_update(ID *id, unsigned int flags)
#define OB_MODE_ALL_WEIGHT_PAINT
Object is a sort of wrapper for general info.
#define BASE_SELECTED(v3d, base)
#define BONE_SELECT_CHILD
#define BONE_SELECT_PARENT
void ED_outliner_select_sync_from_pose_bone_tag(bContext *C)
bool ED_operator_view3d_active(bContext *C)
bool ED_operator_posemode(bContext *C)
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
void view3d_operator_needs_gpu(const bContext *C)
Bone * ED_armature_pick_bone_from_selectbuffer(blender::Span< Base * > bases, const GPUSelectResult *hit_results, int hits, bool findunsel, bool do_nearest, Base **r_base)
Bone * ED_armature_pick_bone(bContext *C, const int xy[2], bool findunsel, Base **r_base)
BPy_StructRNA * depsgraph
const Value & lookup(const Key &key) const
void add_new(const Key &key, const Value &value)
bool contains(const Key &key) const
IndexRange index_range() const
bool all(VecOp< bool, D >) RET
KeyingSet * scene_get_active_keyingset(const Scene *scene)
const BoneColor & ANIM_bonecolor_posebone_get(const bPoseChannel *pose_bone)
bool bone_is_visible_pchan(const bArmature *armature, const bPoseChannel *pchan)
ModifyKeyReturn validate_keyingset(bContext *C, blender::Vector< PointerRNA > *sources, KeyingSet *keyingset)
void base_select(Base *base, eObjectSelect_Mode mode)
void vgroup_select_by_name(Object *ob, const char *name)
static void bone_selection_flags_add(bPoseChannel *pchan, const eBone_Flag new_selection_flags)
static wmOperatorStatus pose_select_linked_exec(bContext *C, wmOperator *)
static bool pose_select_same_collection(bContext *C, const bool extend)
static bool pose_select_siblings(bContext *C, const bool extend)
void POSE_OT_select_parent(wmOperatorType *ot)
static bool pose_select_children(bContext *C, const bool all, const bool extend)
static bool pose_select_parents(bContext *C, const bool extend)
static wmOperatorStatus pose_select_grouped_exec(bContext *C, wmOperator *op)
static blender::Set< bPoseChannel * > get_selected_pose_bones(Object *pose_object)
void ED_armature_pose_select_in_wpaint_mode(const Scene *scene, ViewLayer *view_layer, Base *base_select)
static wmOperatorStatus pose_select_constraint_target_exec(bContext *C, wmOperator *)
bool ED_armature_pose_select_pick_bone(const Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *ob, Bone *bone, const SelectPick_Params ¶ms)
static void deselect_pose_bones(const blender::Set< bPoseChannel * > &pose_bones)
static bool ed_pose_is_any_selected_multi(const Span< Base * > bases, bool ignore_visibility)
void POSE_OT_select_hierarchy(wmOperatorType *ot)
void POSE_OT_select_grouped(wmOperatorType *ot)
void POSE_OT_select_linked_pick(wmOperatorType *ot)
static void pose_do_bone_select(bPoseChannel *pchan, const int select_mode)
static wmOperatorStatus pose_select_parent_exec(bContext *C, wmOperator *)
void ED_pose_bone_select_tag_update(Object *ob)
bool ED_pose_deselect_all(Object *ob, int select_mode, const bool ignore_visibility)
void POSE_OT_select_mirror(wmOperatorType *ot)
bool ED_pose_deselect_all_multi_ex(const Span< Base * > bases, int select_mode, const bool ignore_visibility)
static bool ed_pose_is_any_selected(Object *ob, bool ignore_visibility)
bool ED_pose_deselect_all_multi(bContext *C, int select_mode, const bool ignore_visibility)
void POSE_OT_select_all(wmOperatorType *ot)
void POSE_OT_select_constraint_target(wmOperatorType *ot)
static bool pose_select_linked_pick_poll(bContext *C)
static void bone_selection_flags_set(bPoseChannel *pchan, const eBone_Flag new_selection_flags)
bool ED_armature_pose_select_pick_with_buffer(const Scene *scene, ViewLayer *view_layer, View3D *v3d, Base *base, const GPUSelectResult *hit_results, const int hits, const SelectPick_Params ¶ms, bool do_nearest)
static bool pose_select_same_keyingset(bContext *C, ReportList *reports, bool extend)
static wmOperatorStatus pose_select_hierarchy_exec(bContext *C, wmOperator *op)
void ED_pose_bone_select(Object *ob, bPoseChannel *pchan, bool select, bool change_active)
static wmOperatorStatus pose_select_mirror_exec(bContext *C, wmOperator *op)
static bool pose_bone_is_below_one_of(bPoseChannel &bone, const blender::Set< bPoseChannel * > &potential_parents)
static wmOperatorStatus pose_de_select_all_exec(bContext *C, wmOperator *op)
void POSE_OT_select_linked(wmOperatorType *ot)
static bool pose_select_same_color(bContext *C, const bool extend)
static void selectconnected_posebonechildren(Object *ob, Bone *bone, int extend)
static wmOperatorStatus pose_select_connected_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct ModifierData * next
struct ToolSettings * toolsettings
struct bPoseChannel * parent
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_operator_properties_select_all(wmOperatorType *ot)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)