fix: improve tweener editor

- fixed an issue in legacy versions of Unity where changes made using the seek bar were not immediately reflected on the screen
- fixed an issue where even disabled tweener objects could be controlled using the seek bar
This commit is contained in:
mob-sakai
2026-11-14 08:35:52 +09:00
parent af0ae7bdf7
commit 4a49e9a8b2
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -24,8 +24,8 @@ namespace Coffee.UIEffects.Editors
private static bool expandOthers private static bool expandOthers
{ {
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
get => UIEffectEditorSettings.instance.m_ExpandOthers; get => UIEffectEditorSettings.instance.m_ExpandOthers;
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
} }
protected override void OnEnable() protected override void OnEnable()
@@ -92,6 +92,7 @@ namespace Coffee.UIEffects.Editors
{ {
if (tweener == null) return; if (tweener == null) return;
EditorGUI.BeginDisabledGroup(!tweener.enabled);
EditorGUILayout.Space(4); EditorGUILayout.Space(4);
GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true)); GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true));
@@ -101,6 +102,7 @@ namespace Coffee.UIEffects.Editors
if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton")) if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton"))
{ {
ResetTime(); ResetTime();
EditorApplication.QueuePlayerLoopUpdate();
} }
var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height); var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height);
@@ -148,12 +150,15 @@ namespace Coffee.UIEffects.Editors
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
SetTime(time); SetTime(time);
EditorApplication.QueuePlayerLoopUpdate();
} }
if (Application.isPlaying && tweener.isActiveAndEnabled) if (Application.isPlaying && tweener.isActiveAndEnabled)
{ {
Repaint(); Repaint();
} }
EditorGUI.EndDisabledGroup();
} }
private static float DrawBackground(Rect r, float width, Color color) private static float DrawBackground(Rect r, float width, Color color)
@@ -168,6 +173,7 @@ namespace Coffee.UIEffects.Editors
{ {
foreach (var tweener in targets.OfType<UIEffectTweener>()) foreach (var tweener in targets.OfType<UIEffectTweener>())
{ {
if (!tweener.enabled) continue;
tweener.SetTime(time); tweener.SetTime(time);
} }
} }
@@ -176,6 +182,7 @@ namespace Coffee.UIEffects.Editors
{ {
foreach (var tweener in targets.OfType<UIEffectTweener>()) foreach (var tweener in targets.OfType<UIEffectTweener>())
{ {
if (!tweener.enabled) continue;
tweener.ResetTime(tweener.direction); tweener.ResetTime(tweener.direction);
} }
} }
@@ -210,6 +217,7 @@ namespace Coffee.UIEffects.Editors
_lastTime = EditorApplication.timeSinceStartup; _lastTime = EditorApplication.timeSinceStartup;
foreach (var tweener in targets.OfType<UIEffectTweener>()) foreach (var tweener in targets.OfType<UIEffectTweener>())
{ {
if (!tweener.enabled) continue;
tweener.UpdateTime(tweener.direction == UIEffectTweener.Direction.Forward ? delta : -delta); tweener.UpdateTime(tweener.direction == UIEffectTweener.Direction.Forward ? delta : -delta);
} }