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;
337 int flag_prev = pchan->bone->flag;
339 changed = (changed || flag_prev != pchan->bone->flag);
360 for (
Base *base : bases) {
361 Object *ob_iter = base->object;
371 const bool ignore_visibility)
378 bool changed_multi =
false;
379 for (
Base *base : bases) {
380 Object *ob_iter = base->object;
383 changed_multi =
true;
386 return changed_multi;
425 Bone *bone, *curBone, *
next =
nullptr;
430 Base *base =
nullptr;
438 for (curBone = bone; curBone; curBone =
next) {
482 ot->name =
"Select Connected";
483 ot->idname =
"POSE_OT_select_linked_pick";
484 ot->description =
"Select bones linked by parent/child connections under the mouse cursor";
499 "Extend selection instead of deselecting everything first");
515 for (curBone = pchan->bone; curBone; curBone =
next) {
547 ot->name =
"Select Connected";
548 ot->idname =
"POSE_OT_select_linked";
549 ot->description =
"Select all bones linked by parent/child connections to the current selection";
572 Object *ob_prev =
nullptr;
601 ot->name =
"(De)select All";
602 ot->idname =
"POSE_OT_select_all";
603 ot->description =
"Toggle selection status of all bones";
648 ot->name =
"Select Parent Bone";
649 ot->idname =
"POSE_OT_select_parent";
650 ot->description =
"Select bones that are parents of the currently selected bones";
669 ListBase targets = {
nullptr,
nullptr};
675 if ((ct->subtarget[0] !=
'\0') && (ob !=
nullptr) && (ob->
type ==
OB_ARMATURE) &&
706 ot->name =
"Select Constraint Target";
707 ot->idname =
"POSE_OT_select_constraint_target";
708 ot->description =
"Select bones used as targets for the currently selected bones";
729 bool changed =
false;
732 if (pchan_act ==
nullptr) {
753 Bone *bone_child =
nullptr;
757 for (pass = 0; pass < 2 && (bone_child ==
nullptr); pass++) {
761 if (pchan_iter->parent == pchan_act) {
763 bone_child = pchan_iter->bone;
783 if (changed ==
false) {
799 {0,
nullptr, 0,
nullptr,
nullptr},
803 ot->name =
"Select Hierarchy";
804 ot->idname =
"POSE_OT_select_hierarchy";
805 ot->description =
"Select immediate parent/children of selected bones";
838 bool changed_any_selection =
false;
853 updated_objects.
add(ob);
854 changed_any_selection =
true;
862 used_colors.
add(color);
866 Bone *bone = pchan->bone;
878 changed_any_selection =
true;
879 updated_objects.
add(ob);
883 if (!changed_any_selection) {
887 for (
Object *ob : updated_objects) {
895 bool changed_any_selection =
false;
908 updated_objects.
add(ob);
909 changed_any_selection =
true;
918 collection_names.
add(bcoll_ref->bcoll->name);
923 Bone *bone = pchan->bone;
929 if (!collection_names.
contains(bcoll_ref->bcoll->name)) {
934 changed_any_selection =
true;
935 updated_objects.
add(ob);
940 for (
Object *ob : updated_objects) {
944 return changed_any_selection;
954 selected_pose_bones.
add(pchan);
957 return selected_pose_bones;
965 if (potential_parents.
contains(bone_iter)) {
968 bone_iter = bone_iter->
parent;
992 bool changed_any_selection =
false;
994 for (
Object *pose_object : objects) {
1008 changed_any_selection =
true;
1012 if (selected_pose_bones.
contains(pchan->parent)) {
1014 changed_any_selection =
true;
1021 return changed_any_selection;
1029 bool changed_any_selection =
false;
1030 for (
Object *pose_object : objects) {
1038 if (!pchan->parent) {
1045 changed_any_selection =
true;
1049 return changed_any_selection;
1057 bool changed_any_selection =
false;
1058 for (
Object *pose_object : objects) {
1064 parents_of_selected.
add(pchan->parent);
1078 changed_any_selection =
true;
1083 return changed_any_selection;
1091 bool changed_multi =
false;
1095 if (ks ==
nullptr) {
1104 "Use another Keying Set, as the active one depends on the currently "
1105 "selected items or cannot find any targets due to unsuitable context");
1115 if (extend ==
false) {
1126 for (
const int ob_index : objects.
index_range()) {
1129 bPose *pose = (ob) ? ob->
pose :
nullptr;
1130 bool changed =
false;
1133 if (
ELEM(
nullptr, ob, pose, arm)) {
1142 if ((ksp->id == &ob->
id) && (ksp->rna_path !=
nullptr)) {
1144 char boneName[
sizeof(pchan->
name)];
1160 if (changed || !extend) {
1162 changed_multi =
true;
1166 return changed_multi;
1174 bool changed =
false;
1177 if (ob->
pose ==
nullptr) {
1212 printf(
"pose_select_grouped() - Unknown selection type %d\n",
int(mode));
1232 "Same collections as the active bone"},
1238 "All bones affected by active Keying Set"},
1243 "Select all children of currently selected bones"},
1245 "CHILDREN_IMMEDIATE",
1247 "Immediate Children",
1248 "Select direct children of currently selected bones"},
1253 "Select the parents of currently selected bones"},
1258 "Select all bones that have the same parent as currently selected bones"},
1259 {0,
nullptr, 0,
nullptr,
nullptr},
1263 ot->name =
"Select Grouped";
1264 ot->description =
"Select all visible bones grouped by similar properties";
1265 ot->idname =
"POSE_OT_select_grouped";
1280 "Extend selection instead of deselecting everything first");
1281 ot->prop =
RNA_def_enum(
ot->srna,
"type", prop_select_grouped_types, 0,
"Type",
"");
1316 for (
Object *ob : objects) {
1336 if (!pchan_mirror) {
1343 if (pchan->bone == arm->
act_bone) {
1344 pchan_mirror_act = pchan_mirror;
1348 if (active_only && !
ELEM(arm->
act_bone, pchan->bone, pchan_mirror->
bone)) {
1353 set_bone_selection_flags(pchan, flags_mirror);
1356 if (pchan_mirror_act) {
1360 if (is_weight_paint) {
1380 ot->name =
"Select Mirror";
1381 ot->idname =
"POSE_OT_select_mirror";
1382 ot->description =
"Mirror the bone selection";
1393 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 *)