Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/anim.c
| Show First 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | void animviz_get_object_motionpaths(Object *ob, ListBase *targets) | ||||
| } | } | ||||
| } | } | ||||
| /* ........ */ | /* ........ */ | ||||
| /* update scene for current frame */ | /* update scene for current frame */ | ||||
| static void motionpaths_calc_update_scene(Main *bmain, | static void motionpaths_calc_update_scene(Main *bmain, | ||||
| Scene *scene, | Scene *scene, | ||||
| SceneLayer *scene_layer, | ViewLayer *view_layer, | ||||
| struct Depsgraph *depsgraph) | struct Depsgraph *depsgraph) | ||||
| { | { | ||||
| /* Do all updates | /* Do all updates | ||||
| * - if this is too slow, resort to using a more efficient way | * - if this is too slow, resort to using a more efficient way | ||||
| * that doesn't force complete update, but for now, this is the | * that doesn't force complete update, but for now, this is the | ||||
| * most accurate way! | * most accurate way! | ||||
| * | * | ||||
| * TODO(segey): Bring back partial updates, which became impossible | * TODO(segey): Bring back partial updates, which became impossible | ||||
| * with the new depsgraph due to unsorted nature of bases. | * with the new depsgraph due to unsorted nature of bases. | ||||
| * | * | ||||
| * TODO(sergey): Use evaluation context dedicated to motion paths. | * TODO(sergey): Use evaluation context dedicated to motion paths. | ||||
| */ | */ | ||||
| BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, scene_layer); | BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer); | ||||
| } | } | ||||
| /* ........ */ | /* ........ */ | ||||
| /* perform baking for the targets on the current frame */ | /* perform baking for the targets on the current frame */ | ||||
| static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) | static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) | ||||
| { | { | ||||
| MPathTarget *mpt; | MPathTarget *mpt; | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | for (mpt = targets->first; mpt; mpt = mpt->next) { | ||||
| sfra = MIN2(sfra, mpt->mpath->start_frame); | sfra = MIN2(sfra, mpt->mpath->start_frame); | ||||
| efra = MAX2(efra, mpt->mpath->end_frame); | efra = MAX2(efra, mpt->mpath->end_frame); | ||||
| } | } | ||||
| if (efra <= sfra) return; | if (efra <= sfra) return; | ||||
| /* calculate path over requested range */ | /* calculate path over requested range */ | ||||
| for (CFRA = sfra; CFRA <= efra; CFRA++) { | for (CFRA = sfra; CFRA <= efra; CFRA++) { | ||||
| /* update relevant data for new frame */ | /* update relevant data for new frame */ | ||||
| motionpaths_calc_update_scene(bmain, scene, eval_ctx->scene_layer, eval_ctx->depsgraph); | motionpaths_calc_update_scene(bmain, scene, eval_ctx->view_layer, eval_ctx->depsgraph); | ||||
| /* perform baking for targets */ | /* perform baking for targets */ | ||||
| motionpaths_calc_bake_targets(scene, targets); | motionpaths_calc_bake_targets(scene, targets); | ||||
| } | } | ||||
| /* reset original environment */ | /* reset original environment */ | ||||
| CFRA = cfra; | CFRA = cfra; | ||||
| motionpaths_calc_update_scene(bmain, scene, eval_ctx->scene_layer, eval_ctx->depsgraph); | motionpaths_calc_update_scene(bmain, scene, eval_ctx->view_layer, eval_ctx->depsgraph); | ||||
| /* clear recalc flags from targets */ | /* clear recalc flags from targets */ | ||||
| for (mpt = targets->first; mpt; mpt = mpt->next) { | for (mpt = targets->first; mpt; mpt = mpt->next) { | ||||
| bAnimVizSettings *avs; | bAnimVizSettings *avs; | ||||
| /* get pointer to animviz settings for each target */ | /* get pointer to animviz settings for each target */ | ||||
| if (mpt->pchan) | if (mpt->pchan) | ||||
| avs = &mpt->ob->pose->avs; | avs = &mpt->ob->pose->avs; | ||||
| ▲ Show 20 Lines • Show All 258 Lines • Show Last 20 Lines | |||||