Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How can I change default animation curve from ease in/out to linear?

Discussion in 'Timeline' started by newguy123, Sep 9, 2020.

  1. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,234
    Hi Guys

    When animating objects in timeline, how can I set the default curve to be linear instead of ease in/out? I know I can adjust it afterwards, but if I could adjust it to be like I need from the beginning, it would save a lot of back and forth with the curves.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Unfortunately ease in/out is a hard-coded default.
     
  3. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,234
    That's a little silly!

    Can we upvote somewhere so we can get it as a future feature to change the defaults?
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Bugs can upvoted in the issue tracker. (https://issuetracker.unity3d.com/), but since this can be considered a feature request, this the best place to post it. It gives the timeline the most visibility.

    Can you provide your use case? No promises that it can or will be implemented anytime soon, but a clear reason why the feature is important always helps prioritize it.
     
  5. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,234
    Most of what we do require things to be already in motion when it comes into shot, or leaving the shot.

    For example if a car drives from point A to B, we just need it to drive into shot and out of shot in a linear way. You can't have things easy in out in these situations.

    Also, for a lot of things for simple camera moves, instead of using Cinemachine, we simply want to pan or dolly the cam across a room. Its quicker to just animate the cam manually in these simple situations than using cinemachine.

    1st sign of an amateur is when you have 5 shots covering different rooms, and with each shot the cam has an ease in/out. It looks terrible!

    3ds Max for example have various presets which you can adjust any time, before animation anything, so your defaults can be set as intended, instead of going afterwards and adjusting.

    The preset defaults in Max:
    upload_2020-9-9_16-2-59.png

    There's a lot more here than what we typically need, but for Unity I'd say as a start, we should be able to simply switch between at least 2 presets: Easy in/out as 1, and linear as another
     
    CyRaid likes this.
  6. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Great! Thank you, that's excellent feedback.
     
    jmcusack and newguy123 like this.
  7. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,234
    Hi @seant_unity has any improvements been done in this regard yet? If not, could you give us a rough ETA please?
     
  8. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Unfortunately there hasn't been any work to address this and there is nothing planned in the near term to address it.

    Timeline 1.4 does have 'actions', which allows you add custom commands to the menu, including keyboard shortcuts. For example, here's a script for an action you can drop in that would change all blends to linear on selected clips and tracks, either via the menu, or using the a keypress of 'B'.

    It's not exactly the fix you are looking for (changing defaults), but hopefully it helps.

    Code (CSharp):
    1. using System.Linq;
    2. using UnityEditor.Timeline;
    3. using UnityEngine;
    4. using UnityEditor.Timeline.Actions;
    5. using UnityEngine.Timeline;
    6.  
    7.  
    8. [ApplyDefaultUndo]
    9. [MenuEntry("Blends/Set To Linear", MenuPriority.TimelineActionSection.matchContent + 1)]
    10. public class BlendsToLinearAction : TimelineAction
    11. {
    12.     public override ActionValidity Validate(ActionContext context)
    13.     {
    14.         if (context.clips.Any())
    15.             return ActionValidity.Valid;
    16.  
    17.         // a selected track with a clip
    18.         if (context.tracks.Any(t => t.GetClips().Any()))
    19.             return ActionValidity.Valid;
    20.  
    21.         // grey out the menu
    22.         return ActionValidity.Invalid;
    23.     }
    24.  
    25.     public override bool Execute(ActionContext context)
    26.     {
    27.         foreach (var t in context.tracks)
    28.         {
    29.             foreach (var c in t.GetClips())
    30.             {
    31.                 c.blendInCurveMode = TimelineClip.BlendCurveMode.Manual;
    32.                 c.blendOutCurveMode = TimelineClip.BlendCurveMode.Manual;
    33.                 c.mixInCurve = AnimationCurve.Linear(0,0,1,1);
    34.                 c.mixOutCurve = AnimationCurve.Linear(0, 1, 1, 0);
    35.             }
    36.         }
    37.  
    38.         foreach (var c in context.clips)
    39.         {
    40.             c.blendInCurveMode = TimelineClip.BlendCurveMode.Manual;
    41.             c.blendOutCurveMode = TimelineClip.BlendCurveMode.Manual;
    42.             c.mixInCurve = AnimationCurve.Linear(1,1, 0,0);
    43.             c.mixOutCurve = AnimationCurve.Linear(0, 1, 1, 0);
    44.         }
    45.  
    46.         TimelineEditor.Refresh(RefreshReason.ContentsModified);
    47.  
    48.         return true;
    49.     }
    50.  
    51.     [TimelineShortcut("BlendsToLinearAction", KeyCode.B)]
    52.     static void KeyPress()
    53.     {
    54.         Invoker.InvokeWithSelected<BlendsToLinearAction>();
    55.     }
    56. }
    57.  
     
    newguy123 likes this.
  9. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,234
    That will work for now, thanks!
     
  10. CyRaid

    CyRaid

    Joined:
    Mar 31, 2015
    Posts:
    134
    Is there a way to set a curve from a button? Like, ease-to / ease-from in the animation clip window?
     
    roborodo likes this.