Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/pose_group.c
| Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "armature_intern.h" | #include "armature_intern.h" | ||||
| /* ********************************************** */ | /* ********************************************** */ | ||||
| /* Bone Groups */ | /* Bone Groups */ | ||||
| static bool pose_group_poll(bContext *C) | |||||
| { | |||||
| if (!ED_operator_posemode_context(C)) { | |||||
| return false; | |||||
| } | |||||
| Object *obpose = ED_pose_object_from_context(C); | |||||
| if ((obpose->proxy != NULL) || (obpose->proxy_group != NULL) || ID_IS_OVERRIDE_LIBRARY(obpose)) { | |||||
mont29: space ;) | |||||
| CTX_wm_operator_poll_msg_set(C, "Cannot edit bonegroups for proxies or library overrides"); | |||||
Done Inline Actionsproxies or library overrides mont29: proxies or library overrides | |||||
Not Done Inline ActionsAlso, "bonegroups" should be two words, right? HooglyBoogly: Also, "bonegroups" should be two words, right? | |||||
Not Done Inline Actionswhoops, read that too late... yep, this should probably be two words, will change in a bit lichtwerk: whoops, read that too late... yep, this should probably be two words, will change in a bit | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| static int pose_group_add_exec(bContext *C, wmOperator *UNUSED(op)) | static int pose_group_add_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = ED_pose_object_from_context(C); | Object *ob = ED_pose_object_from_context(C); | ||||
| /* only continue if there's an object and pose */ | /* only continue if there's an object and pose */ | ||||
| if (ELEM(NULL, ob, ob->pose)) { | if (ELEM(NULL, ob, ob->pose)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| Show All 11 Lines | |||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Add Bone Group"; | ot->name = "Add Bone Group"; | ||||
| ot->idname = "POSE_OT_group_add"; | ot->idname = "POSE_OT_group_add"; | ||||
| ot->description = "Add a new bone group"; | ot->description = "Add a new bone group"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = pose_group_add_exec; | ot->exec = pose_group_add_exec; | ||||
| ot->poll = ED_operator_posemode_context; | ot->poll = pose_group_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| static int pose_group_remove_exec(bContext *C, wmOperator *UNUSED(op)) | static int pose_group_remove_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = ED_pose_object_from_context(C); | Object *ob = ED_pose_object_from_context(C); | ||||
| Show All 17 Lines | |||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Remove Bone Group"; | ot->name = "Remove Bone Group"; | ||||
| ot->idname = "POSE_OT_group_remove"; | ot->idname = "POSE_OT_group_remove"; | ||||
| ot->description = "Remove the active bone group"; | ot->description = "Remove the active bone group"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = pose_group_remove_exec; | ot->exec = pose_group_remove_exec; | ||||
| ot->poll = ED_operator_posemode_context; | ot->poll = pose_group_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| /* ------------ */ | /* ------------ */ | ||||
| /* invoke callback which presents a list of bone-groups for the user to choose from */ | /* invoke callback which presents a list of bone-groups for the user to choose from */ | ||||
| ▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | void POSE_OT_group_assign(wmOperatorType *ot) | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Add Selected to Bone Group"; | ot->name = "Add Selected to Bone Group"; | ||||
| ot->idname = "POSE_OT_group_assign"; | ot->idname = "POSE_OT_group_assign"; | ||||
| ot->description = "Add selected bones to the chosen bone group"; | ot->description = "Add selected bones to the chosen bone group"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->invoke = pose_groups_menu_invoke; | ot->invoke = pose_groups_menu_invoke; | ||||
| ot->exec = pose_group_assign_exec; | ot->exec = pose_group_assign_exec; | ||||
| ot->poll = ED_operator_posemode_context; | ot->poll = pose_group_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| /* properties */ | /* properties */ | ||||
| RNA_def_int(ot->srna, "type", 0, 0, INT_MAX, "Bone Group Index", "", 0, 10); | RNA_def_int(ot->srna, "type", 0, 0, INT_MAX, "Bone Group Index", "", 0, 10); | ||||
| } | } | ||||
| Show All 31 Lines | |||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Remove Selected from Bone Groups"; | ot->name = "Remove Selected from Bone Groups"; | ||||
| ot->idname = "POSE_OT_group_unassign"; | ot->idname = "POSE_OT_group_unassign"; | ||||
| ot->description = "Remove selected bones from all bone groups"; | ot->description = "Remove selected bones from all bone groups"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = pose_group_unassign_exec; | ot->exec = pose_group_unassign_exec; | ||||
| ot->poll = ED_operator_posemode_context; | ot->poll = pose_group_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| static int group_move_exec(bContext *C, wmOperator *op) | static int group_move_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *ob = ED_pose_object_from_context(C); | Object *ob = ED_pose_object_from_context(C); | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | void POSE_OT_group_move(wmOperatorType *ot) | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Move Bone Group"; | ot->name = "Move Bone Group"; | ||||
| ot->idname = "POSE_OT_group_move"; | ot->idname = "POSE_OT_group_move"; | ||||
| ot->description = "Change position of active Bone Group in list of Bone Groups"; | ot->description = "Change position of active Bone Group in list of Bone Groups"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = group_move_exec; | ot->exec = group_move_exec; | ||||
| ot->poll = ED_operator_posemode_context; | ot->poll = pose_group_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| RNA_def_enum(ot->srna, | RNA_def_enum(ot->srna, | ||||
| "direction", | "direction", | ||||
| group_slot_move, | group_slot_move, | ||||
| 0, | 0, | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Sort Bone Groups"; | ot->name = "Sort Bone Groups"; | ||||
| ot->idname = "POSE_OT_group_sort"; | ot->idname = "POSE_OT_group_sort"; | ||||
| ot->description = "Sort Bone Groups by their names in ascending order"; | ot->description = "Sort Bone Groups by their names in ascending order"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = group_sort_exec; | ot->exec = group_sort_exec; | ||||
| ot->poll = ED_operator_posemode_context; | ot->poll = pose_group_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| static void pose_group_select(Object *ob, bool select) | static void pose_group_select(Object *ob, bool select) | ||||
| { | { | ||||
| bPose *pose = ob->pose; | bPose *pose = ob->pose; | ||||
| ▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines | |||||
space ;)