Various improvements and fixes

This commit is contained in:
Wojtek Figat
2023-02-09 20:05:46 +01:00
parent 12cb8fd59d
commit 82823d6945
5 changed files with 26 additions and 6 deletions

View File

@@ -114,10 +114,8 @@ namespace FlaxEditor.Windows.Assets
public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
var result = base.OnDragMove(ref location, data);
if (result == DragDropEffect.None)
{
if (result == DragDropEffect.None && _dragHandlers != null)
result = _dragHandlers.Effect;
}
return result;
}

View File

@@ -1070,7 +1070,8 @@ bool findAsset(const Guid& id, const String& directory, Array<String>& tmpCache,
tmpCache.Clear();
if (FileSystem::DirectoryGetFiles(tmpCache, directory, TEXT("*"), DirectorySearchOption::AllDirectories))
{
LOG(Error, "Cannot query files in folder '{0}'.", directory);
if (FileSystem::DirectoryExists(directory))
LOG(Error, "Cannot query files in folder '{0}'.", directory);
return false;
}

View File

@@ -10,7 +10,10 @@ namespace FlaxEngine
/// </summary>
public static class RandomUtil
{
private static readonly Random _random = new Random();
/// <summary>
/// Random numbers generator.
/// </summary>
public static readonly Random Random = new Random();
/// <summary>
/// Generates a pseudo-random number from normalized range [0;1].
@@ -19,7 +22,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Rand()
{
return _random.Next(0, int.MaxValue) / (float)int.MaxValue;
return Random.Next(0, int.MaxValue) / (float)int.MaxValue;
}
}
}

View File

@@ -443,6 +443,19 @@ const String& Actor::GetLayerName() const
return Level::Layers[_layer];
}
void Actor::SetLayerName(const StringView& value)
{
for (int32 i = 0; i < 32; i++)
{
if (Level::Layers[i] == value)
{
SetLayer(i);
return;
}
}
LOG(Warning, "Unknown layer name '{0}'", value);
}
bool Actor::HasTag() const
{
return Tags.Count() != 0;

View File

@@ -107,6 +107,11 @@ public:
/// </summary>
API_PROPERTY() const String& GetLayerName() const;
/// <summary>
/// Sets the name of the layer.
/// </summary>
API_PROPERTY() void SetLayerName(const StringView& value);
/// <summary>
/// Determines whether this actor has any tag assigned.
/// </summary>