Depsgraph: Remove residue of motion path optimization

This needs to be re-implemented in a new fashion, without touching global list
of bases and become compatible with the new dependency graph.

The idea to go here would be to create new dependency graph for motion path
evaluation, bring a single object in there (which will pull all dependencies
at a construction) and use that.

Needs working copy-on-write first tho.
This commit is contained in:
Sergey Sharybin 2017-10-24 16:39:26 +02:00
parent b6560d9fc1
commit d012c9d0f4
2 changed files with 2 additions and 46 deletions

View File

@ -275,45 +275,6 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
/* ........ */
/* Note on evaluation optimizations:
* Optimization's currently used here play tricks with the depsgraph in order to try and
* evaluate as few objects as strictly necessary to get nicer performance under standard
* production conditions. For those people who really need the accurate version,
* disable the ifdef (i.e. 1 -> 0) and comment out the call to motionpaths_calc_optimise_depsgraph()
*/
/* tweak the object ordering to trick depsgraph into making MotionPath calculations run faster */
static void motionpaths_calc_optimise_depsgraph(bContext *C, Scene *scene, ListBase *targets)
{
BaseLegacy *base, *baseNext;
MPathTarget *mpt;
Main *bmain = CTX_data_main(C);
/* make sure our temp-tag isn't already in use */
for (base = scene->base.first; base; base = base->next)
base->object->flag &= ~BA_TEMP_TAG;
/* for each target, dump its object to the start of the list if it wasn't moved already */
for (mpt = targets->first; mpt; mpt = mpt->next) {
for (base = scene->base.first; base; base = baseNext) {
baseNext = base->next;
if ((base->object == mpt->ob) && !(mpt->ob->flag & BA_TEMP_TAG)) {
BLI_remlink(&scene->base, base);
BLI_addhead(&scene->base, base);
mpt->ob->flag |= BA_TEMP_TAG;
/* we really don't need to continue anymore once this happens, but this line might really 'break' */
break;
}
}
}
/* "brew me a list that's sorted a bit faster now depsy" */
DEG_scene_relations_rebuild(bmain, scene);
}
/* update scene for current frame */
static void motionpaths_calc_update_scene(Scene *scene)
{
@ -375,7 +336,7 @@ 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(bContext *UNUSED(C), Scene *scene, ListBase *targets)
{
MPathTarget *mpt;
int sfra, efra;
@ -399,10 +360,6 @@ void animviz_calc_motionpaths(bContext *C, Scene *scene, ListBase *targets)
}
if (efra <= sfra) return;
/* optimize the depsgraph for faster updates */
/* TODO: whether this is used should depend on some setting for the level of optimizations used */
motionpaths_calc_optimise_depsgraph(C, scene, targets);
/* calculate path over requested range */
for (CFRA = sfra; CFRA <= efra; CFRA++) {
/* update relevant data for new frame */

View File

@ -74,8 +74,7 @@ void DEG_relations_tag_update(struct Main *bmain);
void DEG_scene_relations_update(struct Main *bmain, struct Scene *scene);
/* Rebuild dependency graph only for a given scene. */
void DEG_scene_relations_rebuild(struct Main *bmain,
struct Scene *scene);
void DEG_scene_relations_rebuild(struct Main *bmain, struct Scene *scene);
/* Add Dependencies ----------------------------- */