From e16e2e2877d2271c8a68e44ed96d9a7a81919d17 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 23 Aug 2023 08:35:35 -0500 Subject: [PATCH 1/4] Prevent AbstractWrapper from showing in Add AnimEvent CM. --- Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs index 4e78ca8ae..8f2909d2f 100644 --- a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs +++ b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs @@ -298,7 +298,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks var animEventTypes = Editor.Instance.CodeEditing.All.Get().Where(x => new ScriptType(typeof(AnimEvent)).IsAssignableFrom(x)); foreach (var type in animEventTypes) { - if (type.IsAbstract || !type.CanCreateInstance) + if (type.IsAbstract || !type.CanCreateInstance || string.Equals(type.TypeName, "FlaxEngine.AnimEvent+AbstractWrapper", StringComparison.Ordinal) || string.Equals(type.TypeName, "FlaxEngine.AnimContinuousEvent+AbstractWrapper", StringComparison.Ordinal)) continue; var add = new ScriptType(typeof(AnimContinuousEvent)).IsAssignableFrom(type) ? addContinuousEvent : addEvent; var b = add.ContextMenu.AddButton(type.Name); From e1645210b3de957ba30d492e4a499a0e19cd2a0e Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 23 Aug 2023 08:46:21 -0500 Subject: [PATCH 2/4] Add check and indication if no anim events are found. --- Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs index 8f2909d2f..359f589ec 100644 --- a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs +++ b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs @@ -307,6 +307,10 @@ namespace FlaxEditor.GUI.Timeline.Tracks b.Parent.Tag = time; b.ButtonClicked += OnAddAnimEvent; } + if (!addEvent.ContextMenu.Items.Any()) + addEvent.ContextMenu.AddButton("No Anim Events Found.").CloseMenuOnClick = false; + if (!addContinuousEvent.ContextMenu.Items.Any()) + addContinuousEvent.ContextMenu.AddButton("No Continuous Anim Events Found.").CloseMenuOnClick = false; } From 7e429854d6f0495c47333ca7c919f1ed91ee41e5 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 23 Aug 2023 09:03:56 -0500 Subject: [PATCH 3/4] Simplify check to use attribute. --- Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs index 359f589ec..6ebddb1d2 100644 --- a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs +++ b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs @@ -298,7 +298,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks var animEventTypes = Editor.Instance.CodeEditing.All.Get().Where(x => new ScriptType(typeof(AnimEvent)).IsAssignableFrom(x)); foreach (var type in animEventTypes) { - if (type.IsAbstract || !type.CanCreateInstance || string.Equals(type.TypeName, "FlaxEngine.AnimEvent+AbstractWrapper", StringComparison.Ordinal) || string.Equals(type.TypeName, "FlaxEngine.AnimContinuousEvent+AbstractWrapper", StringComparison.Ordinal)) + if (type.IsAbstract || !type.CanCreateInstance || type.HasAttribute(typeof(HideInEditorAttribute), true)) continue; var add = new ScriptType(typeof(AnimContinuousEvent)).IsAssignableFrom(type) ? addContinuousEvent : addEvent; var b = add.ContextMenu.AddButton(type.Name); From 3b163b6c4bd8b6823c4d21ccf25bdb17e96edf4b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 27 Aug 2023 16:36:37 +0200 Subject: [PATCH 4/4] Minor cleanup --- .../Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs | 4 ++-- Source/Editor/Windows/Assets/JsonAssetWindow.cs | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs index 6ebddb1d2..11a1bfe47 100644 --- a/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs +++ b/Source/Editor/GUI/Timeline/Tracks/AnimationEventTrack.cs @@ -308,9 +308,9 @@ namespace FlaxEditor.GUI.Timeline.Tracks b.ButtonClicked += OnAddAnimEvent; } if (!addEvent.ContextMenu.Items.Any()) - addEvent.ContextMenu.AddButton("No Anim Events Found.").CloseMenuOnClick = false; + addEvent.ContextMenu.AddButton("No Anim Events found").CloseMenuOnClick = false; if (!addContinuousEvent.ContextMenu.Items.Any()) - addContinuousEvent.ContextMenu.AddButton("No Continuous Anim Events Found.").CloseMenuOnClick = false; + addContinuousEvent.ContextMenu.AddButton("No Continuous Anim Events found").CloseMenuOnClick = false; } diff --git a/Source/Editor/Windows/Assets/JsonAssetWindow.cs b/Source/Editor/Windows/Assets/JsonAssetWindow.cs index abaaacc76..47ce09274 100644 --- a/Source/Editor/Windows/Assets/JsonAssetWindow.cs +++ b/Source/Editor/Windows/Assets/JsonAssetWindow.cs @@ -23,6 +23,7 @@ namespace FlaxEditor.Windows.Assets private readonly Undo _undo; private object _object; private bool _isRegisteredForScriptsReload; + private Label _typeText; /// /// Gets the instance of the Json asset object that is being edited. @@ -137,16 +138,20 @@ namespace FlaxEditor.Windows.Assets } _presenter.Select(_object); - var typeText = new Label + if (_typeText != null) + _typeText.Dispose(); + var typeText = new ClickableLabel { Text = $"{Asset.DataTypeName}", - TooltipText = "The Asset Type.", + TooltipText = "Asset data type (full name)", AnchorPreset = AnchorPresets.TopRight, AutoWidth = true, Parent = this, }; typeText.LocalX += -(typeText.Width + 4); typeText.LocalY += (_toolstrip.Height - typeText.Height) * 0.5f; + typeText.RightClick = () => Clipboard.Text = Asset.DataTypeName; + _typeText = typeText; _undo.Clear(); ClearEditedFlag(); @@ -187,6 +192,7 @@ namespace FlaxEditor.Windows.Assets _isRegisteredForScriptsReload = false; ScriptsBuilder.ScriptsReloadBegin -= OnScriptsReloadBegin; } + _typeText = null; base.OnDestroy(); }