diff options
Diffstat (limited to 'source/blender/editors/space_action/action_edit.c')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index bbad78c1416..a9f9488d049 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -385,12 +385,22 @@ static int actkeys_viewall(bContext *C, const bool only_sel) if (only_sel && (found == false)) return OPERATOR_CANCELLED; - v2d->cur.xmin = min; - v2d->cur.xmax = max; + if (fabsf(max - min) < 1.0f) { + /* Exception - center the single keyfrme */ + float xwidth = BLI_rctf_size_x(&v2d->cur); - extra = 0.1f * BLI_rctf_size_x(&v2d->cur); - v2d->cur.xmin -= extra; - v2d->cur.xmax += extra; + v2d->cur.xmin = min - xwidth / 2.0f; + v2d->cur.xmax = max + xwidth / 2.0f; + } + else { + /* Normal case - stretch the two keyframes out to fill the space, with extra spacing */ + v2d->cur.xmin = min; + v2d->cur.xmax = max; + + extra = 0.125f * BLI_rctf_size_x(&v2d->cur); + v2d->cur.xmin -= extra; + v2d->cur.xmax += extra; + } /* set vertical range */ if (only_sel == false) { @@ -674,6 +684,7 @@ static void insert_action_keys(bAnimContext *ac, short mode) bAnimListElem *ale; int filter; + struct Depsgraph *depsgraph = ac->depsgraph; ReportList *reports = ac->reports; Scene *scene = ac->scene; ToolSettings *ts = scene->toolsettings; @@ -708,7 +719,7 @@ static void insert_action_keys(bAnimContext *ac, short mode) * (TODO: add the full-blown PointerRNA relative parsing case here...) */ if (ale->id && !ale->owner) { - insert_keyframe(ac->bmain, reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), + insert_keyframe(ac->bmain, depsgraph, reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag); } else { |