Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/pose_lib.c
| Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | static int poselib_add_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| uiPopupMenu *pup; | uiPopupMenu *pup; | ||||
| uiLayout *layout; | uiLayout *layout; | ||||
| /* sanity check */ | /* sanity check */ | ||||
| if (ELEM(NULL, ob, pose)) | if (ELEM(NULL, ob, pose)) | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| /* start building */ | /* start building */ | ||||
| pup = uiPupMenuBegin(C, op->type->name, ICON_NONE); | pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE); | ||||
| layout = uiPupMenuLayout(pup); | layout = UI_popup_menu_layout(pup); | ||||
| uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); | uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); | ||||
| /* add new (adds to the first unoccupied frame) */ | /* add new (adds to the first unoccupied frame) */ | ||||
| uiItemIntO(layout, IFACE_("Add New"), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); | uiItemIntO(layout, IFACE_("Add New"), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); | ||||
| /* check if we have any choices to add a new pose in any other way */ | /* check if we have any choices to add a new pose in any other way */ | ||||
| if ((ob->poselib) && (ob->poselib->markers.first)) { | if ((ob->poselib) && (ob->poselib->markers.first)) { | ||||
| /* add new (on current frame) */ | /* add new (on current frame) */ | ||||
| uiItemIntO(layout, IFACE_("Add New (Current Frame)"), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA); | uiItemIntO(layout, IFACE_("Add New (Current Frame)"), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA); | ||||
| /* replace existing - submenu */ | /* replace existing - submenu */ | ||||
| uiItemMenuF(layout, IFACE_("Replace Existing..."), 0, poselib_add_menu_invoke__replacemenu, NULL); | uiItemMenuF(layout, IFACE_("Replace Existing..."), 0, poselib_add_menu_invoke__replacemenu, NULL); | ||||
| } | } | ||||
| uiPupMenuEnd(C, pup); | UI_popup_menu_end(C, pup); | ||||
| /* this operator is only for a menu, not used further */ | /* this operator is only for a menu, not used further */ | ||||
| return OPERATOR_INTERFACE; | return OPERATOR_INTERFACE; | ||||
| } | } | ||||
| static int poselib_add_exec(bContext *C, wmOperator *op) | static int poselib_add_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 1,232 Lines • Show Last 20 Lines | |||||