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->flag;
339 changed = (changed || flag_prev != pchan->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;
407 BLI_assert_unreachable();
436 Base *base =
nullptr;
444 for (curBone = pchan; 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; curBone; curBone =
next) {
549 ot->name =
"Select Connected";
550 ot->idname =
"POSE_OT_select_linked";
551 ot->description =
"Select all bones linked by parent/child connections to the current selection";
574 Object *ob_prev =
nullptr;
603 ot->name =
"(De)select All";
604 ot->idname =
"POSE_OT_select_all";
605 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) {
761 for (pass = 0; pass < 2 && (bone_child ==
nullptr); pass++) {
765 if (pchan_iter->parent == pchan_act) {
767 bone_child = pchan_iter;
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);
1080 if (parents_of_selected.
contains(pchan->parent) &&
1084 changed_any_selection =
true;
1089 return changed_any_selection;
1097 bool changed_multi =
false;
1101 if (ks ==
nullptr) {
1110 "Use another Keying Set, as the active one depends on the currently "
1111 "selected items or cannot find any targets due to unsuitable context");
1121 if (extend ==
false) {
1132 for (
const int ob_index : objects.
index_range()) {
1135 bPose *pose = (ob) ? ob->
pose :
nullptr;
1136 bool changed =
false;
1139 if (
ELEM(
nullptr, ob, pose, arm)) {
1148 if ((ksp->id == &ob->
id) && (ksp->rna_path !=
nullptr)) {
1150 char boneName[
sizeof(pchan->
name)];
1166 if (changed || !extend) {
1168 changed_multi =
true;
1172 return changed_multi;
1180 bool changed =
false;
1183 if (ob->
pose ==
nullptr) {
1218 printf(
"pose_select_grouped() - Unknown selection type %d\n",
int(mode));
1238 "Same collections as the active bone"},
1244 "All bones affected by active Keying Set"},
1249 "Select all children of currently selected bones"},
1251 "CHILDREN_IMMEDIATE",
1253 "Immediate Children",
1254 "Select direct children of currently selected bones"},
1259 "Select the parents of currently selected bones"},
1264 "Select all bones that have the same parent as currently selected bones"},
1265 {0,
nullptr, 0,
nullptr,
nullptr},
1269 ot->name =
"Select Grouped";
1270 ot->description =
"Select all visible bones grouped by similar properties";
1271 ot->idname =
"POSE_OT_select_grouped";
1286 "Extend selection instead of deselecting everything first");
1287 ot->prop =
RNA_def_enum(
ot->srna,
"type", prop_select_grouped_types, 0,
"Type",
"");
1295 pchan->
flag |= new_selection_flags;
1301 pchan->
flag = new_selection_flags;
1321 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
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)
bPoseChannel * ED_armature_pick_pchan_from_selectbuffer(blender::Span< Base * > bases, const GPUSelectResult *hit_results, int hits, bool findunsel, bool do_nearest, Base **r_base)
bPoseChannel * ED_armature_pick_pchan(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(const bArmature *armature, const Bone *bone)
bool bone_is_selectable(const bArmature *armature, const bPoseChannel *pchan)
bool bone_is_selected(const bArmature *armature, const Bone *bone)
bool pose_bone_descendent_depth_iterator(bPose &pose, bPoseChannel &pose_bone, FunctionRef< bool(bPoseChannel &child_bone)> callback)
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 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 void selectconnected_posebonechildren(Object &ob, bPoseChannel &pose_bone, const bool extend)
static void bone_selection_flags_set(bPoseChannel *pchan, const ePchan_Flag new_selection_flags)
static void bone_selection_flags_add(bPoseChannel *pchan, const ePchan_Flag new_selection_flags)
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, bPoseChannel *pchan, 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)
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 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 *)