From 0509fe10be481f0bf28b4b8c2c1e0e816c7aa1bf Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 28 Nov 2024 18:27:45 +0100 Subject: [PATCH] Add displaying whole curve in properties panel upon show --- .../Editor/CustomEditors/Dedicated/CurveObjectEditor.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs b/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs index 019148b07..065e78bf0 100644 --- a/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs @@ -11,6 +11,7 @@ namespace FlaxEditor.CustomEditors.Dedicated class BezierCurveObjectEditor : CustomEditor where T : struct { private bool _isSetting; + private int _firstTimeShow; private BezierCurveEditor _curve; /// @@ -20,6 +21,7 @@ namespace FlaxEditor.CustomEditors.Dedicated _curve = item.CustomControl; _curve.Height = 120.0f; _curve.Edited += OnCurveEdited; + _firstTimeShow = 4; // For some weird reason it needs several frames of warmup (probably due to sliders smoothing) } private void OnCurveEdited() @@ -44,6 +46,8 @@ namespace FlaxEditor.CustomEditors.Dedicated _curve.SetKeyframes(value.Keyframes); _isSetting = false; } + if (_firstTimeShow-- > 0) + _curve.ShowWholeCurve(); } /// @@ -111,6 +115,7 @@ namespace FlaxEditor.CustomEditors.Dedicated class LinearCurveObjectEditor : CustomEditor where T : struct { private bool _isSetting; + private int _firstTimeShow; private LinearCurveEditor _curve; /// @@ -120,6 +125,7 @@ namespace FlaxEditor.CustomEditors.Dedicated _curve = item.CustomControl; _curve.Height = 120.0f; _curve.Edited += OnCurveEdited; + _firstTimeShow = 4; // For some weird reason it needs several frames of warmup (probably due to sliders smoothing) } private void OnCurveEdited() @@ -144,6 +150,8 @@ namespace FlaxEditor.CustomEditors.Dedicated _curve.SetKeyframes(value.Keyframes); _isSetting = false; } + if (_firstTimeShow-- > 0) + _curve.ShowWholeCurve(); } ///