@@ -824,29 +824,17 @@ private void RecalculateSelectionBounds()
824824 m_SelectionBoundsAreDirty = false ;
825825 }
826826
827- // Frame all curves to be visible.
828- public void FrameClip ( bool horizontally , bool vertically )
827+ public Bounds GetClipBounds ( )
829828 {
830- Bounds frameBounds = curveBounds ;
831- if ( frameBounds . size == Vector3 . zero )
832- return ;
833-
834- if ( horizontally )
835- SetShownHRangeInsideMargins ( frameBounds . min . x , frameBounds . max . x ) ;
836- if ( vertically )
837- SetShownVRangeInsideMargins ( frameBounds . min . y , frameBounds . max . y ) ;
829+ return curveBounds ;
838830 }
839831
840- // Frame selected keys to be visible.
841- public void FrameSelected ( bool horizontally , bool vertically )
832+ public Bounds GetSelectionBounds ( )
842833 {
843834 if ( ! hasSelection )
844- {
845- FrameClip ( horizontally , vertically ) ;
846- return ;
847- }
835+ return GetClipBounds ( ) ;
848836
849- Bounds frameBounds = new Bounds ( ) ;
837+ Bounds frameBounds ;
850838
851839 // Add neighboring keys in bounds if only a single key is selected.
852840 if ( selectedCurves . Count == 1 )
@@ -871,6 +859,26 @@ public void FrameSelected(bool horizontally, bool vertically)
871859 // Enforce minimum size of bounds
872860 frameBounds . size = new Vector3 ( Mathf . Max ( frameBounds . size . x , 0.1F ) , Mathf . Max ( frameBounds . size . y , 0.1F ) , 0 ) ;
873861
862+ return frameBounds ;
863+ }
864+
865+ // Frame all curves to be visible.
866+ public void FrameClip ( bool horizontally , bool vertically )
867+ {
868+ Frame ( GetClipBounds ( ) , horizontally , vertically ) ;
869+ }
870+
871+ // Frame selected keys to be visible.
872+ public void FrameSelected ( bool horizontally , bool vertically )
873+ {
874+ Frame ( GetSelectionBounds ( ) , horizontally , vertically ) ;
875+ }
876+
877+ public void Frame ( Bounds frameBounds , bool horizontally , bool vertically )
878+ {
879+ if ( frameBounds . size == Vector3 . zero )
880+ return ;
881+
874882 if ( horizontally )
875883 SetShownHRangeInsideMargins ( frameBounds . min . x , frameBounds . max . x ) ;
876884 if ( vertically )
@@ -983,15 +991,6 @@ public void CurveGUI()
983991 DeleteSelectedKeys ( ) ;
984992 evt . Use ( ) ;
985993 }
986-
987- // Frame All.
988- // Manually handle hotkey unless we decide to add it to default Unity hotkeys like
989- // we did for FrameSelected.
990- if ( evt . keyCode == KeyCode . A )
991- {
992- FrameClip ( true , true ) ;
993- evt . Use ( ) ;
994- }
995994 break ;
996995
997996 case EventType . ContextClick :
@@ -1988,6 +1987,9 @@ CurveSelection AddKeyAtTime(CurveWrapper cw, float time)
19881987 int keyIndex = AnimationUtility . AddInbetweenKey ( cw . curve , time ) ;
19891988 if ( keyIndex >= 0 )
19901989 {
1990+ CurveUtility . SetKeyModeFromContext ( cw . curve , keyIndex ) ;
1991+ AnimationUtility . UpdateTangentsFromModeSurrounding ( cw . curve , keyIndex ) ;
1992+
19911993 // Select the key
19921994 CurveSelection selectedPoint = new CurveSelection ( cw . id , keyIndex ) ;
19931995 cw . selected = CurveWrapper . SelectionMode . Selected ;
0 commit comments