Merge branch 'Tryibion-animevent-abswrapper-remove'

This commit is contained in:
Wojtek Figat
2023-08-27 16:36:45 +02:00
2 changed files with 13 additions and 3 deletions

View File

@@ -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 || type.HasAttribute(typeof(HideInEditorAttribute), true))
continue;
var add = new ScriptType(typeof(AnimContinuousEvent)).IsAssignableFrom(type) ? addContinuousEvent : addEvent;
var b = add.ContextMenu.AddButton(type.Name);
@@ -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;
}

View File

@@ -23,6 +23,7 @@ namespace FlaxEditor.Windows.Assets
private readonly Undo _undo;
private object _object;
private bool _isRegisteredForScriptsReload;
private Label _typeText;
/// <summary>
/// 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();
}