Merge remote-tracking branch 'origin/master' into 1.11
# Conflicts: # Content/Editor/DebugMaterials/DDGIDebugProbes.flax # Source/Engine/Scripting/Scripting.cpp
This commit is contained in:
@@ -32,13 +32,53 @@ namespace FlaxEngine
|
||||
/// <summary>
|
||||
/// Determines whether the specified layer is set in the mask.
|
||||
/// </summary>
|
||||
/// <param name="layerName">Name of the layer (from layers settings).</param>
|
||||
/// <param name="layerName">Name of the layer (from Layers settings).</param>
|
||||
/// <returns><c>true</c> if the specified layer is set; otherwise, <c>false</c>.</returns>
|
||||
public bool HasLayer(string layerName)
|
||||
{
|
||||
return HasLayer(Level.GetLayerIndex(layerName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a layer mask based on a specific layer names.
|
||||
/// </summary>
|
||||
/// <param name="layerNames">The names of the layers (from Layers settings).</param>
|
||||
/// <returns>A layer mask with the mask set to the layers found. Returns a mask with 0 if not found.</returns>
|
||||
public static LayersMask GetMask(params string[] layerNames)
|
||||
{
|
||||
LayersMask mask = new LayersMask();
|
||||
foreach (var layerName in layerNames)
|
||||
{
|
||||
// Ignore blank entries
|
||||
if (string.IsNullOrEmpty(layerName))
|
||||
continue;
|
||||
int index = Level.GetLayerIndex(layerName);
|
||||
if (index != -1)
|
||||
mask.Mask |= (uint)(1 << index);
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the layer index based on the layer name.
|
||||
/// </summary>
|
||||
/// <param name="layerName">The name of the layer.</param>
|
||||
/// <returns>The index if found, otherwise, returns -1.</returns>
|
||||
public static int GetLayerIndex(string layerName)
|
||||
{
|
||||
return Level.GetLayerIndex(layerName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the layer name based on the layer index.
|
||||
/// </summary>
|
||||
/// <param name="layerIndex">The index of the layer.</param>
|
||||
/// <returns>The name of the layer if found, otherwise, a blank string.</returns>
|
||||
public static string GetLayerName(int layerIndex)
|
||||
{
|
||||
return Level.GetLayerName(layerIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds two masks.
|
||||
/// </summary>
|
||||
|
||||
@@ -27,13 +27,30 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified layer index is set in the mask.
|
||||
/// </summary>
|
||||
/// <param name="layerIndex">Index of the layer (zero-based).</param>
|
||||
/// <returns><c>true</c> if the specified layer is set; otherwise, <c>false</c>.</returns>
|
||||
FORCE_INLINE bool HasLayer(int32 layerIndex) const
|
||||
{
|
||||
return (Mask & (1 << layerIndex)) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified layer name is set in the mask.
|
||||
/// </summary>
|
||||
/// <param name="layerName">Name of the layer (from Layers settings).</param>
|
||||
/// <returns><c>true</c> if the specified layer is set; otherwise, <c>false</c>.</returns>
|
||||
bool HasLayer(const StringView& layerName) const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a layers mask from a specific layer name.
|
||||
/// </summary>
|
||||
/// <param name="layerNames">The names of the layers (from Layers settings).</param>
|
||||
/// <returns>A layers mask with the Mask set to the same Mask as the layer name passed in. Returns a LayersMask with a mask of 0 if no layer found.</returns>
|
||||
static LayersMask GetMask(Span<StringView> layerNames);
|
||||
|
||||
operator uint32() const
|
||||
{
|
||||
return Mask;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "StringView.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
|
||||
String String::Empty;
|
||||
const String String::Empty;
|
||||
|
||||
String::String(const StringAnsi& str)
|
||||
{
|
||||
|
||||
@@ -548,7 +548,7 @@ public:
|
||||
/// <summary>
|
||||
/// Instance of the empty string.
|
||||
/// </summary>
|
||||
static String Empty;
|
||||
static const String Empty;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
|
||||
@@ -9,7 +9,7 @@ StringView StringBuilder::ToStringView() const
|
||||
return StringView(_data.Get(), _data.Count());
|
||||
}
|
||||
|
||||
StringView StringView::Empty;
|
||||
const StringView StringView::Empty;
|
||||
|
||||
StringView::StringView(const String& str)
|
||||
: StringViewBase<Char>(str.Get(), str.Length())
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
/// <summary>
|
||||
/// Instance of the empty string.
|
||||
/// </summary>
|
||||
static StringView Empty;
|
||||
static const StringView Empty;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user