diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 0aba2d8619d..08c8528384f 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -208,6 +208,9 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel * /* allocate a cache */ mpath->points= MEM_callocN(sizeof(bMotionPathVert)*mpath->length, "bMotionPathVerts"); + /* tag viz settings as currently having some path(s) which use it */ + avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS; + /* return it */ return mpath; } diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 0170241c6c2..a162c8eb21a 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -277,19 +277,26 @@ void POSE_OT_paths_calculate (wmOperatorType *ot) void ED_pose_clear_paths(Object *ob) { bPoseChannel *pchan; + short skipped = 0; if ELEM(NULL, ob, ob->pose) return; - /* free the motionpath blocks */ + /* free the motionpath blocks, but also take note of whether we skipped some... */ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { - if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) { - if (pchan->mpath) { + if (pchan->mpath) { + if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) { 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; } /* operator callback for this */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index dc6728406e5..807fa00d806 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1687,6 +1687,7 @@ void ED_objects_clear_paths(bContext *C, Scene *scene) if (ob->mpath) { animviz_free_motionpath(ob->mpath); ob->mpath= NULL; + ob->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS; } } CTX_DATA_END; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5fd96e466b0..372aa42bac3 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4688,9 +4688,11 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o } /* do the bone paths - * NOTE: only do this when there is context info + * - only do this when there is context info, since we need that to resolve + * how to do the updates and so on... + * - do not calculate unless there are paths already to update... */ - if (C && (ob->pose->avs.path_type == MOTIONPATH_TYPE_ACFRA)) { + if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) { //ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear ED_pose_recalculate_paths(C, scene, ob); } @@ -4996,7 +4998,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if (!cancelled) { autokeyframe_ob_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode); - if (ob->avs.path_type == MOTIONPATH_TYPE_ACFRA) + /* only calculate paths if there are paths to be recalculated */ + if (ob->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) recalcObPaths= 1; } } diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 2304d4aae06..27d47ea5a42 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -161,6 +161,8 @@ typedef enum eMotionPaths_BakeFlag { MOTIONPATH_BAKE_NEEDS_RECALC = (1<<0), /* for bones - calculate head-points for curves instead of tips */ MOTIONPATH_BAKE_HEADS = (1<<1), + /* motion paths exist for AnimVizSettings instance - set when calc for first time, and unset when clearing */ + MOTIONPATH_BAKE_HAS_PATHS = (1<<2), } eMotionPath_BakeFlag; /* ************************************************ */