Fix T44591: Set PBone Group operator did not handled predifined group index in its invoke func.

This commit is contained in:
Bastien Montagne 2015-05-03 16:51:16 +02:00
parent dced56f02a
commit d33b564f91
Notes: blender-bot 2023-05-31 04:43:10 +02:00
Referenced by issue #44609, Vertex Slide - Correct UV Bug?
Referenced by issue #44591, ShortCut for Bone Group Index doesnt work
1 changed files with 12 additions and 0 deletions

View File

@ -130,6 +130,7 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U
{
Object *ob = ED_pose_object_from_context(C);
bPose *pose;
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "type");
uiPopupMenu *pup;
uiLayout *layout;
@ -140,6 +141,17 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
pose = ob->pose;
/* If group index is set, try to use it! */
if (RNA_property_is_set(op->ptr, prop)) {
const int num_groups = BLI_listbase_count(&pose->agroups);
const int group = RNA_property_int_get(op->ptr, prop);
/* just use the active group index, and call the exec callback for the calling operator */
if (group > 0 && group <= num_groups) {
return op->type->exec(C, op);
}
}
/* if there's no active group (or active is invalid), create a new menu to find it */
if (pose->active_group <= 0) {