Fix texture refs in platform settings to be SoftObjectReferences instead of raw Guid

This commit is contained in:
Wojtek Figat
2021-11-09 23:52:46 +01:00
parent c1e3db9d1d
commit 35969dfd85
5 changed files with 50 additions and 24 deletions

View File

@@ -3,6 +3,7 @@
#pragma once
#include "Engine/Core/Common.h"
#include "Engine/Scripting/SoftObjectReference.h"
enum class PixelFormat : unsigned;
enum class DirectorySearchOption;
@@ -34,6 +35,19 @@ public:
static bool ExportApplicationImage(const Guid& iconId, int32 width, int32 height, PixelFormat format, const String& path, ApplicationImageType type = ApplicationImageType::Icon);
static bool ExportApplicationImage(const TextureData& icon, int32 width, int32 height, PixelFormat format, const String& path);
template<typename T>
static bool GetApplicationImage(const SoftObjectReference<T>& image, TextureData& imageData, ApplicationImageType type = ApplicationImageType::Icon)
{
const Guid imageId = image.GetID();
return GetApplicationImage(imageId, imageData, type);
}
template<typename T>
static bool ExportApplicationImage(const SoftObjectReference<T>& icon, int32 width, int32 height, PixelFormat format, const String& path, ApplicationImageType type = ApplicationImageType::Icon)
{
const Guid iconId = icon.GetID();
return ExportApplicationImage(iconId, width, height, format, path, type);
}
public:
static bool FindWDKBin(String& outputWdkBinPath);

View File

@@ -5,6 +5,9 @@
#if PLATFORM_ANDROID || USE_EDITOR
#include "Engine/Core/Config/PlatformSettingsBase.h"
#include "Engine/Scripting/SoftObjectReference.h"
class Texture;
/// <summary>
/// Android platform settings.
@@ -27,10 +30,10 @@ public:
Array<String> Permissions;
/// <summary>
/// Custom icon texture (asset id) to use for the application (overrides the default one).
/// Custom icon texture to use for the application (overrides the default one).
/// </summary>
API_FIELD(Attributes="EditorOrder(1030), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Other\")")
Guid OverrideIcon;
API_FIELD(Attributes="EditorOrder(1030), EditorDisplay(\"Other\")")
SoftObjectReference<Texture> OverrideIcon;
public:

View File

@@ -6,6 +6,9 @@
#include "Engine/Core/Config/PlatformSettingsBase.h"
#include "Engine/Core/Math/Color.h"
#include "Engine/Scripting/SoftObjectReference.h"
class Texture;
/// <summary>
/// GDK platform settings.
@@ -28,34 +31,34 @@ public:
String PublisherDisplayName;
/// <summary>
/// Application small logo texture of size 150x150 px (asset id).
/// Application small logo texture of size 150x150 px.
/// </summary>
API_FIELD(Attributes="EditorOrder(200), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Visuals\")")
Guid Square150x150Logo;
API_FIELD(Attributes="EditorOrder(200), EditorDisplay(\"Visuals\")")
SoftObjectReference<Texture> Square150x150Logo;
/// <summary>
/// Application large logo texture of size 480x480 px (asset id).
/// Application large logo texture of size 480x480 px.
/// </summary>
API_FIELD(Attributes="EditorOrder(205), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Visuals\")")
Guid Square480x480Logo;
API_FIELD(Attributes="EditorOrder(205), EditorDisplay(\"Visuals\")")
SoftObjectReference<Texture> Square480x480Logo;
/// <summary>
/// Application small logo texture of size 44x44 px (asset id).
/// Application small logo texture of size 44x44 px.
/// </summary>
API_FIELD(Attributes="EditorOrder(210), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Visuals\")")
Guid Square44x44Logo;
API_FIELD(Attributes="EditorOrder(210), EditorDisplay(\"Visuals\")")
SoftObjectReference<Texture> Square44x44Logo;
/// <summary>
/// Application splash screen texture (asset id).
/// Application splash screen texture.
/// </summary>
API_FIELD(Attributes="EditorOrder(220), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Visuals\")")
Guid SplashScreenImage;
API_FIELD(Attributes="EditorOrder(220), EditorDisplay(\"Visuals\")")
SoftObjectReference<Texture> SplashScreenImage;
/// <summary>
/// Application store logo texture (asset id).
/// Application store logo texture.
/// </summary>
API_FIELD(Attributes="EditorOrder(230), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Visuals\")")
Guid StoreLogo;
API_FIELD(Attributes="EditorOrder(230), EditorDisplay(\"Visuals\")")
SoftObjectReference<Texture> StoreLogo;
/// <summary>
/// Application background color.

View File

@@ -5,6 +5,9 @@
#if PLATFORM_LINUX || USE_EDITOR
#include "Engine/Core/Config/PlatformSettingsBase.h"
#include "Engine/Scripting/SoftObjectReference.h"
class Texture;
/// <summary>
/// Linux platform settings.
@@ -51,10 +54,10 @@ public:
bool ForceSingleInstance = false;
/// <summary>
/// Custom icon texture (asset id) to use for the application (overrides the default one).
/// Custom icon texture to use for the application (overrides the default one).
/// </summary>
API_FIELD(Attributes="EditorOrder(1030), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Other\")")
Guid OverrideIcon;
API_FIELD(Attributes="EditorOrder(1030), EditorDisplay(\"Other\")")
SoftObjectReference<Texture> OverrideIcon;
/// <summary>
/// Enables support for Vulkan. Disabling it reduces compiled shaders count.

View File

@@ -5,6 +5,9 @@
#if PLATFORM_WINDOWS || USE_EDITOR
#include "Engine/Core/Config/PlatformSettingsBase.h"
#include "Engine/Scripting/SoftObjectReference.h"
class Texture;
/// <summary>
/// Windows platform settings.
@@ -51,10 +54,10 @@ public:
bool ForceSingleInstance = false;
/// <summary>
/// Custom icon texture (asset id) to use for the application (overrides the default one).
/// Custom icon texture to use for the application (overrides the default one).
/// </summary>
API_FIELD(Attributes="EditorOrder(1030), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.AssetRefEditor\"), AssetReference(typeof(Texture)), EditorDisplay(\"Other\")")
Guid OverrideIcon;
API_FIELD(Attributes="EditorOrder(1030), EditorDisplay(\"Other\")")
SoftObjectReference<Texture> OverrideIcon;
/// <summary>
/// Enables support for DirectX 12. Disabling it reduces compiled shaders count.