This commit is contained in:
Wojtek Figat
2021-10-05 15:58:45 +02:00
parent 590c75f4cb
commit 77f2bd5115
4 changed files with 28 additions and 6 deletions

View File

@@ -1040,6 +1040,8 @@ bool CookAssetsStep::Perform(CookingData& data)
auto minDateTime = DateTime::MinValue(); auto minDateTime = DateTime::MinValue();
#endif #endif
int32 subStepIndex = 0; int32 subStepIndex = 0;
AssetReference<Asset> assetRef;
assetRef.Unload.Bind([]() { LOG(Error, "Asset gets unloaded while cooking it!"); Platform::Sleep(100); });
for (auto i = data.Assets.Begin(); i.IsNotEnd(); ++i) for (auto i = data.Assets.Begin(); i.IsNotEnd(); ++i)
{ {
BUILD_STEP_CANCEL_CHECK; BUILD_STEP_CANCEL_CHECK;
@@ -1097,16 +1099,16 @@ bool CookAssetsStep::Perform(CookingData& data)
} }
// Load asset (and keep ref) // Load asset (and keep ref)
AssetReference<Asset> ref = Content::LoadAsync<Asset>(assetId); assetRef = Content::LoadAsync<Asset>(assetId);
if (ref == nullptr) if (assetRef == nullptr)
{ {
data.Error(TEXT("Failed to load asset included in build.")); data.Error(TEXT("Failed to load asset included in build."));
return true; return true;
} }
e.Info.TypeName = ref->GetTypeName(); e.Info.TypeName = assetRef->GetTypeName();
// Cook asset // Cook asset
if (Process(data, cache, ref.Get())) if (Process(data, cache, assetRef.Get()))
return true; return true;
data.Stats.CookedAssets++; data.Stats.CookedAssets++;

View File

@@ -100,7 +100,9 @@ namespace FlaxEditor.GUI.Docking
// Check if window won't be docked // Check if window won't be docked
if (_toSet == DockState.Float) if (_toSet == DockState.Float)
{ {
var window = _toMove.Window.Window; var window = _toMove.Window?.Window;
if (window == null)
return;
Vector2 mouse = FlaxEngine.Input.MouseScreenPosition; Vector2 mouse = FlaxEngine.Input.MouseScreenPosition;
// Move base window // Move base window

View File

@@ -181,7 +181,7 @@ namespace Flax.Build.Platforms
case TargetArchitecture.ARM64: return "aarch64-unknown-linux-gnueabi"; case TargetArchitecture.ARM64: return "aarch64-unknown-linux-gnueabi";
default: throw new InvalidArchitectureException(architecture); default: throw new InvalidArchitectureException(architecture);
} }
case TargetPlatform.PS4: return "orbis"; case TargetPlatform.PS4: return (string)Utilities.GetStaticValue("Flax.Build.Platforms.PS4Toolchain", "ToolchainName");
case TargetPlatform.Android: case TargetPlatform.Android:
switch (architecture) switch (architecture)
{ {

View File

@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
namespace Flax.Build namespace Flax.Build
@@ -43,6 +44,23 @@ namespace Flax.Build
return Enumerable.Empty<T>() as T[]; return Enumerable.Empty<T>() as T[];
} }
/// <summary>
/// Gets the static field value from a given type.
/// </summary>
/// <param name="typeName">Name of the type.</param>
/// <param name="fieldName">Name of the field.</param>
/// <returns>The field value.</returns>
public static object GetStaticValue(string typeName, string fieldName)
{
var type = Type.GetType(typeName);
if (type == null)
throw new Exception($"Cannot find type \'{typeName}\'.");
var field = type.GetField(fieldName, BindingFlags.Public | BindingFlags.Static);
if (field == null)
throw new Exception($"Cannot find static public field \'{fieldName}\' in \'{typeName}\'.");
return field.GetValue(null);
}
/// <summary> /// <summary>
/// Gets the size of the file as a readable string. /// Gets the size of the file as a readable string.
/// </summary> /// </summary>