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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-14 15:03:31 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-14 18:42:58 +0300
commit5feb03c3ae3353f1a616412f7384511f693ebc33 (patch)
tree3c5e07f98752cbcc8839525ddbe52ef376a0c43d /source/blender/editors/armature/pose_edit.c
parentfe6a6dee0bd91c59c774e2feb8886a8a4b4f0806 (diff)
Motion Paths: interactively update current frame location while dragging.
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r--source/blender/editors/armature/pose_edit.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index d0ca809f196..15b8c3eb8de 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -193,15 +193,20 @@ static bool pose_has_protected_selected(Object *ob, short warn)
*
* To be called from various tools that do incremental updates
*/
-void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
+void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, bool current_frame_only)
{
- struct Main *bmain = CTX_data_main(C);
+ /* Transform doesn't always have context avaialble to do update. */
+ if (C == NULL) {
+ return;
+ }
+
+ Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase targets = {NULL, NULL};
bool free_depsgraph = false;
/* Override depsgraph with a filtered, simpler copy */
- if (G.debug_value != -1) {
+ if (!current_frame_only && G.debug_value != -1) {
TIMEIT_START(filter_pose_depsgraph);
DEG_FilterQuery query = {0};
@@ -226,13 +231,16 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
/* recalculate paths, then free */
TIMEIT_START(pose_path_calc);
- animviz_calc_motionpaths(depsgraph, bmain, scene, &targets, false);
+ animviz_calc_motionpaths(depsgraph, bmain, scene, &targets, !free_depsgraph, current_frame_only);
TIMEIT_END(pose_path_calc);
BLI_freelistN(&targets);
- /* tag armature object for copy on write - so paths will draw/redraw */
- DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
+ if (!current_frame_only) {
+ /* Tag armature object for copy on write - so paths will draw/redraw.
+ * For currently frame only we update evaluated object directly. */
+ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
+ }
/* Free temporary depsgraph instance */
if (free_depsgraph) {
@@ -303,7 +311,7 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
/* calculate the bones that now have motionpaths... */
/* TODO: only make for the selected bones? */
- ED_pose_recalculate_paths(C, scene, ob);
+ ED_pose_recalculate_paths(C, scene, ob, false);
#ifdef DEBUG_TIME
TIMEIT_END(recalc_pose_paths);
@@ -364,7 +372,7 @@ static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
/* calculate the bones that now have motionpaths... */
/* TODO: only make for the selected bones? */
- ED_pose_recalculate_paths(C, scene, ob);
+ ED_pose_recalculate_paths(C, scene, ob, false);
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);