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.
This commit is contained in:
Joshua Leung 2016-02-06 13:04:20 +13:00
parent 9eca281e88
commit 4e3d6725c4
2 changed files with 9 additions and 12 deletions

View File

@ -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;

View File

@ -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;