Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/armature_relations.c
| Show First 20 Lines • Show All 667 Lines • ▼ Show 20 Lines | static int armature_parent_set_exec(bContext *C, wmOperator *op) | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) | static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| EditBone *actbone = CTX_data_active_bone(C); | EditBone *actbone = CTX_data_active_bone(C); | ||||
| uiPopupMenu *pup = uiPupMenuBegin(C, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Make Parent"), ICON_NONE); | uiPopupMenu *pup = UI_popup_menu_begin(C, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Make Parent"), ICON_NONE); | ||||
| uiLayout *layout = uiPupMenuLayout(pup); | uiLayout *layout = UI_popup_menu_layout(pup); | ||||
| int allchildbones = 0; | int allchildbones = 0; | ||||
| CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) | CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) | ||||
| { | { | ||||
| if (ebone != actbone) { | if (ebone != actbone) { | ||||
| if (ebone->parent != actbone) allchildbones = 1; | if (ebone->parent != actbone) allchildbones = 1; | ||||
| } | } | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_CONNECT); | uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_CONNECT); | ||||
| /* ob becomes parent, make the associated menus */ | /* ob becomes parent, make the associated menus */ | ||||
| if (allchildbones) | if (allchildbones) | ||||
| uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_OFFSET); | uiItemEnumO(layout, "ARMATURE_OT_parent_set", NULL, 0, "type", ARM_PAR_OFFSET); | ||||
| uiPupMenuEnd(C, pup); | UI_popup_menu_end(C, pup); | ||||
| return OPERATOR_INTERFACE; | return OPERATOR_INTERFACE; | ||||
| } | } | ||||
| void ARMATURE_OT_parent_set(wmOperatorType *ot) | void ARMATURE_OT_parent_set(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Make Parent"; | ot->name = "Make Parent"; | ||||
| ▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines | |||||