Fix T74006: Alt+ clicking (assign to all selected) doesn not work for

bone constraints settings

'UI_context_copy_to_selected_list()' was working fine for constraints on
objects (would properly get the path and list of selected objects) and
also for bone settings (would properly get the path and list of bones).

There was no special case for constraints on bones though, so code would
work on selected objects (not selected bones).

So we now get the right bones and resolve the path to the constraint
setting _from the bones_.

Maniphest Tasks: T74006

Differential Revision: https://developer.blender.org/D6897
This commit is contained in:
Philipp Oeser 2020-02-20 12:36:59 +01:00
parent 0c506a6ef0
commit f2224ccfce
Notes: blender-bot 2023-02-14 09:38:57 +01:00
Referenced by issue #74006, Alt+ clicking (assign to all selected) doesn not work for bone constraints settings
1 changed files with 7 additions and 0 deletions

View File

@ -735,6 +735,8 @@ bool UI_context_copy_to_selected_list(bContext *C,
{
*r_use_path_from_id = false;
*r_path = NULL;
/* special case for bone constraints */
char *path_from_bone = NULL;
/* PropertyGroup objects don't have a reference to the struct that actually owns
* them, so it is normally necessary to do a brute force search to find it. This
@ -797,6 +799,11 @@ bool UI_context_copy_to_selected_list(bContext *C,
else if (RNA_struct_is_a(ptr->type, &RNA_FCurve)) {
*r_lb = CTX_data_collection_get(C, "selected_editable_fcurves");
}
else if (RNA_struct_is_a(ptr->type, &RNA_Constraint) &&
(path_from_bone = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_PoseBone)) != NULL) {
*r_lb = CTX_data_collection_get(C, "selected_pose_bones");
*r_path = path_from_bone;
}
else if (RNA_struct_is_a(ptr->type, &RNA_Node) || RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) {
ListBase lb = {NULL, NULL};
char *path = NULL;