diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-20 14:33:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-20 14:33:16 +0300 |
commit | 0b413e406d7335a9a5d7d7b2ba2ae4f199d2fbcf (patch) | |
tree | 0eb6aadbb65aa0cbe277dcde86741acc1129c847 /source | |
parent | a8777f905846f80385fc90135e000c3169bbefc6 (diff) |
Avoid passing context to motion path calculation
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_anim.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 11 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 5 | ||||
-rw-r--r-- | source/blender/editors/include/ED_armature.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 5 |
5 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 9beff85b87c..30a7bdb0a27 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -41,7 +41,7 @@ struct bAnimVizSettings; struct bMotionPath; struct bPoseChannel; struct ReportList; -struct bContext; +struct Main; /* ---------------------------------------------------- */ /* Animation Visualization */ @@ -54,7 +54,7 @@ void animviz_free_motionpath(struct bMotionPath *mpath); struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); -void animviz_calc_motionpaths(struct bContext *C, struct Scene *scene, ListBase *targets); +void animviz_calc_motionpaths(struct EvaluationContext *eval_ctx, struct Main *bmain, struct Scene *scene, ListBase *targets); /* ---------------------------------------------------- */ /* Curve Paths */ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index eb63ea5250d..7a0bf54f1f2 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -54,6 +54,7 @@ #include "BKE_anim.h" #include "BKE_report.h" +#include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" // XXX bad level call... @@ -341,15 +342,11 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) * - recalc: whether we need to */ /* TODO: include reports pointer? */ -void animviz_calc_motionpaths(bContext *C, Scene *scene, ListBase *targets) + void animviz_calc_motionpaths(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, ListBase *targets) { MPathTarget *mpt; int sfra, efra; int cfra; - Main *bmain = CTX_data_main(C); - /* TODO(sergey): Should we mabe pass scene layer explicitly? */ - SceneLayer *scene_layer = CTX_data_scene_layer(C); - struct Depsgraph *depsgraph = CTX_data_depsgraph(C); /* sanity check */ if (ELEM(NULL, targets, targets->first)) @@ -372,7 +369,7 @@ void animviz_calc_motionpaths(bContext *C, Scene *scene, ListBase *targets) /* calculate path over requested range */ for (CFRA = sfra; CFRA <= efra; CFRA++) { /* update relevant data for new frame */ - motionpaths_calc_update_scene(bmain, scene, scene_layer, depsgraph); + motionpaths_calc_update_scene(bmain, scene, eval_ctx->scene_layer, eval_ctx->depsgraph); /* perform baking for targets */ motionpaths_calc_bake_targets(scene, targets); @@ -380,7 +377,7 @@ void animviz_calc_motionpaths(bContext *C, Scene *scene, ListBase *targets) /* reset original environment */ CFRA = cfra; - motionpaths_calc_update_scene(bmain, scene, scene_layer, depsgraph); + motionpaths_calc_update_scene(bmain, scene, eval_ctx->scene_layer, eval_ctx->depsgraph); /* clear recalc flags from targets */ for (mpt = targets->first; mpt; mpt = mpt->next) { diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 97316010bc9..74e29b2e8da 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -161,6 +161,9 @@ static bool pose_has_protected_selected(Object *ob, short warn) */ 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 */ @@ -168,7 +171,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) animviz_get_object_motionpaths(ob, &targets); /* recalculate paths, then free */ - animviz_calc_motionpaths(C, scene, &targets); + animviz_calc_motionpaths(&eval_ctx, bmain, scene, &targets); BLI_freelistN(&targets); } diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 489f238d85a..918e96d8408 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -51,6 +51,7 @@ struct SceneLayer; struct ViewContext; struct wmKeyConfig; struct wmOperator; +struct Main; typedef struct EditBone { struct EditBone *next, *prev; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 207535dd1d0..eaf42d4a53c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1033,6 +1033,9 @@ void OBJECT_OT_forcefield_toggle(wmOperatorType *ot) */ void ED_objects_recalculate_paths(bContext *C, Scene *scene) { + struct Main *bmain = CTX_data_main(C); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); ListBase targets = {NULL, NULL}; /* loop over objects in scene */ @@ -1045,7 +1048,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) CTX_DATA_END; /* recalculate paths, then free */ - animviz_calc_motionpaths(C, scene, &targets); + animviz_calc_motionpaths(&eval_ctx, bmain, scene, &targets); BLI_freelistN(&targets); } |