diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-08-23 06:41:08 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-08-23 08:07:38 +0300 |
commit | bd801e7a687922e91c56ba2884cf93a4500c4e24 (patch) | |
tree | 572aa6637d408970d3e58ff0e57e5412a4778159 /source/blender/blenkernel/intern/anim.c | |
parent | 0e44cf5d786a72efd9f721b6e2ffc2adf4379bb3 (diff) |
Faster Motion Path calculations using Depsgraph Filtering
This commit makes the motion path calculations use the
new Depsgraph Filtering API to obtain a more streamlined
copy of the full scene dependency graph, allowing for
faster calculations (as less data needs to be evaluated
for each frame being baked).
For example, in 01_020_A.anim.blend from the Spring production
files, the time needed to calculate paths on several bones
on Autumn went from 39.84 seconds (!) down to 9.90 seconds!
Currently, this works by just replacing the depsgraph instance
passed to the motion path calculation function. This filtered
instance contains just the ID's needed to evaluate the graph
to evaluate a specified target (i.e. the Object owning the pose).
Notes:
* By default, the filtering is not performed unless debug mode 555
is activated. Having a debug switch here allows comparing
performance and disabling it should thing it start crashing.
* It is necessary to pass in the original Scene instance (not the
COW one owned by the filtered depsgraph), otherwise changing the
current frame had no effect, due to the COW flushing from original
Scene to the new Scene overwriting the CFRA changes we make.
* The code here still needs cleaning up to debugging instrumentation, etc.
and also to optimise further (e.g. caching the filtered depsgraph
for faster updates when animating on existing paths, or fine-tuning
the exact set of nodes needed). I'm just committing this first,
since this was the quickly hacked-together test code I've been using
to check that this is all working.
* Further improvements could also be made to the time needed to
build the full graph instance (about 3.3 sec), by allowing partial
builds (e.g. by making a filtering proxy/wrapper around existing builders)
Diffstat (limited to 'source/blender/blenkernel/intern/anim.c')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 6168ce97f86..ece3a018a9e 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -466,7 +466,10 @@ static void motionpaths_calc_bake_targets(ListBase *targets, int cframe) } /* calculate path over requested range */ + printf("Calculating Paths over Frame Range:\n"); for (CFRA = sfra; CFRA <= efra; CFRA++) { + printf(" Frame %d\n", CFRA); + /* update relevant data for new frame */ motionpaths_calc_update_scene(bmain, depsgraph); @@ -475,9 +478,8 @@ static void motionpaths_calc_bake_targets(ListBase *targets, int cframe) } /* reset original environment */ - // XXX: Soon to be obsolete CFRA = cfra; - motionpaths_calc_update_scene(bmain, depsgraph); + motionpaths_calc_update_scene(bmain, depsgraph); // XXX: Soon to be obsolete /* clear recalc flags from targets */ for (mpt = targets->first; mpt; mpt = mpt->next) { |