///---------------------------------------------------------------------------------------------- ///Try add key at time, with identity value either from existing curves or in case of no curves, from current property value. public bool TryKeyIdentity(float time) { #if UNITY_EDITOR if (!HasAnyKey()) { SetKeyCurrent(time); return(true); } RecordUndo(); var keyAdded = false; var mode = parameterModel.ForceStepMode() ? TangentMode.Constant : Prefs.defaultTangentMode; for (var i = 0; i < curves.Length; i++) { if (CurveUtility.AddKey(curves[i], time, curves[i].Evaluate(time), mode)) { keyAdded = true; } } NotifyChange(); return(keyAdded); #else return(false); #endif }
///Sets a key on target at time with it's current property value public void SetKeyCurrent(float time) { #if UNITY_EDITOR RecordUndo(); var floats = GetCurrentValueAsFloats(); var mode = parameterModel.ForceStepMode() ? TangentMode.Constant : Prefs.defaultTangentMode; if (enabled) { for (var i = 0; i < curves.Length; i++) { CurveUtility.AddKey(curves[i], time, floats[i], mode); } } lastEval = floats; NotifyChange(); #endif }