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

# Conflicts:
#	Flax.flaxproj
This commit is contained in:
Wojtek Figat
2024-02-26 19:49:39 +01:00
2740 changed files with 5217 additions and 3615 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "../Game.h"

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "CommandLine.h"
#include "Engine/Core/Collections/Array.h"

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;
using System.Diagnostics;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;
using System.Diagnostics;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System.IO;
using Flax.Build;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "Engine.h"
#include "Game.h"
@@ -241,6 +241,8 @@ void Engine::Exit(int32 exitCode)
void Engine::RequestExit(int32 exitCode)
{
if (Globals::IsRequestingExit)
return;
#if USE_EDITOR
// Send to editor (will leave play mode if need to)
if (Editor::Managed->OnAppExit())

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "EngineService.h"
#include "Engine/Core/Log.h"

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "GameplayGlobals.h"
#include "Engine/Core/Log.h"

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "Globals.h"
#include "Engine/Core/Types/String.h"

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
namespace FlaxEngine
{

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if PLATFORM_LINUX && !USE_EDITOR

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;
using System.Runtime.CompilerServices;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if PLATFORM_MAC && !USE_EDITOR

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if USE_NETCORE
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if USE_NETCORE
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if USE_NETCORE
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if USE_NETCORE
using System;
@@ -551,8 +551,16 @@ namespace FlaxEngine.Interop
internal static ManagedHandle NewObject(ManagedHandle typeHandle)
{
TypeHolder typeHolder = Unsafe.As<TypeHolder>(typeHandle.Target);
object value = typeHolder.CreateObject();
return ManagedHandle.Alloc(value);
try
{
object value = typeHolder.CreateObject();
return ManagedHandle.Alloc(value);
}
catch (Exception ex)
{
Debug.LogException(ex);
}
return new ManagedHandle();
}
[UnmanagedCallersOnly]

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if USE_NETCORE
@@ -130,12 +130,10 @@ namespace FlaxEngine.Interop
object obj = objectHandle.Target;
if (obj is not Object)
return;
{
ref IntPtr fieldRef = ref FieldHelper.GetReferenceTypeFieldReference<IntPtr>(unmanagedPtrFieldOffset, ref obj);
fieldRef = unmanagedPtr;
}
if (idPtr != IntPtr.Zero)
{
ref Guid nativeId = ref Unsafe.AsRef<Guid>(idPtr.ToPointer());
@@ -148,8 +146,16 @@ namespace FlaxEngine.Interop
internal static ManagedHandle ScriptingObjectCreate(ManagedHandle typeHandle, IntPtr unmanagedPtr, IntPtr idPtr)
{
TypeHolder typeHolder = Unsafe.As<TypeHolder>(typeHandle.Target);
object obj = typeHolder.CreateScriptingObject(unmanagedPtr, idPtr);
return ManagedHandle.Alloc(obj);
try
{
object obj = typeHolder.CreateScriptingObject(unmanagedPtr, idPtr);
return ManagedHandle.Alloc(obj);
}
catch (Exception ex)
{
Debug.LogException(ex);
}
return new ManagedHandle();
}
#endif
@@ -1462,7 +1468,6 @@ namespace FlaxEngine.Interop
ref IntPtr fieldRef = ref FieldHelper.GetReferenceTypeFieldReference<IntPtr>(unmanagedPtrFieldOffset, ref obj);
fieldRef = unmanagedPtr;
}
if (idPtr != IntPtr.Zero)
{
ref Guid nativeId = ref Unsafe.AsRef<Guid>(idPtr.ToPointer());
@@ -1470,12 +1475,10 @@ namespace FlaxEngine.Interop
fieldRef = nativeId;
}
}
if (ctor != null)
ctor.Invoke(obj, null);
else
Debug.LogException(new Exception($"Missing empty constructor in type '{wrappedType}'."));
throw new NativeInteropException($"Missing empty constructor in type '{wrappedType}'.");
return obj;
}
#endif
@@ -1676,6 +1679,8 @@ namespace FlaxEngine.Interop
/// </summary>
internal static ManagedHandle GetTypeManagedHandle(Type type)
{
if (type.IsInterface && type.IsGenericType)
type = type.GetGenericTypeDefinition(); // Generic type to use type definition handle
if (managedTypes.TryGetValue(type, out (TypeHolder typeHolder, ManagedHandle handle) tuple))
return tuple.handle;
#if FLAX_EDITOR

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System.Runtime.CompilerServices;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;
using System.Runtime.CompilerServices;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
using System;

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "Screen.h"
#include "Engine.h"

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#include "Time.h"
#include "EngineService.h"

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if PLATFORM_UWP && !USE_EDITOR

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#if PLATFORM_WINDOWS && !USE_EDITOR

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
#pragma once