protected virtual void OnGUICurve(ref Rect contentRect, Interpolator dummyInstance, AnimationCurveUtility.TangentMode mode = AnimationCurveUtility.TangentMode.Smooth)
        {
            if (null == dummyInstance)
            {
                return;
            }

            var count     = 100;
            var keyFrames = new Keyframe[count];

            for (int n = 0; n < count; ++n)
            {
                var t = n / (float)(count - 1);
                var k = new Keyframe(t, dummyInstance.Interpolate(t));
                keyFrames[n] = k;
            }

            var curve = new AnimationCurve(keyFrames);

            AnimationCurveUtility.SetLinear(ref curve, mode);

            contentRect.height = InterpolatorPropertyDrawer.heightCurve;
            EditorGUI.CurveField(contentRect, curve);
            contentRect.y += InterpolatorPropertyDrawer.heightCurve;
        }
        public void OnPreviewGUI(Color color, Rect rect, GUIStyle style, bool drawInfo, bool selectable, bool hovered, WindowLayoutElement selectedElement, System.Action <WindowLayoutElement> onSelection, List <WindowLayoutElement> highlighted)
        {
            const float sliderHeight = 20f;
            const float padding      = 40f;

            if (this.styles == null)
            {
                this.styles = new Styles();
            }

            var _target = this.target as TransitionInputTemplateParameters;

            if (_target == null)
            {
                return;
            }

            this.changed = false;

            if (drawInfo == true)
            {
                var sliderRect = new Rect(rect.x + padding, rect.y, rect.width - padding * 2f, sliderHeight);
                rect.y      += sliderHeight;
                rect.height -= sliderHeight;

                var newValue = GUI.HorizontalSlider(sliderRect, this.sliderPosition, 0f, 1f);
                if (newValue != this.sliderPosition)
                {
                    this.changed = true;
                }
                this.sliderPosition = newValue;
            }
            else
            {
                this.changed = true;
                this.hovered = hovered;
            }

            var _targetVideo = this.target as TransitionVideoInputTemplateParameters;

            if (_targetVideo != null)
            {
                if (this.targetTexture != null)
                {
                    GUI.DrawTexture(rect, this.targetTexture);
                }
            }

            var _targetAudio = this.target as TransitionAudioInputTemplateParameters;

            if (_targetAudio != null)
            {
                var pars     = _target.GetParameters <TransitionBase.ParametersAudioBase>();
                var oldEvent = new Event(Event.current);
                //Event.current.Use();
                this.audioCurveIn = new AnimationCurve();
                for (float t = 0f; t <= pars.inDuration + 0.01f; t += 0.05f)
                {
                    var value = pars.GetVolumeValueIn(t);
                    var key   = new Keyframe(t, value);
                    this.audioCurveIn.AddKey(key);
                }

                this.audioCurveOut = new AnimationCurve();
                for (float t = 0f; t <= pars.outDuration + 0.01f; t += 0.05f)
                {
                    var value = pars.GetVolumeValueOut(t);
                    var key   = new Keyframe(t, value);
                    this.audioCurveOut.AddKey(key);
                }

                AnimationCurveUtility.SetLinear(ref this.audioCurveIn);
                AnimationCurveUtility.SetLinear(ref this.audioCurveOut);

                this.audioCurveIn.postWrapMode = WrapMode.Clamp;
                this.audioCurveIn.preWrapMode  = WrapMode.Clamp;

                this.audioCurveOut.postWrapMode = WrapMode.Clamp;
                this.audioCurveOut.preWrapMode  = WrapMode.Clamp;

                {
                    if (Event.current.type == EventType.MouseDown)
                    {
                        Event.current.type = EventType.Repaint;
                    }
                    EditorGUI.CurveField(new Rect(rect.x, rect.y, rect.width, rect.height * 0.5f), string.Empty, this.audioCurveIn, Color.red, new Rect(0f, 0f, pars.inDuration, 1f));
                    EditorGUI.CurveField(new Rect(rect.x, rect.y + rect.height * 0.5f, rect.width, rect.height * 0.5f), string.Empty, this.audioCurveOut, Color.cyan, new Rect(0f, 0f, pars.outDuration, 1f));

                    if (this.sliderPosition > 0f)
                    {
                        GUI.Box(new Rect(rect.x + (this.sliderPosition * rect.width), rect.y, 3f, rect.height * 0.5f), string.Empty);
                        GUI.Box(new Rect(rect.x + (this.sliderPosition * rect.width), rect.y + rect.height * 0.5f, 3f, rect.height * 0.5f), string.Empty);
                    }

                    EditorGUI.DropShadowLabel(new Rect(rect.x, rect.y, rect.width, rect.height * 0.5f), "In");
                    EditorGUI.DropShadowLabel(new Rect(rect.x, rect.y + rect.height * 0.5f, rect.width, rect.height * 0.5f), "Out");
                }
                Event.current = oldEvent;
            }
        }