Various improvements

This commit is contained in:
Wojtek Figat
2023-04-29 12:11:17 +02:00
parent 896f75b789
commit 5a2831d0cb
6 changed files with 27 additions and 21 deletions

View File

@@ -88,6 +88,15 @@ namespace FlaxEditor.Content
/// <inheritdoc />
public override ContentItemType ItemType => ContentItemType.Asset;
/// <summary>
/// Loads the asset.
/// </summary>
/// <returns>The asset object.</returns>
public Asset LoadAsync()
{
return FlaxEngine.Content.LoadAsync<BinaryAsset>(ID);
}
/// <summary>
/// Determines whether asset is of the specified type (included inheritance checks).
/// </summary>

View File

@@ -206,6 +206,11 @@ namespace FlaxEditor.GUI
/// </summary>
public event Action SelectedItemChanged;
/// <summary>
/// The custom callback for assets validation. Cane be used to implement a rule for assets to pick.
/// </summary>
public Func<ContentItem, bool> CheckValid;
/// <summary>
/// False if changing selected item is disabled.
/// </summary>
@@ -215,6 +220,8 @@ namespace FlaxEditor.GUI
{
if (_fileExtension != null && !item.Path.EndsWith(_fileExtension))
return false;
if (CheckValid != null && !CheckValid(item))
return false;
if (_type == ScriptType.Null)
return true;

View File

@@ -336,10 +336,6 @@ void AnimGraphExecutor::Update(AnimGraphInstanceData& data, float dt)
//value.Orientation.Normalize();
targetNodes[i] = value;
}
else
{
int a = 10;
}
}
}

View File

@@ -26,10 +26,10 @@ public:
{
static const Upgrader upgraders[] =
{
{ 24, 25, &Upgrade_With_Repack },
{ 23, 24, &Upgrade_22OrNewer_To_Newest },
{ 22, 24, &Upgrade_22OrNewer_To_Newest },
{ 1, 24, &Upgrade_Old_To_Newest },
{ 24, 25, &Upgrade_With_Repack }, // [Deprecated on 28.04.2023, expires on 01.01.2024]
{ 23, 24, &Upgrade_22OrNewer_To_Newest }, // [Deprecated on 28.04.2023, expires on 01.01.2024]
{ 22, 24, &Upgrade_22OrNewer_To_Newest }, // [Deprecated on 28.04.2023, expires on 01.01.2024]
{ 1, 24, &Upgrade_Old_To_Newest }, // [Deprecated on 28.04.2023, expires on 01.01.2024]
};
setup(upgraders, ARRAY_COUNT(upgraders));
}

View File

@@ -193,14 +193,11 @@ public:
ReadInt32(&count);
data.Clear();
data.EnsureCapacity(count);
if (count > 0)
for (int32 i = 0; i < count; i++)
{
for (int32 i = 0; i < count; i++)
{
KeyType key;
Read(key);
Read(data[key]);
}
KeyType key;
Read(key);
Read(data[key]);
}
}

View File

@@ -199,13 +199,10 @@ public:
{
const int32 count = data.Count();
WriteInt32(count);
if (count > 0)
for (const auto& e : data)
{
for (const auto& e : data)
{
Write(e.Key);
Write(e.Value);
}
Write(e.Key);
Write(e.Value);
}
}