From 4e3d6725c4b1ac0e554aa5ff1cb6e151029b2d40 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 6 Feb 2016 13:04:20 +1300 Subject: [PATCH] Clear motionpaths for all objects and bones instead of only selected ones With the old behaviour, it was too easy to get old paths hanging around because you forgot to go through and select a few bones that still had them. --- source/blender/editors/armature/pose_edit.c | 13 +++++-------- source/blender/editors/object/object_edit.c | 8 ++++---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 0260b604408..9e8028b6cd8 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -306,21 +306,18 @@ static void ED_pose_clear_paths(Object *ob) if (ELEM(NULL, ob, ob->pose)) return; - /* free the motionpath blocks, but also take note of whether we skipped some... */ + /* free the motionpath blocks for all bones - This is easier for users to quickly clear all */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->mpath) { - if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) { + if (pchan->bone) { animviz_free_motionpath(pchan->mpath); pchan->mpath = NULL; } - else - skipped = 1; } } - /* if we didn't skip any, we shouldn't have any paths left */ - if (skipped == 0) - ob->pose->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS; + /* no paths left!*/ + ob->pose->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS; } /* operator callback for this */ @@ -346,7 +343,7 @@ void POSE_OT_paths_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear Bone Paths"; ot->idname = "POSE_OT_paths_clear"; - ot->description = "Clear path caches for selected bones"; + ot->description = "Clear path caches for all bones"; /* api callbacks */ ot->exec = pose_clear_paths_exec; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 67c9f6e98da..9940ad896b1 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1314,11 +1314,11 @@ void OBJECT_OT_paths_update(wmOperatorType *ot) /* --------- */ -/* Clear motion paths for selected objects only */ +/* Clear motion paths for all objects */ void ED_objects_clear_paths(bContext *C) { - /* loop over objects in scene */ - CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) + /* loop over all edtiable objects in scene */ + CTX_DATA_BEGIN(C, Object *, ob, editable_objects) { if (ob->mpath) { animviz_free_motionpath(ob->mpath); @@ -1346,7 +1346,7 @@ void OBJECT_OT_paths_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear Object Paths"; ot->idname = "OBJECT_OT_paths_clear"; - ot->description = "Clear path caches for selected objects"; + ot->description = "Clear path caches for all objects"; /* api callbacks */ ot->exec = object_clear_paths_exec;