public void Copy(AnimationDataObject _data) { base.Copy(_data); AllowInterfaceSelector = _data.AllowInterfaceSelector; InterfaceType = _data.InterfaceType; Animator.Copy(_data.Animator); Animation.Copy(_data.Animation); Clip.Copy(_data.Clip); Events.Copy(_data.Events); }
public AnimationClip ConvertRecording() { //Check if a converison method is set if (_frameToKeyFrameMethod == null) { Debug.Log(LogLevel.Warning, "No conversion method set"); return null; } //make a copy of the active clip var newClip = Clip.Copy(); //Clamp Interval if (FrameInterval >= (_recording.Frames)) FrameInterval = _recording.Frames - 1; var div = _recording.Frames/FrameInterval; var tickInterval = newClip.Duration / div; //In the end Tick == Duration var tick = -tickInterval; //Go through all the frames for (var i = 0; i < _recording.Frames; ++i) { if (i % FrameInterval != 0) continue; //Create a keyFrame var frame = _recording.GetFrame(i); var keyFrame = _frameToKeyFrameMethod(frame); tick += tickInterval; keyFrame.Tick = tick; newClip.Keys.Add(keyFrame); } //New animation clip is created return newClip; }