diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2022-03-14 13:15:09 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2022-03-14 13:17:45 +0300 |
commit | 7306417ae46a2cf2733849cd52e1bfb74af40f08 (patch) | |
tree | 0fb5e4289045b708b074a408c4fd7ca3c36e035e /source/blender/editors/animation | |
parent | 4045b3d7b685aeeb6003d3f90b4a41f6337b6159 (diff) |
Revert "Animation: Sensible frame range for motion paths"
This reverts commit 1558b270e9fcbc2e23fa248b0e7e770dddae155c.
An earlier commit (rB101fadcf6b93c) introduced some new functionality,
which was overlooked in reviewing this commit & got broken.
Will re-commit after the issue has been fixed.
Ref: D13687
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_motion_paths.c | 49 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_keylist.cc | 48 |
2 files changed, 7 insertions, 90 deletions
diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index 2c99cd1cc1f..539227933cf 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -340,55 +340,6 @@ static void motionpath_free_free_tree_data(ListBase *targets) } } -void animviz_motionpath_compute_range(Object *ob, Scene *scene) -{ - struct AnimKeylist *keylist = ED_keylist_create(); - bAnimVizSettings *avs; - if (ob->mode == OB_MODE_POSE) { - avs = &ob->pose->avs; - bArmature *arm = ob->data; - - if (!ELEM(NULL, ob->adt, ob->adt->action, arm->adt)) { - /* Loop through all the fcurves and get only the keylists for the bone location fcurves */ - LISTBASE_FOREACH (FCurve *, fcu, &ob->adt->action->curves) { - if (strstr(fcu->rna_path, "pose.bones[") && strstr(fcu->rna_path, "location")) { - fcurve_to_keylist(arm->adt, fcu, keylist, 0); - } - } - } - } - else { - avs = &ob->avs; - - if (!ELEM(NULL, ob->adt, ob->adt->action)) { - /* Loop through all the fcurves and get only the keylists for the location fcurves */ - LISTBASE_FOREACH (FCurve *, fcu, &ob->adt->action->curves) { - if (strcmp(fcu->rna_path, "location") == 0) { - fcurve_to_keylist(ob->adt, fcu, keylist, 0); - } - } - } - } - - if (ED_keylist_is_empty(keylist) || (avs->path_range == MOTIONPATH_RANGE_SCENE)) { - /* Apply scene frame range if no keys where found or if scene range is selected */ - avs->path_sf = PSFRA; - avs->path_ef = PEFRA; - } - else { - /* Compute keys range */ - Range2f frame_range; - const bool only_selected = avs->path_range == MOTIONPATH_RANGE_KEYS_SELECTED; - /* Get range for all keys if selected_only is false or if no keys are selected */ - if (!(only_selected && ED_keylist_selected_keys_frame_range(keylist, &frame_range))) { - ED_keylist_all_keys_frame_range(keylist, &frame_range); - } - avs->path_sf = frame_range.min; - avs->path_ef = frame_range.max; - } - ED_keylist_free(keylist); -} - void animviz_calc_motionpaths(Depsgraph *depsgraph, Main *bmain, Scene *scene, diff --git a/source/blender/editors/animation/keyframes_keylist.cc b/source/blender/editors/animation/keyframes_keylist.cc index 3356ef4d47d..9ee047fafff 100644 --- a/source/blender/editors/animation/keyframes_keylist.cc +++ b/source/blender/editors/animation/keyframes_keylist.cc @@ -304,39 +304,7 @@ const struct ListBase *ED_keylist_listbase(const AnimKeylist *keylist) return &keylist->key_columns; } -static void keylist_first_last(const struct AnimKeylist *keylist, - const struct ActKeyColumn **first_column, - const struct ActKeyColumn **last_column) -{ - if (keylist->is_runtime_initialized) { - *first_column = &keylist->runtime.key_columns[0]; - *last_column = &keylist->runtime.key_columns[keylist->column_len - 1]; - } - else { - *first_column = static_cast<const ActKeyColumn *>(keylist->key_columns.first); - *last_column = static_cast<const ActKeyColumn *>(keylist->key_columns.last); - } -} - -bool ED_keylist_all_keys_frame_range(const struct AnimKeylist *keylist, Range2f *r_frame_range) -{ - BLI_assert(r_frame_range); - - if (ED_keylist_is_empty(keylist)) { - return false; - } - - const ActKeyColumn *first_column; - const ActKeyColumn *last_column; - keylist_first_last(keylist, &first_column, &last_column); - r_frame_range->min = first_column->cfra; - r_frame_range->max = last_column->cfra; - - return true; -} - -bool ED_keylist_selected_keys_frame_range(const struct AnimKeylist *keylist, - Range2f *r_frame_range) +bool ED_keylist_frame_range(const struct AnimKeylist *keylist, Range2f *r_frame_range) { BLI_assert(r_frame_range); @@ -346,15 +314,13 @@ bool ED_keylist_selected_keys_frame_range(const struct AnimKeylist *keylist, const ActKeyColumn *first_column; const ActKeyColumn *last_column; - keylist_first_last(keylist, &first_column, &last_column); - while (first_column && !(first_column->sel & SELECT)) { - first_column = first_column->next; - } - while (last_column && !(last_column->sel & SELECT)) { - last_column = last_column->prev; + if (keylist->is_runtime_initialized) { + first_column = &keylist->runtime.key_columns[0]; + last_column = &keylist->runtime.key_columns[keylist->column_len - 1]; } - if (!first_column || !last_column || first_column == last_column) { - return false; + else { + first_column = static_cast<const ActKeyColumn *>(keylist->key_columns.first); + last_column = static_cast<const ActKeyColumn *>(keylist->key_columns.last); } r_frame_range->min = first_column->cfra; r_frame_range->max = last_column->cfra; |