diff options
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index acbf23ecf82..74e29b2e8da 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -43,10 +43,11 @@ #include "BKE_armature.h" #include "BKE_context.h" #include "BKE_deform.h" -#include "BKE_depsgraph.h" #include "BKE_object.h" #include "BKE_report.h" +#include "DEG_depsgraph.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -95,7 +96,8 @@ void ED_armature_enter_posemode(bContext *C, Base *base) case OB_ARMATURE: ob->restore_mode = ob->mode; ob->mode |= OB_MODE_POSE; - + /* 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); WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL); break; @@ -114,7 +116,10 @@ void ED_armature_exit_posemode(bContext *C, Base *base) ob->restore_mode = ob->mode; ob->mode &= ~OB_MODE_POSE; - + + /* 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); + WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL); } } @@ -154,8 +159,11 @@ static bool pose_has_protected_selected(Object *ob, short warn) * * To be called from various tools that do incremental updates */ -void ED_pose_recalculate_paths(Scene *scene, Object *ob) +void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) { + struct Main *bmain = CTX_data_main(C); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); ListBase targets = {NULL, NULL}; /* set flag to force recalc, then grab the relevant bones to target */ @@ -163,7 +171,7 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob) animviz_get_object_motionpaths(ob, &targets); /* recalculate paths, then free */ - animviz_calc_motionpaths(scene, &targets); + animviz_calc_motionpaths(&eval_ctx, bmain, scene, &targets); BLI_freelistN(&targets); } @@ -226,7 +234,7 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op) /* calculate the bones that now have motionpaths... */ /* TODO: only make for the selected bones? */ - ED_pose_recalculate_paths(scene, ob); + ED_pose_recalculate_paths(C, scene, ob); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); @@ -282,7 +290,7 @@ static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op)) /* calculate the bones that now have motionpaths... */ /* TODO: only make for the selected bones? */ - ED_pose_recalculate_paths(scene, ob); + ED_pose_recalculate_paths(C, scene, ob); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); @@ -580,7 +588,7 @@ static void pose_copy_menu(Scene *scene) BKE_pose_tag_recalc(bmain, ob->pose); } - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); // and all its relations + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); // and all its relations BIF_undo_push("Copy Pose Attributes"); @@ -613,7 +621,7 @@ static int pose_flip_names_exec(bContext *C, wmOperator *UNUSED(op)) BLI_freelistN(&bones_names); /* since we renamed stuff... */ - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); @@ -660,7 +668,7 @@ static int pose_autoside_names_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* since we renamed stuff... */ - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); @@ -709,7 +717,7 @@ static int pose_bone_rotmode_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* notifiers and updates */ - DAG_id_tag_update((ID *)ob, OB_RECALC_DATA); + DEG_id_tag_update((ID *)ob, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob); return OPERATOR_FINISHED; @@ -1171,7 +1179,7 @@ static int pose_flip_quats_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_END; /* notifiers and updates */ - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob); return OPERATOR_FINISHED; |