Merge remote-tracking branch 'origin/master' into 1.8

This commit is contained in:
Wojtek Figat
2024-02-07 09:40:45 +01:00
64 changed files with 1445 additions and 350 deletions

View File

@@ -18,7 +18,7 @@ namespace FlaxEditor.Content.Settings
/// <summary>
/// The layers names.
/// </summary>
[EditorOrder(10), EditorDisplay("Layers", EditorDisplayAttribute.InlineStyle), Collection(ReadOnly = true)]
[EditorOrder(10), EditorDisplay("Layers", EditorDisplayAttribute.InlineStyle), Collection(ReadOnly = true, Display = CollectionAttribute.DisplayType.Inline)]
public string[] Layers = new string[32];
/// <summary>

View File

@@ -56,13 +56,7 @@ using System.Runtime.InteropServices;
namespace FlaxEngine
{
/// <summary>
/// Represents a 3x3 Matrix ( contains only Scale and Rotation ).
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 4)]
// ReSharper disable once InconsistentNaming
public struct Matrix3x3 : IEquatable<Matrix3x3>, IFormattable
partial struct Matrix3x3 : IEquatable<Matrix3x3>, IFormattable
{
/// <summary>
/// The size of the <see cref="Matrix3x3"/> type, in bytes.
@@ -135,9 +129,7 @@ namespace FlaxEngine
/// <param name="value">The value that will be assigned to all components.</param>
public Matrix3x3(float value)
{
M11 = M12 = M13 =
M21 = M22 = M23 =
M31 = M32 = M33 = value;
M11 = M12 = M13 = M21 = M22 = M23 = M31 = M32 = M33 = value;
}
/// <summary>

View File

@@ -9,8 +9,9 @@
/// <summary>
/// Represents a 3x3 mathematical matrix.
/// </summary>
API_STRUCT(InBuild) struct FLAXENGINE_API Matrix3x3
API_STRUCT() struct FLAXENGINE_API Matrix3x3
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Matrix3x3);
public:
union
{

View File

@@ -139,6 +139,24 @@ VariantType::VariantType(const StringAnsiView& typeName)
return;
}
}
{
// Aliases
if (typeName == "FlaxEngine.Vector2")
{
new(this) VariantType(Vector2);
return;
}
if (typeName == "FlaxEngine.Vector3")
{
new(this) VariantType(Vector3);
return;
}
if (typeName == "FlaxEngine.Vector4")
{
new(this) VariantType(Vector4);
return;
}
}
// Check case for array
if (typeName.EndsWith(StringAnsiView("[]"), StringSearchCase::CaseSensitive))
@@ -3985,15 +4003,32 @@ void Variant::CopyStructure(void* src)
{
if (AsBlob.Data && src)
{
const ScriptingTypeHandle typeHandle = Scripting::FindScriptingType(StringAnsiView(Type.TypeName));
const StringAnsiView typeName(Type.TypeName);
const ScriptingTypeHandle typeHandle = Scripting::FindScriptingType(typeName);
if (typeHandle)
{
auto& type = typeHandle.GetType();
type.Struct.Copy(AsBlob.Data, src);
}
#if USE_CSHARP
else if (const auto mclass = Scripting::FindClass(typeName))
{
// Fallback to C#-only types
MCore::Thread::Attach();
if (MANAGED_GC_HANDLE && mclass->IsValueType())
{
MObject* instance = MCore::GCHandle::GetTarget(MANAGED_GC_HANDLE);
void* data = MCore::Object::Unbox(instance);
Platform::MemoryCopy(data, src, mclass->GetInstanceSize());
}
}
#endif
else
{
Platform::MemoryCopy(AsBlob.Data, src, AsBlob.Length);
if (typeName.Length() != 0)
{
LOG(Warning, "Missing scripting type \'{0}\'", String(typeName));
}
}
}
}