Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/pose_edit.c
| Show First 20 Lines • Show All 587 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| /* ********************************************** */ | /* ********************************************** */ | ||||
| static int pose_flip_names_exec(bContext *C, wmOperator *UNUSED(op)) | static int pose_flip_names_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); | Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); | ||||
| bArmature *arm; | bArmature *arm; | ||||
| /* paranoia checks */ | /* paranoia checks */ | ||||
| if (ELEM(NULL, ob, ob->pose)) | if (ELEM(NULL, ob, ob->pose)) | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| arm = ob->data; | arm = ob->data; | ||||
| /* loop through selected bones, auto-naming them */ | ListBase bones_names = {NULL}; | ||||
| CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) | CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) | ||||
| { | { | ||||
| char name_flip[MAXBONENAME]; | BLI_addtail(&bones_names, BLI_genericNodeN(pchan->name)); | ||||
| BKE_deform_flip_side_name(name_flip, pchan->name, true); | |||||
| ED_armature_bone_rename(arm, pchan->name, name_flip); | |||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| ED_armature_bones_flip_names(arm, &bones_names); | |||||
| BLI_freelistN(&bones_names); | |||||
| /* since we renamed stuff... */ | /* since we renamed stuff... */ | ||||
| DAG_id_tag_update(&ob->id, OB_RECALC_DATA); | DAG_id_tag_update(&ob->id, OB_RECALC_DATA); | ||||
| /* note, notifier might evolve */ | /* note, notifier might evolve */ | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 567 Lines • Show Last 20 Lines | |||||