Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-09-20 18:38:32 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-09-25 15:40:06 +0300
commit615d5fa2fbd24ed6f76a93d7b523066f53da950e (patch)
tree71599e65499a0afd1216012c4b47979c43ebcf31 /source/blender/editors/armature
parenteb2ed0ea7a2c4090b8e2f239a40da03d6ee29900 (diff)
Motion paths: Use minimal possible dependency graph
This change makes it so motion paths are using minimal possible dependency graph which is sufficient to evaluate required motion path targets. Disclaimer: granularity is done on ID level, but it is possible to go more granular if really needed. Brings time down to 0.5 sec when updating motion path for the Rain animation file used for benchmarks in the previous commits. Reviewers: brecht Differential Revision: https://developer.blender.org/D5874
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/pose_edit.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index e2c9828c20f..ad115896a43 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -208,12 +208,12 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathC
}
Main *bmain = CTX_data_main(C);
- /* NOTE: Dependency graph will be evaluated at all the frames, but we first need to access some
- * nested pointers, like animation data. */
- Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- ListBase targets = {NULL, NULL};
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+
+ Depsgraph *depsgraph;
bool free_depsgraph = false;
+ ListBase targets = {NULL, NULL};
/* set flag to force recalc, then grab the relevant bones to target */
ob->pose->avs.recalc |= ANIMVIZ_RECALC_PATHS;
animviz_get_object_motionpaths(ob, &targets);
@@ -223,6 +223,19 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathC
TIMEIT_START(pose_path_calc);
#endif
+ /* For a single frame update it's faster to re-use existing dependency graph and avoid overhead
+ * of building all the relations and so on for a temporary one. */
+ if (range == POSE_PATH_CALC_RANGE_CURRENT_FRAME) {
+ /* NOTE: Dependency graph will be evaluated at all the frames, but we first need to access some
+ * nested pointers, like animation data. */
+ depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+ free_depsgraph = false;
+ }
+ else {
+ depsgraph = animviz_depsgraph_build(bmain, scene, view_layer, &targets);
+ free_depsgraph = true;
+ }
+
animviz_calc_motionpaths(
depsgraph, bmain, scene, &targets, pose_path_convert_range(range), !free_depsgraph);
@@ -238,7 +251,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathC
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
}
- /* Free temporary depsgraph instance */
+ /* Free temporary depsgraph. */
if (free_depsgraph) {
DEG_graph_free(depsgraph);
}