Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/pose_edit.c
| Show All 39 Lines | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "BKE_anim.h" | #include "BKE_anim.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_workspace.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| Show All 33 Lines | void ED_armature_enter_posemode(bContext *C, Base *base) | ||||
| if (ID_IS_LINKED(ob)) { | if (ID_IS_LINKED(ob)) { | ||||
| BKE_report(reports, RPT_WARNING, "Cannot pose libdata"); | BKE_report(reports, RPT_WARNING, "Cannot pose libdata"); | ||||
| return; | return; | ||||
| } | } | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| case OB_ARMATURE: | case OB_ARMATURE: | ||||
| ob->restore_mode = ob->mode; | BKE_workspace_object_mode_for_object_set(CTX_wm_workspace(C), CTX_data_scene(C), | ||||
| ob->mode |= OB_MODE_POSE; | ob, ob->mode | OB_MODE_POSE); | ||||
| /* Inform all CoW versions that we changed the mode. */ | /* Inform all CoW versions that we changed the mode. */ | ||||
| DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE); | DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL); | WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL); | ||||
| break; | break; | ||||
| default: | default: | ||||
| return; | return; | ||||
| } | } | ||||
| /* XXX: disabled as this would otherwise cause a nasty loop... */ | /* XXX: disabled as this would otherwise cause a nasty loop... */ | ||||
| //ED_object_toggle_modes(C, ob->mode); | //ED_object_toggle_modes(C, ob->mode); | ||||
| } | } | ||||
| void ED_armature_exit_posemode(bContext *C, Base *base) | void ED_armature_exit_posemode(bContext *C, Base *base) | ||||
| { | { | ||||
| if (base) { | if (base) { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| ob->restore_mode = ob->mode; | BKE_workspace_object_mode_for_object_set(CTX_wm_workspace(C), CTX_data_scene(C), ob, ob->mode & ~OB_MODE_POSE); | ||||
| ob->mode &= ~OB_MODE_POSE; | |||||
| /* Inform all CoW versions that we changed the mode. */ | /* Inform all CoW versions that we changed the mode. */ | ||||
| DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE); | DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL); | WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,076 Lines • Show Last 20 Lines | |||||