Merge branch 'main' into SpawnablePriorityQueue
@@ -125,7 +125,7 @@ enum ESystemConfigPlatform
|
||||
{
|
||||
CONFIG_INVALID_PLATFORM = 0,
|
||||
CONFIG_PC = 1,
|
||||
CONFIG_OSX_GL = 2,
|
||||
CONFIG_MAC = 2,
|
||||
CONFIG_OSX_METAL = 3,
|
||||
CONFIG_ANDROID = 4,
|
||||
CONFIG_IOS = 5,
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <IRenderer.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
@@ -84,7 +83,7 @@ public: // types
|
||||
//! If this is not passed then the defaults below are used
|
||||
struct TextOptions
|
||||
{
|
||||
IFFont* font; //!< default is "default"
|
||||
AZStd::string fontName; //!< default is "default"
|
||||
unsigned int effectIndex; //!< default is 0
|
||||
AZ::Vector3 color; //!< default is (1,1,1)
|
||||
HAlign horizontalAlignment; //!< default is HAlign::Left
|
||||
|
||||
@@ -729,7 +729,7 @@ protected: // -------------------------------------------------------------
|
||||
CCmdLine* m_pCmdLine;
|
||||
|
||||
string m_currentLanguageAudio;
|
||||
string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_es3.cfg or system_android_opengl.cfg or system_windows_pc.cfg
|
||||
string m_systemConfigName; // computed from system_(hardwareplatform)_(assetsPlatform) - eg, system_android_android.cfg or system_windows_pc.cfg
|
||||
|
||||
std::vector< std::pair<CTimeValue, float> > m_updateTimes;
|
||||
|
||||
|
||||
@@ -172,78 +172,10 @@ namespace AZ
|
||||
|
||||
//! Rotation modifiers
|
||||
//! @{
|
||||
//! @deprecated Use SetLocalRotation()
|
||||
//! Sets the entity's rotation in the world.
|
||||
//! The origin of the axes is the entity's position in world space.
|
||||
//! @param eulerAnglesRadians A three-dimensional vector, containing Euler angles in radians, to rotate the entity by.
|
||||
virtual void SetRotation([[maybe_unused]] const AZ::Vector3& eulerAnglesRadians) {}
|
||||
|
||||
//! @deprecated Use SetLocalRotation()
|
||||
//! Sets the entity's rotation around the world's X axis.
|
||||
//! The origin of the axis is the entity's position in world space.
|
||||
//! @param eulerAngleRadians The X coordinate Euler angle in radians to use for the entity's rotation.
|
||||
virtual void SetRotationX([[maybe_unused]] float eulerAngleRadian) {}
|
||||
|
||||
//! @deprecated Use SetLocalRotation()
|
||||
//! Sets the entity's rotation around the world's Y axis.
|
||||
//! The origin of the axis is the entity's position in world space.
|
||||
//! @param eulerAngleRadians The Y coordinate Euler angle in radians to use for the entity's rotation.
|
||||
virtual void SetRotationY([[maybe_unused]] float eulerAngleRadian) {}
|
||||
|
||||
//! @deprecated Use SetLocalRotation()
|
||||
//! Sets the entity's rotation around the world's Z axis.
|
||||
//! The origin of the axis is the entity's position in world space.
|
||||
//! @param eulerAngleRadians The Z coordinate Euler angle in radians to use for the entity's rotation.
|
||||
virtual void SetRotationZ([[maybe_unused]] float eulerAngleRadian) {}
|
||||
|
||||
//! @deprecated Use SetLocalRotationQuaternion()
|
||||
//! Sets the entity's rotation in the world in quaternion notation.
|
||||
//! The origin of the axes is the entity's position in world space.
|
||||
//! @param quaternion A quaternion that represents the rotation to use for the entity.
|
||||
virtual void SetRotationQuaternion([[maybe_unused]] const AZ::Quaternion& quaternion) {}
|
||||
|
||||
//! @deprecated Use RotateAroundLocalX()
|
||||
//! Rotates the entity around the world's X axis.
|
||||
//! The origin of the axis is the entity's position in world space.
|
||||
//! @param eulerAngleRadians The Euler angle in radians by which to rotate the entity around the X axis.
|
||||
virtual void RotateByX([[maybe_unused]] float eulerAngleRadian) {}
|
||||
|
||||
//! @deprecated Use RotateAroundLocalY()
|
||||
//! Rotates the entity around the world's Y axis.
|
||||
//! The origin of the axis is the entity's position in world space.
|
||||
//! @param eulerAngleRadians The Euler angle in radians by which to rotate the entity around the Y axis.
|
||||
virtual void RotateByY([[maybe_unused]] float eulerAngleRadian) {}
|
||||
|
||||
//! @deprecated Use RotateAroundLocalZ()
|
||||
//! Rotates the entity around the world's Z axis.
|
||||
//! The origin of the axis is the entity's position in world space.
|
||||
//! @param eulerAngleRadians The Euler angle in radians by which to rotate the entity around the Z axis.
|
||||
virtual void RotateByZ([[maybe_unused]] float eulerAngleRadian) {}
|
||||
|
||||
//! @deprecated Use GetLocalRotation()
|
||||
//! Gets the entity's rotation in the world in Euler angles rotation in radians.
|
||||
//! @return A three-dimensional vector, containing Euler angles in radians, that represents the entity's rotation.
|
||||
virtual AZ::Vector3 GetRotationEulerRadians() { return AZ::Vector3(FLT_MAX); }
|
||||
|
||||
//! @deprecated Use GetLocalRotationQuaternion()
|
||||
//! Gets the entity's rotation in the world in quaternion format.
|
||||
//! @return A quaternion that represents the entity's rotation in world space.
|
||||
virtual AZ::Quaternion GetRotationQuaternion() { return AZ::Quaternion::CreateZero(); }
|
||||
|
||||
//! @deprecated Use GetLocalRotation()
|
||||
//! Gets the entity's rotation around the world's X axis.
|
||||
//! @return The Euler angle in radians by which the the entity is rotated around the X axis in world space.
|
||||
virtual float GetRotationX() { return FLT_MAX; }
|
||||
|
||||
//! @deprecated Use GetLocalRotation()
|
||||
//! Gets the entity's rotation around the world's Y axis.
|
||||
//! @return The Euler angle in radians by which the the entity is rotated around the Y axis in world space.
|
||||
virtual float GetRotationY() { return FLT_MAX; }
|
||||
|
||||
//! @deprecated Use GetLocalRotation()
|
||||
//! Gets the entity's rotation around the world's Z axis.
|
||||
//! @return The Euler angle in radians by which the the entity is rotated around the Z axis in world space.
|
||||
virtual float GetRotationZ() { return FLT_MAX; }
|
||||
virtual void SetWorldRotationQuaternion([[maybe_unused]] const AZ::Quaternion& quaternion) {}
|
||||
|
||||
//! Get angles in radian for each principle axis around which the world transform is
|
||||
//! rotated in the order of z-axis and y-axis and then x-axis.
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace AZ
|
||||
{
|
||||
inline namespace PlatformDefaults
|
||||
{
|
||||
static const char* PlatformNames[PlatformId::NumPlatformIds] = { PlatformPC, PlatformES3, PlatformIOS, PlatformOSX, PlatformProvo, PlatformSalem, PlatformJasper, PlatformServer, PlatformAll, PlatformAllClient };
|
||||
static const char* PlatformNames[PlatformId::NumPlatformIds] = { PlatformPC, PlatformAndroid, PlatformIOS, PlatformMac, PlatformProvo, PlatformSalem, PlatformJasper, PlatformServer, PlatformAll, PlatformAllClient };
|
||||
|
||||
const char* PlatformIdToPalFolder(AZ::PlatformId platform)
|
||||
{
|
||||
@@ -31,11 +31,11 @@ namespace AZ
|
||||
{
|
||||
case AZ::PC:
|
||||
return "PC";
|
||||
case AZ::ES3:
|
||||
case AZ::ANDROID_ID:
|
||||
return "Android";
|
||||
case AZ::IOS:
|
||||
return "iOS";
|
||||
case AZ::OSX:
|
||||
case AZ::MAC_ID:
|
||||
return "Mac";
|
||||
case AZ::PROVO:
|
||||
return "Provo";
|
||||
@@ -66,11 +66,11 @@ namespace AZ
|
||||
}
|
||||
else if (osPlatform == PlatformCodeNameMac)
|
||||
{
|
||||
return PlatformOSX;
|
||||
return PlatformMac;
|
||||
}
|
||||
else if (osPlatform == PlatformCodeNameAndroid)
|
||||
{
|
||||
return PlatformES3;
|
||||
return PlatformAndroid;
|
||||
}
|
||||
else if (osPlatform == PlatformCodeNameiOS)
|
||||
{
|
||||
@@ -207,13 +207,13 @@ namespace AZ
|
||||
platformCodes.emplace_back(PlatformCodeNameWindows);
|
||||
platformCodes.emplace_back(PlatformCodeNameLinux);
|
||||
break;
|
||||
case PlatformId::ES3:
|
||||
case PlatformId::ANDROID_ID:
|
||||
platformCodes.emplace_back(PlatformCodeNameAndroid);
|
||||
break;
|
||||
case PlatformId::IOS:
|
||||
platformCodes.emplace_back(PlatformCodeNameiOS);
|
||||
break;
|
||||
case PlatformId::OSX:
|
||||
case PlatformId::MAC_ID:
|
||||
platformCodes.emplace_back(PlatformCodeNameMac);
|
||||
break;
|
||||
case PlatformId::PROVO:
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace AZ
|
||||
inline namespace PlatformDefaults
|
||||
{
|
||||
constexpr char PlatformPC[] = "pc";
|
||||
constexpr char PlatformES3[] = "es3";
|
||||
constexpr char PlatformAndroid[] = "android";
|
||||
constexpr char PlatformIOS[] = "ios";
|
||||
constexpr char PlatformOSX[] = "osx_gl";
|
||||
constexpr char PlatformMac[] = "mac";
|
||||
constexpr char PlatformProvo[] = "provo";
|
||||
constexpr char PlatformSalem[] = "salem";
|
||||
constexpr char PlatformJasper[] = "jasper";
|
||||
@@ -54,9 +54,9 @@ namespace AZ
|
||||
AZ_ENUM_WITH_UNDERLYING_TYPE(PlatformId, int,
|
||||
(Invalid, -1),
|
||||
PC,
|
||||
ES3,
|
||||
ANDROID_ID,
|
||||
IOS,
|
||||
OSX,
|
||||
MAC_ID,
|
||||
PROVO,
|
||||
SALEM,
|
||||
JASPER,
|
||||
@@ -73,9 +73,9 @@ namespace AZ
|
||||
{
|
||||
Platform_NONE = 0x00,
|
||||
Platform_PC = 1 << PlatformId::PC,
|
||||
Platform_ES3 = 1 << PlatformId::ES3,
|
||||
Platform_ANDROID = 1 << PlatformId::ANDROID_ID,
|
||||
Platform_IOS = 1 << PlatformId::IOS,
|
||||
Platform_OSX = 1 << PlatformId::OSX,
|
||||
Platform_MAC = 1 << PlatformId::MAC_ID,
|
||||
Platform_PROVO = 1 << PlatformId::PROVO,
|
||||
Platform_SALEM = 1 << PlatformId::SALEM,
|
||||
Platform_JASPER = 1 << PlatformId::JASPER,
|
||||
@@ -87,7 +87,7 @@ namespace AZ
|
||||
// A special platform that will always correspond to all non-server platforms, even if new ones are added
|
||||
Platform_ALL_CLIENT = 1ULL << 31,
|
||||
|
||||
AllNamedPlatforms = Platform_PC | Platform_ES3 | Platform_IOS | Platform_OSX | Platform_PROVO | Platform_SALEM | Platform_JASPER | Platform_SERVER,
|
||||
AllNamedPlatforms = Platform_PC | Platform_ANDROID | Platform_IOS | Platform_MAC | Platform_PROVO | Platform_SALEM | Platform_JASPER | Platform_SERVER,
|
||||
};
|
||||
|
||||
AZ_DEFINE_ENUM_BITWISE_OPERATORS(PlatformFlags);
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace AZ
|
||||
return "Android64";
|
||||
case PlatformID::PLATFORM_APPLE_IOS:
|
||||
return "iOS";
|
||||
case PlatformID::PLATFORM_APPLE_OSX:
|
||||
return "OSX";
|
||||
case PlatformID::PLATFORM_APPLE_MAC:
|
||||
return "Mac";
|
||||
#if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
|
||||
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
|
||||
case PlatformID::PLATFORM_##PUBLICNAME:\
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace AZ
|
||||
PLATFORM_WINDOWS_64,
|
||||
PLATFORM_LINUX_64,
|
||||
PLATFORM_APPLE_IOS,
|
||||
PLATFORM_APPLE_OSX,
|
||||
PLATFORM_APPLE_MAC,
|
||||
PLATFORM_ANDROID_64, // ARMv8 / 64-bit
|
||||
#if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
|
||||
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
|
||||
|
||||
@@ -937,7 +937,7 @@ void ScriptSystemComponent::Reflect(ReflectContext* reflection)
|
||||
->Enum<static_cast<int>(PlatformID::PLATFORM_LINUX_64)>("Linux")
|
||||
->Enum<static_cast<int>(PlatformID::PLATFORM_ANDROID_64)>("Android64")
|
||||
->Enum<static_cast<int>(PlatformID::PLATFORM_APPLE_IOS)>("iOS")
|
||||
->Enum<static_cast<int>(PlatformID::PLATFORM_APPLE_OSX)>("OSX")
|
||||
->Enum<static_cast<int>(PlatformID::PLATFORM_APPLE_MAC)>("Mac")
|
||||
#if defined(AZ_EXPAND_FOR_RESTRICTED_PLATFORM) || defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
|
||||
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
|
||||
->Enum<static_cast<int>(PlatformID::PLATFORM_##PUBLICNAME)>(#CodeName)
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
static const PlatformID g_currentPlatform = PlatformID::PLATFORM_APPLE_OSX;
|
||||
static const PlatformID g_currentPlatform = PlatformID::PLATFORM_APPLE_MAC;
|
||||
}
|
||||
|
||||
@@ -372,15 +372,15 @@ mac_remote_filesystem=0
|
||||
-- We need to know this before we establish VFS because different platform assets
|
||||
-- are stored in different root folders in the cache. These correspond to the names
|
||||
-- In the asset processor config file. This value also controls what config file is read
|
||||
-- when you read system_xxxx_xxxx.cfg (for example, system_windows_pc.cfg or system_android_es3.cfg)
|
||||
-- when you read system_xxxx_xxxx.cfg (for example, system_windows_pc.cfg or system_android_android.cfg)
|
||||
-- by default, pc assets (in the 'pc' folder) are used, with RC being fed 'pc' as the platform
|
||||
-- by default on console we use the default assets=pc for better iteration times
|
||||
-- we should turn on console specific assets only when in release and/or testing assets and/or loading performance
|
||||
-- that way most people will not need to have 3 different caches taking up disk space
|
||||
assets = pc
|
||||
android_assets = es3
|
||||
android_assets = android
|
||||
ios_assets = ios
|
||||
mac_assets = osx_gl
|
||||
mac_assets = mac
|
||||
|
||||
-- Add the IP address of your console to the white list that will connect to the asset processor here
|
||||
-- You can list addresses or CIDR's. CIDR's are helpful if you are using DHCP. A CIDR looks like an ip address with
|
||||
@@ -438,9 +438,9 @@ mac_wait_for_connect=0
|
||||
ConfigFileParams::SettingsKeyValuePair{"/ios_remote_filesystem", AZ::s64{0}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/mac_remote_filesystem", AZ::s64{0}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/assets", AZStd::string_view{"pc"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/android_assets", AZStd::string_view{"es3"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/android_assets", AZStd::string_view{"android"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/ios_assets", AZStd::string_view{"ios"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/mac_assets", AZStd::string_view{"osx_gl"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/mac_assets", AZStd::string_view{"mac"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/connect_to_remote", AZ::s64{0}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/windows_connect_to_remote", AZ::s64{1}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/android_connect_to_remote", AZ::s64{0}},
|
||||
@@ -478,20 +478,20 @@ test_asset_processor_tag = test_value
|
||||
[Platform pc]
|
||||
tags=tools,renderer,dx12,vulkan
|
||||
|
||||
[Platform es3]
|
||||
[Platform android]
|
||||
tags=android,mobile,renderer,vulkan ; With Comments at the end
|
||||
|
||||
[Platform ios]
|
||||
tags=mobile,renderer,metal
|
||||
|
||||
[Platform osx_gl]
|
||||
[Platform mac]
|
||||
tags=tools,renderer,metal)"
|
||||
, AZStd::fixed_vector<ConfigFileParams::SettingsKeyValuePair, 20>{
|
||||
ConfigFileParams::SettingsKeyValuePair{"/test_asset_processor_tag", AZStd::string_view{"test_value"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/Platform pc/tags", AZStd::string_view{"tools,renderer,dx12,vulkan"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/Platform es3/tags", AZStd::string_view{"android,mobile,renderer,vulkan"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/Platform android/tags", AZStd::string_view{"android,mobile,renderer,vulkan"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/Platform ios/tags", AZStd::string_view{"mobile,renderer,metal"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/Platform osx_gl/tags", AZStd::string_view{"tools,renderer,metal"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/Platform mac/tags", AZStd::string_view{"tools,renderer,metal"}},
|
||||
}}
|
||||
)
|
||||
);
|
||||
|
||||
@@ -2008,13 +2008,12 @@ namespace AZ::IO
|
||||
// if no bind root is specified, compute one:
|
||||
strBindRoot = !bindRoot.empty() ? bindRoot : szFullPath->ParentPath().Native();
|
||||
|
||||
// Check if archive file disk exist on disk or inside of pak.
|
||||
bool bFileExists = IsFileExist(szFullPath->Native());
|
||||
|
||||
if (!bFileExists && (nFactoryFlags & ZipDir::CacheFactory::FLAGS_READ_ONLY))
|
||||
// Check if archive file disk exist on disk.
|
||||
const bool pakOnDisk = FileIOBase::GetDirectInstance()->Exists(szFullPath->c_str());
|
||||
if (!pakOnDisk && (nFactoryFlags & ZipDir::CacheFactory::FLAGS_READ_ONLY))
|
||||
{
|
||||
// Archive file not found.
|
||||
AZ_TracePrintf("Archive", "Cannot open Archive file %s\n", szFullPath->c_str());
|
||||
AZ_TracePrintf("Archive", "Archive file %s does not exist\n", szFullPath->c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -2492,8 +2491,6 @@ namespace AZ::IO
|
||||
|
||||
void Archive::FindCompressionInfo(bool& found, AZ::IO::CompressionInfo& info, const AZStd::string_view filename)
|
||||
{
|
||||
constexpr uint32_t s_compressionTag = static_cast<uint32_t>('Z') << 24 | static_cast<uint32_t>('C') << 16 | static_cast<uint32_t>('R') << 8 | static_cast<uint32_t>('Y');
|
||||
|
||||
if (!found)
|
||||
{
|
||||
auto correctedFilename = AZ::IO::FileIOBase::GetDirectInstance()->ResolvePath(filename);
|
||||
@@ -2519,7 +2516,6 @@ namespace AZ::IO
|
||||
found = true;
|
||||
|
||||
info.m_archiveFilename.InitFromRelativePath(archive->GetFilePath());
|
||||
info.m_compressionTag.m_code = s_compressionTag;
|
||||
info.m_offset = pFileData->GetFileDataOffset();
|
||||
info.m_compressedSize = entry->desc.lSizeCompressed;
|
||||
info.m_uncompressedSize = entry->desc.lSizeUncompressed;
|
||||
@@ -2539,9 +2535,8 @@ namespace AZ::IO
|
||||
break;
|
||||
}
|
||||
|
||||
info.m_decompressor = [&s_compressionTag]([[maybe_unused]] const AZ::IO::CompressionInfo& info, const void* compressed, size_t compressedSize, void* uncompressed, size_t uncompressedBufferSize)->bool
|
||||
info.m_decompressor = []([[maybe_unused]] const AZ::IO::CompressionInfo& info, const void* compressed, size_t compressedSize, void* uncompressed, size_t uncompressedBufferSize)->bool
|
||||
{
|
||||
AZ_Assert(info.m_compressionTag.m_code == s_compressionTag, "Provided compression info isn't supported by this decompressor.");
|
||||
size_t nSizeUncompressed = uncompressedBufferSize;
|
||||
return ZipDir::ZipRawUncompress(uncompressed, &nSizeUncompressed, compressed, compressedSize) == 0;
|
||||
};
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace AZ::IO
|
||||
, tWrite{ writeTime }
|
||||
{
|
||||
}
|
||||
|
||||
ArchiveFileIterator::ArchiveFileIterator(FindData* findData, AZStd::string_view filename, const FileDesc& fileDesc)
|
||||
: m_findData{ findData }
|
||||
, m_filename{ filename }
|
||||
@@ -108,13 +109,10 @@ namespace AZ::IO
|
||||
AZ::StringFunc::Path::GetFullPath(directory.c_str(), searchDirectory);
|
||||
AZ::StringFunc::Path::GetFullFileName(directory.c_str(), pattern);
|
||||
}
|
||||
|
||||
AZ::IO::FileIOBase::GetDirectInstance()->FindFiles(searchDirectory.c_str(), pattern.c_str(), [&](const char* filePath) -> bool
|
||||
{
|
||||
AZ::IO::FileDesc fileDesc;
|
||||
|
||||
AZStd::string fullFilePath;
|
||||
AZ::StringFunc::Path::GetFullFileName(filePath, fullFilePath);
|
||||
AZStd::string filePathEntry{filePath};
|
||||
|
||||
if (AZ::IO::FileIOBase::GetDirectInstance()->IsDirectory(filePath))
|
||||
{
|
||||
@@ -135,9 +133,8 @@ namespace AZ::IO
|
||||
fileDesc.tAccess = fileDesc.tWrite;
|
||||
fileDesc.tCreate = fileDesc.tWrite;
|
||||
}
|
||||
[[maybe_unused]] auto result = m_mapFiles.emplace(AZStd::move(fullFilePath), fileDesc);
|
||||
AZ_Assert(result.second, "Failed to insert FindData entry for %s", fullFilePath.c_str());
|
||||
|
||||
[[maybe_unused]] auto result = m_mapFiles.emplace(AZStd::move(filePathEntry), fileDesc);
|
||||
AZ_Assert(result.second, "Failed to insert FindData entry for filePath %s", filePath);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -273,7 +270,9 @@ namespace AZ::IO
|
||||
}
|
||||
|
||||
auto pakFileIter = m_mapFiles.begin();
|
||||
fileIterator.m_filename = pakFileIter->first;
|
||||
AZStd::string fullFilePath;
|
||||
AZ::StringFunc::Path::GetFullFileName(pakFileIter->first.c_str(), fullFilePath);
|
||||
fileIterator.m_filename = AZStd::move(fullFilePath);
|
||||
fileIterator.m_fileDesc = pakFileIter->second;
|
||||
fileIterator.m_lastFetchValid = true;
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/EditContextConstants.inl>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
@@ -64,15 +64,13 @@ namespace AzFramework
|
||||
the EditContext. TController can friend itself to the editor component to make this work if required.
|
||||
*/
|
||||
template<typename TController, typename TConfiguration = AZ::ComponentConfig>
|
||||
class ComponentAdapter
|
||||
: public AZ::Component
|
||||
class ComponentAdapter : public AZ::Component
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_RTTI((ComponentAdapter, "{644A9187-4FDB-42C1-9D59-DD75304B551A}", TController, TConfiguration), AZ::Component);
|
||||
|
||||
ComponentAdapter() = default;
|
||||
ComponentAdapter(const TConfiguration& configuration);
|
||||
explicit ComponentAdapter(const TConfiguration& configuration);
|
||||
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
||||
@@ -85,7 +83,6 @@ namespace AzFramework
|
||||
void Deactivate() override;
|
||||
|
||||
protected:
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
// AZ::Component overrides ...
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzFramework/Components/ComponentAdapterHelpers.h>
|
||||
|
||||
@@ -32,10 +32,12 @@ namespace AzFramework
|
||||
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
// clang-format off
|
||||
serializeContext->Class<ComponentAdapter, Component>()
|
||||
->Version(1)
|
||||
->Field("Controller", &ComponentAdapter::m_controller)
|
||||
;
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +68,6 @@ namespace AzFramework
|
||||
GetDependentServicesHelper<TController>(services, typename AZ::HasComponentDependentServices<TController>::type());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component interface implementation
|
||||
|
||||
template<typename TController, typename TConfiguration>
|
||||
void ComponentAdapter<TController, TConfiguration>::Init()
|
||||
{
|
||||
@@ -78,7 +77,7 @@ namespace AzFramework
|
||||
template<typename TController, typename TConfiguration>
|
||||
void ComponentAdapter<TController, TConfiguration>::Activate()
|
||||
{
|
||||
m_controller.Activate(GetEntityId());
|
||||
ComponentActivateHelper<TController>::Activate(m_controller, AZ::EntityComponentIdPair(GetEntityId(), GetId()));
|
||||
}
|
||||
|
||||
template<typename TController, typename TConfiguration>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Component/EntityBus.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
@@ -27,18 +28,43 @@ namespace AzFramework
|
||||
template<typename T, typename = void>
|
||||
struct ComponentInitHelper
|
||||
{
|
||||
static void Init(T& common)
|
||||
static void Init([[maybe_unused]] T& controller)
|
||||
{
|
||||
AZ_UNUSED(common);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ComponentInitHelper<T, AZStd::void_t<decltype(AZStd::declval<T>().Init())>>
|
||||
{
|
||||
static void Init(T& common)
|
||||
static void Init(T& controller)
|
||||
{
|
||||
common.Init();
|
||||
controller.Init();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, typename = void>
|
||||
struct ComponentActivateHelper
|
||||
{
|
||||
static void Activate([[maybe_unused]] T& controller, [[maybe_unused]] const AZ::EntityComponentIdPair& entityComponentIdPair)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ComponentActivateHelper<T, AZStd::void_t<decltype(AZStd::declval<T>().Activate(AZ::EntityId()))>>
|
||||
{
|
||||
static void Activate(T& controller, const AZ::EntityComponentIdPair& entityComponentIdPair)
|
||||
{
|
||||
controller.Activate(entityComponentIdPair.GetEntityId());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ComponentActivateHelper<T, AZStd::void_t<decltype(AZStd::declval<T>().Activate(AZ::EntityComponentIdPair()))>>
|
||||
{
|
||||
static void Activate(T& controller, const AZ::EntityComponentIdPair& entityComponentIdPair)
|
||||
{
|
||||
controller.Activate(entityComponentIdPair);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -327,99 +327,13 @@ namespace AzFramework
|
||||
return localZ;
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotation(const AZ::Vector3& eulerAnglesRadian)
|
||||
void TransformComponent::SetWorldRotationQuaternion(const AZ::Quaternion& quaternion)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "SetRotation is deprecated, please use SetLocalRotation");
|
||||
|
||||
AZ::Transform newWorldTransform = m_worldTM;
|
||||
newWorldTransform.SetRotation(AZ::ConvertEulerRadiansToQuaternion(eulerAnglesRadian));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationQuaternion(const AZ::Quaternion& quaternion)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "SetRotationQuaternion is deprecated, please use SetLocalRotationQuaternion");
|
||||
|
||||
AZ::Transform newWorldTransform = m_worldTM;
|
||||
newWorldTransform.SetRotation(quaternion);
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationX(float eulerAngleRadian)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "SetRotationX is deprecated, please use SetLocalRotation");
|
||||
|
||||
AZ::Transform newWorldTransform = m_worldTM;
|
||||
newWorldTransform.SetRotation(AZ::Quaternion::CreateRotationX(eulerAngleRadian));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationY(float eulerAngleRadian)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "SetRotationY is deprecated, please use SetLocalRotation");
|
||||
|
||||
AZ::Transform newWorldTransform = m_worldTM;
|
||||
newWorldTransform.SetRotation(AZ::Quaternion::CreateRotationY(eulerAngleRadian));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationZ(float eulerAngleRadian)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "SetRotationZ is deprecated, please use SetLocalRotation");
|
||||
|
||||
AZ::Transform newWorldTransform = m_worldTM;
|
||||
newWorldTransform.SetRotation(AZ::Quaternion::CreateRotationZ(eulerAngleRadian));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::RotateByX(float eulerAngleRadian)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "RotateByX is deprecated, please use RotateAroundLocalX");
|
||||
RotateAroundLocalX(eulerAngleRadian);
|
||||
}
|
||||
|
||||
void TransformComponent::RotateByY(float eulerAngleRadian)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "RotateByY is deprecated, please use RotateAroundLocalY");
|
||||
RotateAroundLocalY(eulerAngleRadian);
|
||||
}
|
||||
|
||||
void TransformComponent::RotateByZ(float eulerAngleRadian)
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "RotateByZ is deprecated, please use RotateAroundLocalZ");
|
||||
RotateAroundLocalZ(eulerAngleRadian);
|
||||
}
|
||||
|
||||
AZ::Vector3 TransformComponent::GetRotationEulerRadians()
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "GetRotationEulerRadians is deprecated, please use GetWorldRotation");
|
||||
return m_worldTM.GetRotation().GetEulerRadians();
|
||||
}
|
||||
|
||||
AZ::Quaternion TransformComponent::GetRotationQuaternion()
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "GetRotationQuaternion is deprecated, please use GetWorldRotationQuaternion");
|
||||
return m_worldTM.GetRotation();
|
||||
}
|
||||
|
||||
float TransformComponent::GetRotationX()
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "GetRotationX is deprecated, please use GetWorldRotation");
|
||||
return GetRotationEulerRadians().GetX();
|
||||
}
|
||||
|
||||
float TransformComponent::GetRotationY()
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "GetRotationY is deprecated, please use GetWorldRotation");
|
||||
return GetRotationEulerRadians().GetY();
|
||||
}
|
||||
|
||||
float TransformComponent::GetRotationZ()
|
||||
{
|
||||
AZ_Warning("TransformComponent", false, "GetRotationZ is deprecated, please use GetWorldRotation");
|
||||
return GetRotationEulerRadians().GetZ();
|
||||
}
|
||||
|
||||
AZ::Vector3 TransformComponent::GetWorldRotation()
|
||||
{
|
||||
return m_worldTM.GetRotation().GetEulerRadians();
|
||||
@@ -830,45 +744,7 @@ namespace AzFramework
|
||||
->Event("GetLocalX", &AZ::TransformBus::Events::GetLocalX)
|
||||
->Event("GetLocalY", &AZ::TransformBus::Events::GetLocalY)
|
||||
->Event("GetLocalZ", &AZ::TransformBus::Events::GetLocalZ)
|
||||
->Event("RotateByX", &AZ::TransformBus::Events::RotateByX)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("RotateByY", &AZ::TransformBus::Events::RotateByY)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("RotateByZ", &AZ::TransformBus::Events::RotateByZ)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("SetEulerRotation", &AZ::TransformBus::Events::SetRotation)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("SetRotationQuaternion", &AZ::TransformBus::Events::SetRotationQuaternion)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("SetRotationX", &AZ::TransformBus::Events::SetRotationX)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("SetRotationY", &AZ::TransformBus::Events::SetRotationY)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("SetRotationZ", &AZ::TransformBus::Events::SetRotationZ)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("GetEulerRotation", &AZ::TransformBus::Events::GetRotationEulerRadians)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("GetRotationQuaternion", &AZ::TransformBus::Events::GetRotationQuaternion)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("GetRotationX", &AZ::TransformBus::Events::GetRotationX)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("GetRotationY", &AZ::TransformBus::Events::GetRotationY)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("GetRotationZ", &AZ::TransformBus::Events::GetRotationZ)
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Event("SetWorldRotationQuaternion", &AZ::TransformBus::Events::SetWorldRotationQuaternion)
|
||||
->Event("GetWorldRotation", &AZ::TransformBus::Events::GetWorldRotation)
|
||||
->Event("GetWorldRotationQuaternion", &AZ::TransformBus::Events::GetWorldRotationQuaternion)
|
||||
->Event("SetLocalRotation", &AZ::TransformBus::Events::SetLocalRotation)
|
||||
|
||||
@@ -112,22 +112,7 @@ namespace AzFramework
|
||||
float GetLocalZ() override;
|
||||
|
||||
// Rotation modifiers
|
||||
void SetRotation(const AZ::Vector3& eulerAnglesRadian) override;
|
||||
void SetRotationQuaternion(const AZ::Quaternion& quaternion) override;
|
||||
void SetRotationX(float eulerAngleRadian) override;
|
||||
void SetRotationY(float eulerAngleRadian) override;
|
||||
void SetRotationZ(float eulerAngleRadian) override;
|
||||
|
||||
void RotateByX(float eulerAngleRadian) override;
|
||||
void RotateByY(float eulerAngleRadian) override;
|
||||
void RotateByZ(float eulerAngleRadian) override;
|
||||
|
||||
AZ::Vector3 GetRotationEulerRadians() override;
|
||||
AZ::Quaternion GetRotationQuaternion() override;
|
||||
|
||||
float GetRotationX() override;
|
||||
float GetRotationY() override;
|
||||
float GetRotationZ() override;
|
||||
void SetWorldRotationQuaternion(const AZ::Quaternion& quaternion) override;
|
||||
|
||||
AZ::Vector3 GetWorldRotation() override;
|
||||
AZ::Quaternion GetWorldRotationQuaternion() override;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <AzCore/Math/Matrix3x4.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
#include <AzFramework/Viewport/ViewportId.h>
|
||||
|
||||
@@ -42,11 +43,15 @@ namespace AzFramework
|
||||
{
|
||||
ViewportId m_drawViewportId = InvalidViewportId; //!< Viewport to draw into
|
||||
AZ::Vector3 m_position; //!< world space position for 3d draws, screen space x,y,depth for 2d.
|
||||
AZ::Color m_color = AZ::Colors::White; //!< Color to draw the text
|
||||
AZ::Color m_color = AZ::Colors::White; //!< Color to draw the text
|
||||
unsigned int m_effectIndex = 0; //!< effect index to apply
|
||||
AZ::Vector2 m_scale = AZ::Vector2(1.0f); //!< font scale
|
||||
float m_lineSpacing; //!< Spacing between new lines, as a percentage of m_scale.
|
||||
float m_textSizeFactor = 12.0f; //!< font size in pixels
|
||||
float m_lineSpacing = 1.0f; //!< Spacing between new lines, as a percentage of m_scale.
|
||||
TextHorizontalAlignment m_hAlign = TextHorizontalAlignment::Left; //!< Horizontal text alignment
|
||||
TextVerticalAlignment m_vAlign = TextVerticalAlignment::Top; //!< Vertical text alignment
|
||||
bool m_useTransform = false; //!< Use specified transform
|
||||
AZ::Matrix3x4 m_transform = AZ::Matrix3x4::Identity(); //!< Transform to apply to text quads
|
||||
bool m_monospace = false; //!< disable character proportional spacing
|
||||
bool m_depthTest = false; //!< Test character against the depth buffer
|
||||
bool m_virtual800x600ScreenSize = true; //!< Text placement and size are scaled relative to a virtual 800x600 resolution
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Physics
|
||||
|
||||
/// Is the ragdoll currently simulated?
|
||||
/// @result True in case the ragdoll is simulated, false if not.
|
||||
virtual bool IsSimulated() = 0;
|
||||
virtual bool IsSimulated() const = 0;
|
||||
|
||||
/// Writes the state for all of the bodies in the ragdoll to the provided output.
|
||||
/// The caller owns the output state and can safely manipulate it without affecting the physics simulation.
|
||||
|
||||
@@ -120,14 +120,14 @@ namespace AzToolsFramework
|
||||
|
||||
/**
|
||||
* Query to see if a specific asset platform is enabled
|
||||
* @param platform the asset platform to check e.g. es3, ios, etc.
|
||||
* @param platform the asset platform to check e.g. android, ios, etc.
|
||||
* @return true if enabled, false otherwise
|
||||
*/
|
||||
virtual bool IsAssetPlatformEnabled(const char* platform) = 0;
|
||||
|
||||
/**
|
||||
* Get the total number of pending assets left to process for a specific asset platform
|
||||
* @param platform the asset platform to check e.g. es3, ios, etc.
|
||||
* @param platform the asset platform to check e.g. android, ios, etc.
|
||||
* @return -1 if the process fails, a positive number otherwise
|
||||
*/
|
||||
virtual int GetPendingAssetsForPlatform(const char* platform) = 0;
|
||||
@@ -312,7 +312,7 @@ namespace AzToolsFramework
|
||||
inline const char* GetHostAssetPlatform()
|
||||
{
|
||||
#if defined(AZ_PLATFORM_MAC)
|
||||
return "osx_gl";
|
||||
return "mac";
|
||||
#elif defined(AZ_PLATFORM_WINDOWS)
|
||||
return "pc";
|
||||
#elif defined(AZ_PLATFORM_LINUX)
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
#include <AzFramework/Viewport/ViewportId.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
//! An interface for loading simple icon assets and rendering them to screen on a per-viewport basis.
|
||||
class EditorViewportIconDisplayInterface
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EditorViewportIconDisplayInterface, "{D5190B58-2561-4F3F-B793-F1E7D454CDF2}");
|
||||
|
||||
using IconId = AZ::s32;
|
||||
static constexpr IconId InvalidIconId = -1;
|
||||
|
||||
enum class CoordinateSpace : AZ::u8
|
||||
{
|
||||
ScreenSpace,
|
||||
WorldSpace
|
||||
};
|
||||
|
||||
//! These draw parameters control rendering for a single icon to a single viewport.
|
||||
struct DrawParameters
|
||||
{
|
||||
//! The ViewportId to render to.
|
||||
AzFramework::ViewportId m_viewport = AzFramework::InvalidViewportId;
|
||||
//! The icon ID, retrieved from GetOrLoadIconForPath, to render to screen.
|
||||
IconId m_icon = InvalidIconId;
|
||||
//! The color, including opacity, to render the icon with. White will render the icon as opaque in its original color.
|
||||
AZ::Color m_color = AZ::Colors::White;
|
||||
//! The position to render the icon to, in world or screen space depending on m_positionSpace.
|
||||
AZ::Vector3 m_position;
|
||||
//! The coordinate system to use for m_position.
|
||||
//! ScreenSpace will accept m_position in the form of [X, Y, Depth], where X & Y are screen coordinates in
|
||||
//! pixels and Depth is a z-ordering depth value from 0.0f to 1.0f.
|
||||
//! WorldSpace will accept a 3D vector in world space coordinates that will be translated back into screen
|
||||
//! space when the icon is rendered.
|
||||
CoordinateSpace m_positionSpace = CoordinateSpace::ScreenSpace;
|
||||
//! The size to render the icon as, in pixels.
|
||||
AZ::Vector2 m_size;
|
||||
};
|
||||
|
||||
//! The current load status of an icon retrieved by GetOrLoadIconForPath.
|
||||
enum class IconLoadStatus : AZ::u8
|
||||
{
|
||||
Unloaded,
|
||||
Loading,
|
||||
Loaded,
|
||||
Error
|
||||
};
|
||||
|
||||
//! Draws an icon to a viewport given a set of draw parameters.
|
||||
//! Requires an IconId retrieved from GetOrLoadIconForPath.
|
||||
virtual void DrawIcon(const DrawParameters& drawParameters) = 0;
|
||||
//! Retrieves a reusable IconId for an icon at a given path.
|
||||
//! This will load the icon, if it has not already been loaded.
|
||||
//! @param path should be a relative asset path to an icon image asset.
|
||||
//! png and svg icons are currently supported.
|
||||
virtual IconId GetOrLoadIconForPath(AZStd::string_view path) = 0;
|
||||
//! Gets the current load status of an icon retrieved via GetOrLoadIconForPath.
|
||||
virtual IconLoadStatus GetIconLoadStatus(IconId icon) = 0;
|
||||
};
|
||||
|
||||
using EditorViewportIconDisplay = AZ::Interface<EditorViewportIconDisplayInterface>;
|
||||
} //namespace AzToolsFramework
|
||||
@@ -56,5 +56,7 @@ namespace AzToolsFramework
|
||||
|
||||
virtual void StartPlayInEditor() = 0;
|
||||
virtual void StopPlayInEditor() = 0;
|
||||
|
||||
virtual void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -225,50 +225,19 @@ namespace AzToolsFramework
|
||||
|
||||
m_rootInstance->SetTemplateSourcePath(relativePath);
|
||||
|
||||
bool newLevelFromTemplate = false;
|
||||
|
||||
if (templateId == AzToolsFramework::Prefab::InvalidTemplateId)
|
||||
{
|
||||
AZStd::string watchFolder;
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
bool sourceInfoFound = false;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
sourceInfoFound, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, DefaultLevelTemplateName,
|
||||
assetInfo, watchFolder);
|
||||
m_rootInstance->m_containerEntity->AddComponent(aznew Prefab::EditorPrefabComponent());
|
||||
HandleEntitiesAdded({ m_rootInstance->m_containerEntity.get() });
|
||||
|
||||
if (sourceInfoFound)
|
||||
AzToolsFramework::Prefab::PrefabDom dom;
|
||||
bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
|
||||
if (!success)
|
||||
{
|
||||
AZStd::string fullPath;
|
||||
AZ::StringFunc::Path::Join(watchFolder.c_str(), assetInfo.m_relativePath.c_str(), fullPath);
|
||||
|
||||
// Get the default prefab and copy the Dom over to the new template being saved
|
||||
Prefab::TemplateId defaultId = m_loaderInterface->LoadTemplateFromFile(fullPath.c_str());
|
||||
Prefab::PrefabDom& dom = m_prefabSystemComponent->FindTemplateDom(defaultId);
|
||||
|
||||
Prefab::PrefabDom levelDefaultDom;
|
||||
levelDefaultDom.CopyFrom(dom, levelDefaultDom.GetAllocator());
|
||||
|
||||
Prefab::PrefabDomPath sourcePath("/Source");
|
||||
sourcePath.Set(levelDefaultDom, relativePath.c_str());
|
||||
|
||||
templateId = m_prefabSystemComponent->AddTemplate(relativePath, std::move(levelDefaultDom));
|
||||
newLevelFromTemplate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create an empty level since we couldn't find the default template
|
||||
m_rootInstance->m_containerEntity->AddComponent(aznew Prefab::EditorPrefabComponent());
|
||||
HandleEntitiesAdded({ m_rootInstance->m_containerEntity.get() });
|
||||
|
||||
AzToolsFramework::Prefab::PrefabDom dom;
|
||||
bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
|
||||
if (!success)
|
||||
{
|
||||
AZ_Error("Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
|
||||
return false;
|
||||
}
|
||||
templateId = m_prefabSystemComponent->AddTemplate(relativePath, std::move(dom));
|
||||
AZ_Error("Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
|
||||
return false;
|
||||
}
|
||||
templateId = m_prefabSystemComponent->AddTemplate(relativePath, AZStd::move(dom));
|
||||
|
||||
if (templateId == AzToolsFramework::Prefab::InvalidTemplateId)
|
||||
{
|
||||
@@ -286,13 +255,6 @@ namespace AzToolsFramework
|
||||
m_prefabSystemComponent->RemoveTemplate(prevTemplateId);
|
||||
}
|
||||
|
||||
// If we have a new level from a template, we need to make sure to propagate the changes here otherwise
|
||||
// the entities from the new template won't show up
|
||||
if (newLevelFromTemplate)
|
||||
{
|
||||
m_prefabSystemComponent->PropagateTemplateChanges(templateId);
|
||||
}
|
||||
|
||||
AZStd::string out;
|
||||
if (m_loaderInterface->SaveTemplateToString(m_rootInstance->GetTemplateId(), out))
|
||||
{
|
||||
@@ -303,6 +265,71 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
void PrefabEditorEntityOwnershipService::CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename)
|
||||
{
|
||||
AZ::IO::Path relativePath = m_loaderInterface->GetRelativePathToProject(filename);
|
||||
AzToolsFramework::Prefab::TemplateId templateId = m_prefabSystemComponent->GetTemplateIdFromFilePath(relativePath);
|
||||
|
||||
m_rootInstance->SetTemplateSourcePath(relativePath);
|
||||
|
||||
AZStd::string watchFolder;
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
bool sourceInfoFound = false;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
sourceInfoFound, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, templateFilename.c_str(),
|
||||
assetInfo, watchFolder);
|
||||
|
||||
if (sourceInfoFound)
|
||||
{
|
||||
AZStd::string fullPath;
|
||||
AZ::StringFunc::Path::Join(watchFolder.c_str(), assetInfo.m_relativePath.c_str(), fullPath);
|
||||
|
||||
// Get the default prefab and copy the Dom over to the new template being saved
|
||||
Prefab::TemplateId defaultId = m_loaderInterface->LoadTemplateFromFile(fullPath.c_str());
|
||||
Prefab::PrefabDom& dom = m_prefabSystemComponent->FindTemplateDom(defaultId);
|
||||
|
||||
Prefab::PrefabDom levelDefaultDom;
|
||||
levelDefaultDom.CopyFrom(dom, levelDefaultDom.GetAllocator());
|
||||
|
||||
Prefab::PrefabDomPath sourcePath("/Source");
|
||||
sourcePath.Set(levelDefaultDom, relativePath.c_str());
|
||||
|
||||
templateId = m_prefabSystemComponent->AddTemplate(relativePath, AZStd::move(levelDefaultDom));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rootInstance->m_containerEntity->AddComponent(aznew Prefab::EditorPrefabComponent());
|
||||
HandleEntitiesAdded({ m_rootInstance->m_containerEntity.get() });
|
||||
|
||||
AzToolsFramework::Prefab::PrefabDom dom;
|
||||
bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
|
||||
if (!success)
|
||||
{
|
||||
AZ_Error(
|
||||
"Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
|
||||
return;
|
||||
}
|
||||
templateId = m_prefabSystemComponent->AddTemplate(relativePath, std::move(dom));
|
||||
}
|
||||
|
||||
if (templateId == AzToolsFramework::Prefab::InvalidTemplateId)
|
||||
{
|
||||
AZ_Error("Prefab", false, "Couldn't create new template id '%i' when creating new level '%.*s'", templateId, AZ_STRING_ARG(filename));
|
||||
return;
|
||||
}
|
||||
|
||||
Prefab::TemplateId prevTemplateId = m_rootInstance->GetTemplateId();
|
||||
m_rootInstance->SetTemplateId(templateId);
|
||||
|
||||
if (prevTemplateId != Prefab::InvalidTemplateId && templateId != prevTemplateId)
|
||||
{
|
||||
// Make sure we only have one level template loaded at a time
|
||||
m_prefabSystemComponent->RemoveTemplate(prevTemplateId);
|
||||
}
|
||||
|
||||
m_prefabSystemComponent->PropagateTemplateChanges(templateId);
|
||||
}
|
||||
|
||||
Prefab::InstanceOptionalReference PrefabEditorEntityOwnershipService::CreatePrefab(
|
||||
const AZStd::vector<AZ::Entity*>& entities, AZStd::vector<AZStd::unique_ptr<Prefab::Instance>>&& nestedPrefabInstances,
|
||||
AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder)
|
||||
|
||||
@@ -170,6 +170,8 @@ namespace AzToolsFramework
|
||||
void StartPlayInEditor() override;
|
||||
void StopPlayInEditor() override;
|
||||
|
||||
void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) override;
|
||||
|
||||
protected:
|
||||
|
||||
AZ::SliceComponent::SliceInstanceAddress GetOwningSlice() override;
|
||||
@@ -216,7 +218,5 @@ namespace AzToolsFramework
|
||||
Prefab::PrefabLoaderInterface* m_loaderInterface;
|
||||
AzFramework::EntityContextId m_entityContextId;
|
||||
AZ::SerializeContext m_serializeContext;
|
||||
|
||||
static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::Quaternion oldEntityRotation;
|
||||
AZ::TransformBus::EventResult(oldEntityRotation, id, &AZ::TransformBus::Events::GetWorldRotationQuaternion);
|
||||
transformComponent->SetRotationQuaternion(oldEntityRotation);
|
||||
transformComponent->SetWorldRotationQuaternion(oldEntityRotation);
|
||||
|
||||
// Ensure the existing hierarchy is maintained
|
||||
AZ::EntityId oldParentEntityId;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace AzToolsFramework
|
||||
rayProportion, lineSegmentProportion, worldClosestPositionRay, worldClosestPositionLineSegment);
|
||||
|
||||
AZ::Transform worldFromLocalNormalized = worldFromLocal;
|
||||
const AZ::Vector3 scale = worldFromLocalNormalized.ExtractScale() * nonUniformScale;
|
||||
const AZ::Vector3 scale = worldFromLocalNormalized.ExtractUniformScale() * nonUniformScale;
|
||||
const AZ::Transform localFromWorldNormalized = worldFromLocalNormalized.GetInverse();
|
||||
|
||||
return { (localFromWorldNormalized.TransformPoint(worldClosestPositionLineSegment)) / scale };
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace AzToolsFramework
|
||||
? CalculateSnappedOffset(localTransform.GetTranslation(), axis, gridSize * scaleRecip)
|
||||
: AZ::Vector3::CreateZero();
|
||||
|
||||
const AZ::Vector3 localScale = localTransform.GetScale();
|
||||
const AZ::Vector3 localScale = AZ::Vector3(localTransform.GetUniformScale());
|
||||
const AZ::Quaternion localRotation = QuaternionFromTransformNoScaling(localTransform);
|
||||
// calculate scale amount to snap, to align to round scale value
|
||||
const AZ::Vector3 scaleSnapOffset = snapping && !gridSnapAction.m_localSnapping
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace AzToolsFramework
|
||||
/// noise in the value returned when dealing with values far from the origin.
|
||||
inline float ScaleReciprocal(const AZ::Transform& transform)
|
||||
{
|
||||
return Round3(transform.GetScale().GetReciprocal().GetMinElement());
|
||||
return Round3(1.0f / transform.GetUniformScale());
|
||||
}
|
||||
|
||||
/// Find the reciprocal of the non-uniform scale.
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace AzToolsFramework
|
||||
AZ::Transform result;
|
||||
result.SetRotation(m_space.GetRotation() * localTransform.GetRotation());
|
||||
result.SetTranslation(m_space.TransformPoint(m_nonUniformScale * localTransform.GetTranslation()));
|
||||
result.SetScale(m_space.GetScale() * localTransform.GetScale());
|
||||
result.SetScale(m_space.GetScale() * localTransform.GetUniformScale());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/EditContextConstants.inl>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace AzToolsFramework
|
||||
To use the EditorComponentAdapter, 3 classes are required:
|
||||
- a class that implements the functions required for TController (see below)
|
||||
- a configuration struct/class which extends AZ::ComponentConfig
|
||||
- A runtime component that will be generated by the editor comoinent on export
|
||||
- A runtime component that will be generated by the editor component on export
|
||||
|
||||
The concrete component extends the adapter and implements behavior which is unique to the component.
|
||||
|
||||
@@ -64,15 +64,15 @@ namespace AzToolsFramework
|
||||
the EditContext. TController can friend itself to the editor component to make this work if required.
|
||||
*/
|
||||
template<typename TController, typename TRuntimeComponent, typename TConfiguration = AZ::ComponentConfig>
|
||||
class EditorComponentAdapter
|
||||
: public EditorComponentBase
|
||||
class EditorComponentAdapter : public EditorComponentBase
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_RTTI((EditorComponentAdapter, "{2F5A3669-FFE9-4CD7-B9E2-7FC8100CF1A2}", TController, TRuntimeComponent, TConfiguration), EditorComponentBase);
|
||||
AZ_RTTI(
|
||||
(EditorComponentAdapter, "{2F5A3669-FFE9-4CD7-B9E2-7FC8100CF1A2}", TController, TRuntimeComponent, TConfiguration),
|
||||
EditorComponentBase);
|
||||
|
||||
EditorComponentAdapter() = default;
|
||||
EditorComponentAdapter(const TConfiguration& configuration);
|
||||
explicit EditorComponentAdapter(const TConfiguration& configuration);
|
||||
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
||||
@@ -86,7 +86,6 @@ namespace AzToolsFramework
|
||||
void BuildGameEntity(AZ::Entity* gameEntity) override;
|
||||
|
||||
protected:
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
// AZ::Component overrides ...
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzFramework/Components/ComponentAdapterHelpers.h>
|
||||
|
||||
@@ -28,23 +28,21 @@ namespace AzToolsFramework
|
||||
template<typename TController, typename TRuntimeComponent, typename TConfiguration>
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<EditorComponentAdapter, EditorComponentBase>()
|
||||
->Version(1)
|
||||
->Field("Controller", &EditorComponentAdapter::m_controller)
|
||||
;
|
||||
serializeContext->Class<EditorComponentAdapter, EditorComponentBase>()->Version(1)->Field(
|
||||
"Controller", &EditorComponentAdapter::m_controller);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<EditorComponentAdapter>(
|
||||
"EditorComponentAdapter", "")
|
||||
// clang-format off
|
||||
editContext->Class<EditorComponentAdapter>("EditorComponentAdapter", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &EditorComponentAdapter::m_controller, "Controller", "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorComponentAdapter::OnConfigurationChanged)
|
||||
;
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorComponentAdapter::OnConfigurationChanged);
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,27 +51,35 @@ namespace AzToolsFramework
|
||||
// Get*Services functions
|
||||
|
||||
template<typename TController, typename TRuntimeComponent, typename TConfiguration>
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetProvidedServices(
|
||||
AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
{
|
||||
AzFramework::Components::GetProvidedServicesHelper<TController>(services, typename AZ::HasComponentProvidedServices<TController>::type());
|
||||
AzFramework::Components::GetProvidedServicesHelper<TController>(
|
||||
services, typename AZ::HasComponentProvidedServices<TController>::type());
|
||||
}
|
||||
|
||||
template<typename TController, typename TRuntimeComponent, typename TConfiguration>
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetRequiredServices(
|
||||
AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
{
|
||||
AzFramework::Components::GetRequiredServicesHelper<TController>(services, typename AZ::HasComponentRequiredServices<TController>::type());
|
||||
AzFramework::Components::GetRequiredServicesHelper<TController>(
|
||||
services, typename AZ::HasComponentRequiredServices<TController>::type());
|
||||
}
|
||||
|
||||
template<typename TController, typename TRuntimeComponent, typename TConfiguration>
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetIncompatibleServices(
|
||||
AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
{
|
||||
AzFramework::Components::GetIncompatibleServicesHelper<TController>(services, typename AZ::HasComponentIncompatibleServices<TController>::type());
|
||||
AzFramework::Components::GetIncompatibleServicesHelper<TController>(
|
||||
services, typename AZ::HasComponentIncompatibleServices<TController>::type());
|
||||
}
|
||||
|
||||
template<typename TController, typename TRuntimeComponent, typename TConfiguration>
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
void EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::GetDependentServices(
|
||||
AZ::ComponentDescriptor::DependencyArrayType& services)
|
||||
{
|
||||
AzFramework::Components::GetDependentServicesHelper<TController>(services, typename AZ::HasComponentDependentServices<TController>::type());
|
||||
AzFramework::Components::GetDependentServicesHelper<TController>(
|
||||
services, typename AZ::HasComponentDependentServices<TController>::type());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -99,7 +105,8 @@ namespace AzToolsFramework
|
||||
|
||||
if (ShouldActivateController())
|
||||
{
|
||||
m_controller.Activate(GetEntityId());
|
||||
AzFramework::Components::ComponentActivateHelper<TController>::Activate(
|
||||
m_controller, AZ::EntityComponentIdPair(GetEntityId(), GetId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +129,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
template<typename TController, typename TRuntimeComponent, typename TConfiguration>
|
||||
bool EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const
|
||||
bool EditorComponentAdapter<TController, TRuntimeComponent, TConfiguration>::WriteOutConfig(
|
||||
AZ::ComponentConfig* outBaseConfig) const
|
||||
{
|
||||
if (auto config = azrtti_cast<TConfiguration*>(outBaseConfig))
|
||||
{
|
||||
@@ -139,7 +147,8 @@ namespace AzToolsFramework
|
||||
|
||||
if (ShouldActivateController())
|
||||
{
|
||||
m_controller.Activate(GetEntityId());
|
||||
AzFramework::Components::ComponentActivateHelper<TController>::Activate(
|
||||
m_controller, AZ::EntityComponentIdPair(GetEntityId(), GetId()));
|
||||
}
|
||||
|
||||
return AZ::Edit::PropertyRefreshLevels::None;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <AzCore/Asset/AssetManagerBus.h>
|
||||
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/API/EditorViewportIconDisplayInterface.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h>
|
||||
@@ -313,8 +314,7 @@ namespace AzToolsFramework
|
||||
// if we do not yet have a valid texture id, request it using the entity icon path
|
||||
if (m_entityIconTextureId == 0)
|
||||
{
|
||||
EditorRequestBus::BroadcastResult(
|
||||
m_entityIconTextureId, &EditorRequests::GetIconTextureIdFromEntityIconPath, m_entityIconPath);
|
||||
m_entityIconTextureId = EditorViewportIconDisplay::Get()->GetOrLoadIconForPath(m_entityIconPath);
|
||||
}
|
||||
|
||||
return m_entityIconTextureId;
|
||||
|
||||
@@ -520,91 +520,13 @@ namespace AzToolsFramework
|
||||
return m_editorTransform.m_translate.GetZ();
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotation(const AZ::Vector3& eulerAnglesRadians)
|
||||
void TransformComponent::SetWorldRotationQuaternion(const AZ::Quaternion& quaternion)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "SetRotation is deprecated, please use SetLocalRotation");
|
||||
AZ::Transform newWorldTransform = GetWorldTM();
|
||||
newWorldTransform.SetRotation(AZ::ConvertEulerRadiansToQuaternion(eulerAnglesRadians));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationQuaternion(const AZ::Quaternion& quaternion)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "SetRotationQuaternion is deprecated, please use SetLocalRotation");
|
||||
AZ::Transform newWorldTransform = GetWorldTM();
|
||||
newWorldTransform.SetRotation(quaternion);
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationX(float eulerAngleRadians)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "SetRotationX is deprecated, please use SetLocalRotation");
|
||||
AZ::Transform newWorldTransform = GetWorldTM();
|
||||
newWorldTransform.SetRotation(AZ::Quaternion::CreateRotationX(eulerAngleRadians));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationY(float eulerAngleRadians)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "SetRotationY is deprecated, please use SetLocalRotation");
|
||||
AZ::Transform newWorldTransform = GetWorldTM();
|
||||
newWorldTransform.SetRotation(AZ::Quaternion::CreateRotationY(eulerAngleRadians));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::SetRotationZ(float eulerAngleRadians)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "SetRotationZ is deprecated, please use SetLocalRotation");
|
||||
AZ::Transform newWorldTransform = GetWorldTM();
|
||||
newWorldTransform.SetRotation(AZ::Quaternion::CreateRotationZ(eulerAngleRadians));
|
||||
SetWorldTM(newWorldTransform);
|
||||
}
|
||||
|
||||
void TransformComponent::RotateByX(float eulerAngleRadians)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "RotateByX is deprecated, please use RotateAroundLocalX");
|
||||
SetWorldTM(GetWorldTM() * AZ::Transform::CreateRotationX(eulerAngleRadians));
|
||||
}
|
||||
|
||||
void TransformComponent::RotateByY(float eulerAngleRadians)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "RotateByY is deprecated, please use RotateAroundLocalY");
|
||||
SetWorldTM(GetWorldTM() * AZ::Transform::CreateRotationY(eulerAngleRadians));
|
||||
}
|
||||
|
||||
void TransformComponent::RotateByZ(float eulerAngleRadians)
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "RotateByZ is deprecated, please use RotateAroundLocalZ");
|
||||
SetWorldTM(GetWorldTM() * AZ::Transform::CreateRotationZ(eulerAngleRadians));
|
||||
}
|
||||
|
||||
AZ::Vector3 TransformComponent::GetRotationEulerRadians()
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "GetRotationEulerRadians is deprecated, please use GetWorldRotation");
|
||||
return GetWorldTM().GetRotation().GetEulerRadians();
|
||||
}
|
||||
|
||||
AZ::Quaternion TransformComponent::GetRotationQuaternion()
|
||||
{
|
||||
AZ_Warning("AzToolsFramework::TransformComponent", false, "GetRotationQuaternion is deprecated, please use GetWorldRotationQuaternion");
|
||||
return GetWorldTM().GetRotation();
|
||||
}
|
||||
|
||||
float TransformComponent::GetRotationX()
|
||||
{
|
||||
return GetRotationEulerRadians().GetX();
|
||||
}
|
||||
|
||||
float TransformComponent::GetRotationY()
|
||||
{
|
||||
return GetRotationEulerRadians().GetY();
|
||||
}
|
||||
|
||||
float TransformComponent::GetRotationZ()
|
||||
{
|
||||
return GetRotationEulerRadians().GetZ();
|
||||
}
|
||||
|
||||
AZ::Vector3 TransformComponent::GetWorldRotation()
|
||||
{
|
||||
return GetWorldTM().GetRotation().GetEulerRadians();
|
||||
|
||||
@@ -99,22 +99,7 @@ namespace AzToolsFramework
|
||||
float GetLocalZ() override;
|
||||
|
||||
// Rotation modifiers
|
||||
void SetRotation(const AZ::Vector3& eulerAnglesRadians) override;
|
||||
void SetRotationQuaternion(const AZ::Quaternion& quaternion) override;
|
||||
void SetRotationX(float eulerAngleRadians) override;
|
||||
void SetRotationY(float eulerAngleRadians) override;
|
||||
void SetRotationZ(float eulerAngleRadians) override;
|
||||
|
||||
void RotateByX(float eulerAngleRadians) override;
|
||||
void RotateByY(float eulerAngleRadians) override;
|
||||
void RotateByZ(float eulerAngleRadians) override;
|
||||
|
||||
AZ::Vector3 GetRotationEulerRadians() override;
|
||||
AZ::Quaternion GetRotationQuaternion() override;
|
||||
|
||||
float GetRotationX() override;
|
||||
float GetRotationY() override;
|
||||
float GetRotationZ() override;
|
||||
void SetWorldRotationQuaternion(const AZ::Quaternion& quaternion) override;
|
||||
|
||||
AZ::Vector3 GetWorldRotation() override;
|
||||
AZ::Quaternion GetWorldRotationQuaternion() override;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <AzToolsFramework/Viewport/ViewportTypes.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
#include <AzToolsFramework/API/EditorViewportIconDisplayInterface.h>
|
||||
|
||||
AZ_CVAR(
|
||||
bool, ed_visibility_showAggregateEntitySelectionBounds, false, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
@@ -232,10 +233,14 @@ namespace AzToolsFramework
|
||||
return AZ::Color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}();
|
||||
|
||||
debugDisplay.SetColor(iconHighlight);
|
||||
// debugDisplay.DrawTextureLabel(
|
||||
// iconTextureId, entityPosition, iconSize, iconSize,
|
||||
// /*DisplayContext::ETextureIconFlags::TEXICON_ON_TOP=*/ 0x0008);
|
||||
EditorViewportIconDisplay::Get()->DrawIcon({
|
||||
viewportInfo.m_viewportId,
|
||||
iconTextureId,
|
||||
iconHighlight,
|
||||
entityPosition,
|
||||
EditorViewportIconDisplayInterface::CoordinateSpace::WorldSpace,
|
||||
AZ::Vector2{iconSize, iconSize}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,14 +809,12 @@ namespace AzToolsFramework
|
||||
EntityIdManipulators& entityIdManipulators,
|
||||
OptionalFrame& pivotOverrideFrame,
|
||||
ViewportInteraction::KeyboardModifiers& prevModifiers,
|
||||
bool& transformChangedInternally, SpaceCluster spaceCluster)
|
||||
bool& transformChangedInternally, const AZStd::optional<ReferenceFrame> spaceLock)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
entityIdManipulators.m_manipulators->SetLocalPosition(action.LocalPosition());
|
||||
|
||||
const ReferenceFrame referenceFrame = spaceCluster.m_spaceLock ? spaceCluster.m_currentSpace : ReferenceFrameFromModifiers(action.m_modifiers);
|
||||
|
||||
if (action.m_modifiers.Ctrl())
|
||||
{
|
||||
// moving with ctrl - setting override
|
||||
@@ -826,6 +824,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
else
|
||||
{
|
||||
const ReferenceFrame referenceFrame = spaceLock.value_or(ReferenceFrameFromModifiers(action.m_modifiers));
|
||||
|
||||
// note: used for parent and world depending on the current reference frame
|
||||
const auto pivotOrientation =
|
||||
ETCS::CalculateSelectionPivotOrientation(
|
||||
@@ -1298,7 +1298,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
UpdateTranslationManipulator(
|
||||
action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, m_pivotOverrideFrame, prevModifiers,
|
||||
m_transformChangedInternally, m_spaceCluster);
|
||||
m_transformChangedInternally, m_spaceCluster.m_spaceLock);
|
||||
});
|
||||
|
||||
translationManipulators->InstallLinearManipulatorMouseUpCallback(
|
||||
@@ -1329,7 +1329,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
UpdateTranslationManipulator(
|
||||
action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, m_pivotOverrideFrame, prevModifiers,
|
||||
m_transformChangedInternally, m_spaceCluster);
|
||||
m_transformChangedInternally, m_spaceCluster.m_spaceLock);
|
||||
});
|
||||
|
||||
translationManipulators->InstallPlanarManipulatorMouseUpCallback(
|
||||
@@ -1359,7 +1359,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
UpdateTranslationManipulator(
|
||||
action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, m_pivotOverrideFrame, prevModifiers,
|
||||
m_transformChangedInternally, m_spaceCluster);
|
||||
m_transformChangedInternally, m_spaceCluster.m_spaceLock);
|
||||
});
|
||||
|
||||
translationManipulators->InstallSurfaceManipulatorMouseUpCallback(
|
||||
@@ -1437,8 +1437,7 @@ namespace AzToolsFramework
|
||||
[this, prevModifiers, sharedRotationState]
|
||||
(const AngularManipulator::Action& action) mutable -> void
|
||||
{
|
||||
const ReferenceFrame referenceFrame = m_spaceCluster.m_spaceLock ? m_spaceCluster.m_currentSpace : ReferenceFrameFromModifiers(action.m_modifiers);
|
||||
|
||||
const ReferenceFrame referenceFrame = m_spaceCluster.m_spaceLock.value_or(ReferenceFrameFromModifiers(action.m_modifiers));
|
||||
const AZ::Quaternion manipulatorOrientation = action.m_start.m_rotation * action.m_current.m_delta;
|
||||
// store the pivot override frame when positioning the manipulator manually (ctrl)
|
||||
// so we don't lose the orientation when adding/removing entities from the selection
|
||||
@@ -2605,40 +2604,37 @@ namespace AzToolsFramework
|
||||
if (buttonId == m_spaceCluster.m_localButtonId)
|
||||
{
|
||||
// Unlock
|
||||
if (m_spaceCluster.m_spaceLock && m_spaceCluster.m_currentSpace == ReferenceFrame::Local)
|
||||
if (m_spaceCluster.m_spaceLock.has_value() && m_spaceCluster.m_spaceLock.value() == ReferenceFrame::Local)
|
||||
{
|
||||
m_spaceCluster.m_spaceLock = false;
|
||||
m_spaceCluster.m_spaceLock = AZStd::nullopt;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_spaceCluster.m_spaceLock = true;
|
||||
m_spaceCluster.m_currentSpace = ReferenceFrame::Local;
|
||||
m_spaceCluster.m_spaceLock = ReferenceFrame::Local;
|
||||
}
|
||||
}
|
||||
else if (buttonId == m_spaceCluster.m_parentButtonId)
|
||||
{
|
||||
// Unlock
|
||||
if (m_spaceCluster.m_spaceLock && m_spaceCluster.m_currentSpace == ReferenceFrame::Parent)
|
||||
if (m_spaceCluster.m_spaceLock.has_value() && m_spaceCluster.m_spaceLock.value() == ReferenceFrame::Parent)
|
||||
{
|
||||
m_spaceCluster.m_spaceLock = false;
|
||||
m_spaceCluster.m_spaceLock = AZStd::nullopt;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_spaceCluster.m_spaceLock = true;
|
||||
m_spaceCluster.m_currentSpace = ReferenceFrame::Parent;
|
||||
m_spaceCluster.m_spaceLock = ReferenceFrame::Parent;
|
||||
}
|
||||
}
|
||||
else if (buttonId == m_spaceCluster.m_worldButtonId)
|
||||
{
|
||||
// Unlock
|
||||
if (m_spaceCluster.m_spaceLock && m_spaceCluster.m_currentSpace == ReferenceFrame::World)
|
||||
if (m_spaceCluster.m_spaceLock.has_value() && m_spaceCluster.m_spaceLock.value() == ReferenceFrame::World)
|
||||
{
|
||||
m_spaceCluster.m_spaceLock = false;
|
||||
m_spaceCluster.m_spaceLock = AZStd::nullopt;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_spaceCluster.m_spaceLock = true;
|
||||
m_spaceCluster.m_currentSpace = ReferenceFrame::World;
|
||||
m_spaceCluster.m_spaceLock = ReferenceFrame::World;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -3361,8 +3357,7 @@ namespace AzToolsFramework
|
||||
ViewportInteraction::BuildMouseButtons(
|
||||
QGuiApplication::mouseButtons()), m_boxSelect.Active());
|
||||
|
||||
const ReferenceFrame referenceFrame =
|
||||
m_spaceCluster.m_spaceLock ? m_spaceCluster.m_currentSpace : ReferenceFrameFromModifiers(modifiers);
|
||||
const ReferenceFrame referenceFrame = m_spaceCluster.m_spaceLock.value_or(ReferenceFrameFromModifiers(modifiers));
|
||||
|
||||
UpdateSpaceCluster(referenceFrame);
|
||||
|
||||
|
||||
@@ -106,15 +106,20 @@ namespace AzToolsFramework
|
||||
World, //!< World space (space aligned to world axes - identity).
|
||||
};
|
||||
|
||||
//! Grouping of viewport ui related state for controlling the current reference space of the Editor.
|
||||
struct SpaceCluster
|
||||
{
|
||||
ViewportUi::ClusterId m_spaceClusterId;
|
||||
ViewportUi::ButtonId m_localButtonId;
|
||||
ViewportUi::ButtonId m_parentButtonId;
|
||||
ViewportUi::ButtonId m_worldButtonId;
|
||||
AZ::Event<ViewportUi::ButtonId>::Handler m_spaceSelectionHandler;
|
||||
ReferenceFrame m_currentSpace = ReferenceFrame::Parent;
|
||||
bool m_spaceLock = false;
|
||||
SpaceCluster() = default;
|
||||
// disable copying and moving (implicit)
|
||||
SpaceCluster(const SpaceCluster&) = delete;
|
||||
SpaceCluster& operator=(const SpaceCluster&) = delete;
|
||||
|
||||
ViewportUi::ClusterId m_spaceClusterId; //!< The id identifying the reference space cluster.
|
||||
ViewportUi::ButtonId m_localButtonId; //!< Local reference space button id.
|
||||
ViewportUi::ButtonId m_parentButtonId; //!< Parent reference space button id.
|
||||
ViewportUi::ButtonId m_worldButtonId; //!< World reference space button id.
|
||||
AZ::Event<ViewportUi::ButtonId>::Handler m_spaceSelectionHandler; //!< Callback for when a space cluster button is pressed.
|
||||
AZStd::optional<ReferenceFrame> m_spaceLock; //!< Locked reference frame to use if set.
|
||||
};
|
||||
|
||||
//! Entity selection/interaction handling.
|
||||
@@ -265,6 +270,9 @@ namespace AzToolsFramework
|
||||
void SetEntityLocalScale(AZ::EntityId entityId, float localScale);
|
||||
void SetEntityLocalRotation(AZ::EntityId entityId, const AZ::Vector3& localRotation);
|
||||
|
||||
// Responsible for keeping the space cluster in sync with the current reference frame.
|
||||
void UpdateSpaceCluster(ReferenceFrame referenceFrame);
|
||||
|
||||
AZ::EntityId m_hoveredEntityId; //!< What EntityId is the mouse currently hovering over (if any).
|
||||
AZ::EntityId m_cachedEntityIdUnderCursor; //!< Store the EntityId on each mouse move for use in Display.
|
||||
AZ::EntityId m_editorCameraComponentEntityId; //!< The EditorCameraComponent EntityId if it is set.
|
||||
@@ -297,9 +305,7 @@ namespace AzToolsFramework
|
||||
AZ::Event<ViewportUi::ButtonId>::Handler m_transformModeSelectionHandler; //!< Event handler for the Viewport UI cluster.
|
||||
AzFramework::ClickDetector m_clickDetector; //!< Detect different types of mouse click.
|
||||
AzFramework::CursorState m_cursorState; //!< Track the mouse position and delta movement each frame.
|
||||
|
||||
SpaceCluster m_spaceCluster;
|
||||
void UpdateSpaceCluster(ReferenceFrame referenceFrame);
|
||||
SpaceCluster m_spaceCluster; //!< Related viewport ui state for controlling the current reference space.
|
||||
};
|
||||
|
||||
//! The ETCS (EntityTransformComponentSelection) namespace contains functions and data used exclusively by
|
||||
|
||||
@@ -46,6 +46,7 @@ set(FILES
|
||||
API/EditorWindowRequestBus.h
|
||||
API/EntityCompositionRequestBus.h
|
||||
API/EntityCompositionNotificationBus.h
|
||||
API/EditorViewportIconDisplayInterface.h
|
||||
API/ViewPaneOptions.h
|
||||
Application/Ticker.h
|
||||
Application/Ticker.cpp
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace UnitTest
|
||||
}
|
||||
|
||||
m_testPlatforms[0] = AzFramework::PlatformId::PC;
|
||||
m_testPlatforms[1] = AzFramework::PlatformId::ES3;
|
||||
m_testPlatforms[1] = AzFramework::PlatformId::ANDROID_ID;
|
||||
|
||||
int platformCount = 0;
|
||||
for(auto thisPlatform : m_testPlatforms)
|
||||
@@ -170,20 +170,20 @@ namespace UnitTest
|
||||
AzFramework::AssetCatalog assetCatalog(useRequestBus);
|
||||
|
||||
AZStd::string pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
|
||||
AZStd::string es3CatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ES3);
|
||||
AZStd::string androidCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
|
||||
|
||||
if (!assetCatalog.SaveCatalog(pcCatalogFile.c_str(), m_assetRegistry))
|
||||
{
|
||||
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to save the asset catalog (PC) file.\n").c_str());
|
||||
}
|
||||
|
||||
if (!assetCatalog.SaveCatalog(es3CatalogFile.c_str(), m_assetRegistry))
|
||||
if (!assetCatalog.SaveCatalog(androidCatalogFile.c_str(), m_assetRegistry))
|
||||
{
|
||||
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to save the asset catalog (ES3) file.\n").c_str());
|
||||
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to save the asset catalog (ANDROID) file.\n").c_str());
|
||||
}
|
||||
|
||||
m_pcCatalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::PC);
|
||||
m_es3Catalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::ES3);
|
||||
m_androidCatalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::ANDROID_ID);
|
||||
|
||||
const AZStd::string engroot = AZ::Test::GetEngineRootPath();
|
||||
AZ::IO::FileIOBase::GetInstance()->SetAlias("@engroot@", engroot.c_str());
|
||||
@@ -227,21 +227,21 @@ namespace UnitTest
|
||||
}
|
||||
|
||||
auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
|
||||
auto es3CatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ES3);
|
||||
auto androidCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
|
||||
if (fileIO->Exists(pcCatalogFile.c_str()))
|
||||
{
|
||||
fileIO->Remove(pcCatalogFile.c_str());
|
||||
}
|
||||
|
||||
if (fileIO->Exists(es3CatalogFile.c_str()))
|
||||
if (fileIO->Exists(androidCatalogFile.c_str()))
|
||||
{
|
||||
fileIO->Remove(es3CatalogFile.c_str());
|
||||
fileIO->Remove(androidCatalogFile.c_str());
|
||||
}
|
||||
|
||||
delete m_assetSeedManager;
|
||||
delete m_assetRegistry;
|
||||
delete m_pcCatalog;
|
||||
delete m_es3Catalog;
|
||||
delete m_androidCatalog;
|
||||
m_application->Stop();
|
||||
delete m_application;
|
||||
}
|
||||
@@ -342,10 +342,10 @@ namespace UnitTest
|
||||
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC);
|
||||
|
||||
// Step we are testing
|
||||
m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ES3);
|
||||
m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ANDROID_ID);
|
||||
|
||||
// Verification
|
||||
AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3;
|
||||
AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID;
|
||||
for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList())
|
||||
{
|
||||
EXPECT_EQ(seedInfo.m_platformFlags, expectedPlatformFlags);
|
||||
@@ -358,14 +358,14 @@ namespace UnitTest
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC);
|
||||
m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_PC);
|
||||
|
||||
m_es3Catalog->UnregisterAsset(assets[2]);
|
||||
m_androidCatalog->UnregisterAsset(assets[2]);
|
||||
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC);
|
||||
|
||||
// Step we are testing
|
||||
m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ES3);
|
||||
m_assetSeedManager->AddPlatformToAllSeeds(AzFramework::PlatformId::ANDROID_ID);
|
||||
|
||||
// Verification
|
||||
AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3;
|
||||
AzFramework::PlatformFlags expectedPlatformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID;
|
||||
for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList())
|
||||
{
|
||||
if (seedInfo.m_assetId == assets[2])
|
||||
@@ -383,14 +383,14 @@ namespace UnitTest
|
||||
{
|
||||
// Setup
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_PC);
|
||||
m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->AddSeedAsset(assets[1], AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_PC);
|
||||
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->AddSeedAsset(assets[2], AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
|
||||
// Step we are testing
|
||||
m_assetSeedManager->RemovePlatformFromAllSeeds(AzFramework::PlatformId::ES3);
|
||||
m_assetSeedManager->RemovePlatformFromAllSeeds(AzFramework::PlatformId::ANDROID_ID);
|
||||
|
||||
// Verification
|
||||
for (const auto& seedInfo : m_assetSeedManager->GetAssetSeedList())
|
||||
@@ -514,8 +514,8 @@ namespace UnitTest
|
||||
|
||||
void DependencyValidation_MultipleAssetSeeds_MultiplePlatformFlags_ListValid()
|
||||
{
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->AddSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
m_assetSeedManager->AddSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
|
||||
AzToolsFramework::AssetFileInfoList assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
|
||||
|
||||
@@ -531,7 +531,7 @@ namespace UnitTest
|
||||
|
||||
assetList.m_fileInfoList.clear();
|
||||
|
||||
m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
|
||||
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
|
||||
|
||||
@@ -547,7 +547,7 @@ namespace UnitTest
|
||||
EXPECT_TRUE(Search(assetList, assets[8]));
|
||||
|
||||
assetList.m_fileInfoList.clear();
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[5], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
|
||||
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
|
||||
|
||||
@@ -562,7 +562,7 @@ namespace UnitTest
|
||||
EXPECT_TRUE(Search(assetList, assets[8]));
|
||||
|
||||
// Removing the android flag from the asset should still produce the same result
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ES3);
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
|
||||
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace UnitTest
|
||||
EXPECT_TRUE(Search(assetList, assets[7]));
|
||||
EXPECT_TRUE(Search(assetList, assets[8]));
|
||||
|
||||
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ES3);
|
||||
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ANDROID_ID);
|
||||
|
||||
EXPECT_EQ(assetList.m_fileInfoList.size(), 5);
|
||||
EXPECT_TRUE(Search(assetList, assets[0]));
|
||||
@@ -586,8 +586,8 @@ namespace UnitTest
|
||||
EXPECT_TRUE(Search(assetList, assets[4]));
|
||||
|
||||
// Adding the android flag again to the asset
|
||||
m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ES3);
|
||||
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ES3);
|
||||
m_assetSeedManager->AddSeedAsset(assets[8], AzFramework::PlatformFlags::Platform_ANDROID);
|
||||
assetList = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::ANDROID_ID);
|
||||
|
||||
EXPECT_EQ(assetList.m_fileInfoList.size(), 8);
|
||||
EXPECT_TRUE(Search(assetList, assets[0]));
|
||||
@@ -773,7 +773,7 @@ namespace UnitTest
|
||||
AzFramework::AssetRegistry* m_assetRegistry;
|
||||
ToolsTestApplication* m_application;
|
||||
AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog;
|
||||
AzToolsFramework::PlatformAddressedAssetCatalog* m_es3Catalog;
|
||||
AzToolsFramework::PlatformAddressedAssetCatalog* m_androidCatalog;
|
||||
AZ::IO::FileIOStream m_fileStreams[s_totalTestPlatforms][s_totalAssets];
|
||||
AzFramework::PlatformId m_testPlatforms[s_totalTestPlatforms];
|
||||
AZStd::string m_assetsPath[s_totalAssets];
|
||||
@@ -936,7 +936,7 @@ namespace UnitTest
|
||||
TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_AllPlatformsValid_SeedAddedForEveryInputPlatform)
|
||||
{
|
||||
using namespace AzFramework;
|
||||
PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ES3;
|
||||
PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ANDROID;
|
||||
AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, validPlatforms);
|
||||
|
||||
// Verify the function outputs
|
||||
@@ -953,8 +953,8 @@ namespace UnitTest
|
||||
TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_SomePlatformsValid_SeedAddedForEveryValidPlatform)
|
||||
{
|
||||
using namespace AzFramework;
|
||||
PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ES3;
|
||||
PlatformFlags inputPlatforms = validPlatforms | PlatformFlags::Platform_OSX;
|
||||
PlatformFlags validPlatforms = PlatformFlags::Platform_PC | PlatformFlags::Platform_ANDROID;
|
||||
PlatformFlags inputPlatforms = validPlatforms | PlatformFlags::Platform_MAC;
|
||||
AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, inputPlatforms);
|
||||
|
||||
// Verify the function outputs
|
||||
@@ -971,7 +971,7 @@ namespace UnitTest
|
||||
TEST_F(AssetSeedManagerTest, AddSeedAssetForValidPlatforms_NoPlatformsValid_NoSeedAdded)
|
||||
{
|
||||
using namespace AzFramework;
|
||||
PlatformFlags inputPlatforms = PlatformFlags::Platform_OSX;
|
||||
PlatformFlags inputPlatforms = PlatformFlags::Platform_MAC;
|
||||
AZStd::pair<AZ::Data::AssetId, PlatformFlags> result = m_assetSeedManager->AddSeedAssetForValidPlatforms(TestDynamicSliceAssetPath, inputPlatforms);
|
||||
|
||||
// Verify the function outputs
|
||||
@@ -985,30 +985,30 @@ namespace UnitTest
|
||||
|
||||
TEST_F(AssetSeedManagerTest, Valid_Seed_Remove_ForAllPlatform_OK)
|
||||
{
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList();
|
||||
|
||||
EXPECT_EQ(seedList.size(), 0);
|
||||
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
|
||||
m_assetSeedManager->RemoveSeedAsset("asset0.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->RemoveSeedAsset("asset0.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList();
|
||||
EXPECT_EQ(secondSeedList.size(), 0);
|
||||
}
|
||||
|
||||
TEST_F(AssetSeedManagerTest, Valid_Seed_Remove_ForSpecificPlatform_OK)
|
||||
{
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[0].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_MAC);
|
||||
const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList();
|
||||
|
||||
EXPECT_EQ(seedList.size(), 1);
|
||||
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
|
||||
m_assetSeedManager->RemoveSeedAsset("asset0.txt", AzFramework::PlatformFlags::Platform_PC);
|
||||
const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList();
|
||||
@@ -1017,14 +1017,14 @@ namespace UnitTest
|
||||
|
||||
TEST_F(AssetSeedManagerTest, Invalid_NotRemove_SeedForAllPlatform_Ok)
|
||||
{
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->AddSeedAsset(assets[0], AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[1].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->RemoveSeedAsset(assets[1].ToString<AZStd::string>(), AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
const AzFramework::AssetSeedList& seedList = m_assetSeedManager->GetAssetSeedList();
|
||||
|
||||
EXPECT_EQ(seedList.size(), 1);
|
||||
|
||||
m_assetSeedManager->RemoveSeedAsset("asset1.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_OSX);
|
||||
m_assetSeedManager->RemoveSeedAsset("asset1.txt", AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_MAC);
|
||||
const AzFramework::AssetSeedList& secondSeedList = m_assetSeedManager->GetAssetSeedList();
|
||||
EXPECT_EQ(secondSeedList.size(), 1);
|
||||
}
|
||||
|
||||
@@ -184,13 +184,13 @@ namespace UnitTest
|
||||
TEST_F(PlatformAddressedAssetCatalogManagerTest, PlatformAddressedAssetCatalogManager_CatalogExistsChecks_Success)
|
||||
{
|
||||
|
||||
EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ES3), true);
|
||||
AZStd::string es3CatalogPath = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ES3);
|
||||
if (AZ::IO::FileIOBase::GetInstance()->Exists(es3CatalogPath.c_str()))
|
||||
EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ANDROID_ID), true);
|
||||
AZStd::string androidCatalogPath = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
|
||||
if (AZ::IO::FileIOBase::GetInstance()->Exists(androidCatalogPath.c_str()))
|
||||
{
|
||||
AZ::IO::FileIOBase::GetInstance()->Remove(es3CatalogPath.c_str());
|
||||
AZ::IO::FileIOBase::GetInstance()->Remove(androidCatalogPath.c_str());
|
||||
}
|
||||
EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ES3), false);
|
||||
EXPECT_EQ(AzToolsFramework::PlatformAddressedAssetCatalog::CatalogExists(AzFramework::PlatformId::ANDROID_ID), false);
|
||||
}
|
||||
|
||||
class PlatformAddressedAssetCatalogMessageTest : public AzToolsFramework::PlatformAddressedAssetCatalog
|
||||
@@ -251,7 +251,7 @@ namespace UnitTest
|
||||
AzFramework::AssetSystem::NetworkAssetUpdateInterface* notificationInterface = AZ::Interface<AzFramework::AssetSystem::NetworkAssetUpdateInterface>::Get();
|
||||
EXPECT_NE(notificationInterface, nullptr);
|
||||
|
||||
auto* mockCatalog = new ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>(AzFramework::PlatformId::ES3);
|
||||
auto* mockCatalog = new ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>(AzFramework::PlatformId::ANDROID_ID);
|
||||
AZStd::unique_ptr< ::testing::NiceMock<PlatformAddressedAssetCatalogMessageTest>> catalogHolder;
|
||||
catalogHolder.reset(mockCatalog);
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace UnitTest
|
||||
EXPECT_CALL(*mockCatalog, AssetChanged(testing::_)).Times(0);
|
||||
notificationInterface->AssetChanged(testMessage);
|
||||
|
||||
testMessage.m_platform = "es3";
|
||||
testMessage.m_platform = "android";
|
||||
EXPECT_CALL(*mockCatalog, AssetChanged(testing::_)).Times(1);
|
||||
notificationInterface->AssetChanged(testMessage);
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace UnitTest
|
||||
EXPECT_CALL(*mockCatalog, AssetRemoved(testing::_)).Times(0);
|
||||
notificationInterface->AssetRemoved(testMessage);
|
||||
|
||||
testMessage.m_platform = "es3";
|
||||
testMessage.m_platform = "android";
|
||||
EXPECT_CALL(*mockCatalog, AssetRemoved(testing::_)).Times(1);
|
||||
notificationInterface->AssetRemoved(testMessage);
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ TEST_F(PlatformHelperTest, SinglePlatformFlags_PlatformId_Valid)
|
||||
|
||||
TEST_F(PlatformHelperTest, MultiplePlatformFlags_PlatformId_Valid)
|
||||
{
|
||||
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ES3;
|
||||
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_PC | AzFramework::PlatformFlags::Platform_ANDROID;
|
||||
auto platforms = AzFramework::PlatformHelper::GetPlatforms(platformFlags);
|
||||
EXPECT_EQ(platforms.size(), 2);
|
||||
EXPECT_EQ(platforms[0], "pc");
|
||||
EXPECT_EQ(platforms[1], "es3");
|
||||
EXPECT_EQ(platforms[1], "android");
|
||||
}
|
||||
|
||||
TEST_F(PlatformHelperTest, SpecialAllFlag_PlatformId_Valid)
|
||||
@@ -42,7 +42,7 @@ TEST_F(PlatformHelperTest, SpecialAllFlag_PlatformId_Valid)
|
||||
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL;
|
||||
auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags);
|
||||
EXPECT_EQ(platforms.size(), AzFramework::NumPlatforms);
|
||||
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "provo", "salem", "jasper", "server"));
|
||||
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "android", "ios", "mac", "provo", "salem", "jasper", "server"));
|
||||
}
|
||||
|
||||
TEST_F(PlatformHelperTest, SpecialAllClientFlag_PlatformId_Valid)
|
||||
@@ -50,7 +50,7 @@ TEST_F(PlatformHelperTest, SpecialAllClientFlag_PlatformId_Valid)
|
||||
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL_CLIENT;
|
||||
auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags);
|
||||
EXPECT_EQ(platforms.size(), AzFramework::NumClientPlatforms);
|
||||
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "provo", "salem", "jasper"));
|
||||
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "android", "ios", "mac", "provo", "salem", "jasper"));
|
||||
}
|
||||
|
||||
TEST_F(PlatformHelperTest, InvalidPlatformFlags_PlatformId_Empty)
|
||||
|
||||
@@ -173,6 +173,7 @@ ly_add_target(
|
||||
RUNTIME_DEPENDENCIES
|
||||
Legacy::CrySystem
|
||||
Legacy::EditorLib
|
||||
ProjectManager
|
||||
)
|
||||
ly_add_translations(
|
||||
TARGETS Editor
|
||||
|
||||
@@ -69,6 +69,7 @@ AZ_POP_DISABLE_WARNING
|
||||
#include <AzToolsFramework/API/EditorPythonConsoleBus.h>
|
||||
#include <AzToolsFramework/API/EditorPythonRunnerRequestsBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
|
||||
#include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h>
|
||||
|
||||
// AzQtComponents
|
||||
@@ -3105,6 +3106,15 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
|
||||
GetIEditor()->GetDocument()->SetPathName(fullyQualifiedLevelName);
|
||||
GetIEditor()->GetGameEngine()->SetLevelPath(levelPath);
|
||||
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
auto* service = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
|
||||
if (service)
|
||||
{
|
||||
service->CreateNewLevelPrefab(fullyQualifiedLevelName.toUtf8().constData(), DefaultLevelTemplateName);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetIEditor()->GetDocument()->Save())
|
||||
{
|
||||
if (!usePrefabSystemForLevels)
|
||||
|
||||
@@ -358,6 +358,8 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
private:
|
||||
static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
|
||||
|
||||
struct PythonOutputHandler;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZStd::shared_ptr<PythonOutputHandler> m_pythonOutputHandler;
|
||||
|
||||
@@ -533,7 +533,7 @@ namespace AzToolsFramework
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_PC>("SystemConfigPlatform_Pc")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_OSX_GL>("SystemConfigPlatform_OsxGl")
|
||||
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_MAC>("SystemConfigPlatform_Mac")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
behaviorContext->EnumProperty<ESystemConfigPlatform::CONFIG_OSX_METAL>("SystemConfigPlatform_OsxMetal")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c042fce57915fc749abc7b37de765fd697c3c4d7de045a3d44805aa0ce29901a
|
||||
size 107016
|
||||
oid sha256:d717f77fe01f45df934a61bbc215e5322447d21e16f3cebcf2a02f148178f266
|
||||
size 106449
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <AssetImporterPlugin.h>
|
||||
#include <AssetImporterWindow.h>
|
||||
#include <QtViewPaneManager.h>
|
||||
#include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
|
||||
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
|
||||
#include <LyViewPaneNames.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
@@ -37,6 +38,10 @@ AssetImporterPlugin::AssetImporterPlugin(IEditor* editor)
|
||||
opt.showInMenu = false; // this view pane is used to display scene settings, but the user never opens it directly through the Tools menu
|
||||
opt.saveKeyName = "Scene Settings (PREVIEW)"; // user settings for this pane were originally saved with PREVIEW, so ensure that's how they are loaded as well, even after the PREVIEW is removed from the name
|
||||
AzToolsFramework::RegisterViewPane<AssetImporterWindow>(m_toolName.c_str(), LyViewPane::CategoryTools, opt);
|
||||
|
||||
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
|
||||
&AzToolsFramework::ToolsApplicationRequests::CreateAndAddEntityFromComponentTags,
|
||||
AZStd::vector<AZ::Crc32>({ AZ::SceneAPI::Events::AssetImportRequest::GetAssetImportRequestComponentTag() }), "AssetImportersEntity");
|
||||
}
|
||||
|
||||
void AssetImporterPlugin::Release()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platforms": {
|
||||
"es3": "enabled"
|
||||
"android": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace AssetBundler
|
||||
|
||||
AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(m_data->m_testEngineRoot.c_str(), m_data->m_testEngineRoot.c_str(), DummyProjectName);
|
||||
AzFramework::PlatformFlags hostPlatformFlag = AzFramework::PlatformHelper::GetPlatformFlag(AzToolsFramework::AssetSystem::GetHostAssetPlatform());
|
||||
AzFramework::PlatformFlags expectedFlags = AzFramework::PlatformFlags::Platform_ES3 | AzFramework::PlatformFlags::Platform_IOS | AzFramework::PlatformFlags::Platform_PROVO | hostPlatformFlag;
|
||||
AzFramework::PlatformFlags expectedFlags = AzFramework::PlatformFlags::Platform_ANDROID | AzFramework::PlatformFlags::Platform_IOS | AzFramework::PlatformFlags::Platform_PROVO | hostPlatformFlag;
|
||||
ASSERT_EQ(platformFlags, expectedFlags);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,14 +40,14 @@ namespace AssetBundler
|
||||
|
||||
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_MacFile_OutputBaseNameAndPlatform)
|
||||
{
|
||||
AZStd::string filePath = "assetInfoFile_osx_gl.xml";
|
||||
AZStd::string filePath = "assetInfoFile_mac.xml";
|
||||
AZStd::string baseFilename;
|
||||
AZStd::string platformIdentifier;
|
||||
|
||||
AzToolsFramework::SplitFilename(filePath, baseFilename, platformIdentifier);
|
||||
|
||||
ASSERT_EQ(baseFilename, "assetInfoFile");
|
||||
ASSERT_EQ(platformIdentifier, "osx_gl");
|
||||
ASSERT_EQ(platformIdentifier, "mac");
|
||||
}
|
||||
|
||||
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_PcFile_OutputBaseNameAndPlatform)
|
||||
@@ -64,14 +64,14 @@ namespace AssetBundler
|
||||
|
||||
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_MacFileWithUnderScoreInFileName_OutputBaseNameAndPlatform)
|
||||
{
|
||||
AZStd::string filePath = "assetInfoFile_test_osx_gl.xml";
|
||||
AZStd::string filePath = "assetInfoFile_test_mac.xml";
|
||||
AZStd::string baseFilename;
|
||||
AZStd::string platformIdentifier;
|
||||
|
||||
AzToolsFramework::SplitFilename(filePath, baseFilename, platformIdentifier);
|
||||
|
||||
ASSERT_EQ(baseFilename, "assetInfoFile_test");
|
||||
ASSERT_EQ(platformIdentifier, "osx_gl");
|
||||
ASSERT_EQ(platformIdentifier, "mac");
|
||||
}
|
||||
|
||||
TEST_F(AssetBundlerBatchUtilsTest, SplitFilename_PcFileWithUnderScoreInFileName_OutputBaseNameAndPlatform)
|
||||
|
||||
@@ -78,17 +78,17 @@ namespace AssetBuilderSDK
|
||||
{
|
||||
return AssetBuilderSDK::Platform_PC;
|
||||
}
|
||||
if (azstricmp(newPlatformName, "es3") == 0)
|
||||
if (azstricmp(newPlatformName, "android") == 0)
|
||||
{
|
||||
return AssetBuilderSDK::Platform_ES3;
|
||||
return AssetBuilderSDK::Platform_ANDROID;
|
||||
}
|
||||
if (azstricmp(newPlatformName, "ios") == 0)
|
||||
{
|
||||
return AssetBuilderSDK::Platform_IOS;
|
||||
}
|
||||
if (azstricmp(newPlatformName, "osx_gl") == 0)
|
||||
if (azstricmp(newPlatformName, "mac") == 0)
|
||||
{
|
||||
return AssetBuilderSDK::Platform_OSX;
|
||||
return AssetBuilderSDK::Platform_MAC;
|
||||
}
|
||||
if (azstricmp(newPlatformName, "provo") == 0)
|
||||
{
|
||||
@@ -115,12 +115,12 @@ namespace AssetBuilderSDK
|
||||
{
|
||||
case AssetBuilderSDK::Platform_PC:
|
||||
return "pc";
|
||||
case AssetBuilderSDK::Platform_ES3:
|
||||
return "es3";
|
||||
case AssetBuilderSDK::Platform_ANDROID:
|
||||
return "android";
|
||||
case AssetBuilderSDK::Platform_IOS:
|
||||
return "ios";
|
||||
case AssetBuilderSDK::Platform_OSX:
|
||||
return "osx_gl";
|
||||
case AssetBuilderSDK::Platform_MAC:
|
||||
return "mac";
|
||||
case AssetBuilderSDK::Platform_PROVO:
|
||||
return "provo";
|
||||
case AssetBuilderSDK::Platform_SALEM:
|
||||
|
||||
@@ -148,15 +148,15 @@ namespace AssetBuilderSDK
|
||||
{
|
||||
Platform_NONE = 0x00,
|
||||
Platform_PC = 0x01,
|
||||
Platform_ES3 = 0x02,
|
||||
Platform_ANDROID = 0x02,
|
||||
Platform_IOS = 0x04,
|
||||
Platform_OSX = 0x08,
|
||||
Platform_MAC = 0x08,
|
||||
Platform_PROVO = 0x20,
|
||||
Platform_SALEM = 0x40,
|
||||
Platform_JASPER = 0x80,
|
||||
|
||||
//! if you add a new platform entry to this enum, you must add it to allplatforms as well otherwise that platform would not be considered valid.
|
||||
AllPlatforms = Platform_PC | Platform_ES3 | Platform_IOS | Platform_OSX | Platform_PROVO | Platform_SALEM | Platform_JASPER
|
||||
AllPlatforms = Platform_PC | Platform_ANDROID | Platform_IOS | Platform_MAC | Platform_PROVO | Platform_SALEM | Platform_JASPER
|
||||
};
|
||||
#endif // defined(ENABLE_LEGACY_PLATFORMFLAGS_SUPPORT)
|
||||
//! Map data structure to holder parameters that are passed into a job for ProcessJob requests.
|
||||
@@ -503,7 +503,7 @@ namespace AssetBuilderSDK
|
||||
AZ_CLASS_ALLOCATOR(PlatformInfo, AZ::SystemAllocator, 0);
|
||||
AZ_TYPE_INFO(PlatformInfo, "{F7DA39A5-C319-4552-954B-3479E2454D3F}");
|
||||
|
||||
AZStd::string m_identifier; ///< like "pc" or "es3" or "ios"...
|
||||
AZStd::string m_identifier; ///< like "pc" or "android" or "ios"...
|
||||
AZStd::unordered_set<AZStd::string> m_tags; ///< The tags like "console" or "tools" on that platform
|
||||
|
||||
PlatformInfo() = default;
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace AssetProcessor
|
||||
void BuildConfig(const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config)
|
||||
{
|
||||
config.EnablePlatform({ "pc" ,{ "desktop", "renderer" } }, true);
|
||||
config.EnablePlatform({ "es3" ,{ "mobile", "renderer" } }, true);
|
||||
config.EnablePlatform({ "android" ,{ "mobile", "renderer" } }, true);
|
||||
config.EnablePlatform({ "fandango" ,{ "console", "renderer" } }, false);
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
@@ -254,22 +254,22 @@ namespace AssetProcessor
|
||||
|
||||
AssetRecognizer rec;
|
||||
AssetPlatformSpec specpc;
|
||||
AssetPlatformSpec speces3;
|
||||
AssetPlatformSpec specandroid;
|
||||
|
||||
speces3.m_extraRCParams = "somerandomparam";
|
||||
specandroid.m_extraRCParams = "somerandomparam";
|
||||
rec.m_name = "random files";
|
||||
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.random", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
rec.m_platformSpecs.insert("pc", specpc);
|
||||
config.AddRecognizer(rec);
|
||||
|
||||
specpc.m_extraRCParams = ""; // blank must work
|
||||
speces3.m_extraRCParams = "testextraparams";
|
||||
specandroid.m_extraRCParams = "testextraparams";
|
||||
|
||||
const char* builderTxt1Name = "txt files";
|
||||
rec.m_name = builderTxt1Name;
|
||||
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.txt", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
rec.m_platformSpecs.insert("pc", specpc);
|
||||
rec.m_platformSpecs.insert("es3", speces3);
|
||||
rec.m_platformSpecs.insert("android", specandroid);
|
||||
|
||||
config.AddRecognizer(rec);
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace AssetProcessor
|
||||
ignore_rec.m_name = "ignore files";
|
||||
ignore_rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.ignore", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
ignore_rec.m_platformSpecs.insert("pc", specpc);
|
||||
ignore_rec.m_platformSpecs.insert("es3", ignore_spec);
|
||||
ignore_rec.m_platformSpecs.insert("android", ignore_spec);
|
||||
config.AddRecognizer(ignore_rec);
|
||||
|
||||
ExcludeAssetRecognizer excludeRecogniser;
|
||||
@@ -1092,7 +1092,7 @@ namespace AssetProcessor
|
||||
{
|
||||
AssetCatalogTest::SetUp();
|
||||
m_platforms.push_back("pc");
|
||||
m_platforms.push_back("es3");
|
||||
m_platforms.push_back("android");
|
||||
|
||||
// 4 products for one platform, 1 product for the other.
|
||||
m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefilez.arc2");
|
||||
@@ -1100,7 +1100,7 @@ namespace AssetProcessor
|
||||
m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefile.arc2");
|
||||
m_platformToProductsForSourceWithDifferentProducts["pc"].push_back("subfolder3/basefile.azm2");
|
||||
|
||||
m_platformToProductsForSourceWithDifferentProducts["es3"].push_back("subfolder3/es3exclusivefile.azm2");
|
||||
m_platformToProductsForSourceWithDifferentProducts["android"].push_back("subfolder3/androidexclusivefile.azm2");
|
||||
|
||||
m_sourceFileWithDifferentProductsPerPlatform = AZ::Uuid::CreateString("{38032FC9-2838-4D6A-9DA0-79E5E4F20C1B}");
|
||||
m_sourceFileWithDependency = AZ::Uuid::CreateString("{807C4174-1D19-42AD-B8BC-A59291D9388C}");
|
||||
@@ -1113,7 +1113,7 @@ namespace AssetProcessor
|
||||
// resulting in image processing jobs having different products per platform. Because of this, the material jobs will then have different
|
||||
// dependencies per platform, because each material will depend on a referenced texture and all of that texture's mipmaps.
|
||||
|
||||
// Add a source file with 4 products on pc, but 1 on es3
|
||||
// Add a source file with 4 products on pc, but 1 on android
|
||||
bool result = AddSourceAndJobForMultiplePlatforms(
|
||||
"subfolder3",
|
||||
"MultiplatformFile.txt",
|
||||
@@ -1128,7 +1128,7 @@ namespace AssetProcessor
|
||||
result = AddSourceAndJobForMultiplePlatforms("subfolder3", "FileWithDependency.txt", &(m_data->m_dbConn), sourceFileWithSameProductsJobsPerPlatform, m_platforms, m_sourceFileWithDependency);
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
const AZStd::string fileWithDependencyProductPath = "subfolder3/es3exclusivefile.azm2";
|
||||
const AZStd::string fileWithDependencyProductPath = "subfolder3/androidexclusivefile.azm2";
|
||||
|
||||
for (const AZStd::string& platform : m_platforms)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace AssetProcessor
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
{ "pc", {}
|
||||
}, { "es3", {}
|
||||
}, { "android", {}
|
||||
}
|
||||
};
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformsCount(), 2);
|
||||
@@ -48,19 +48,19 @@ namespace AssetProcessor
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_NONE);
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
{ "es3", {}
|
||||
{ "android", {}
|
||||
}
|
||||
};
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(0), AssetBuilderSDK::Platform_ES3);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(0), AssetBuilderSDK::Platform_ANDROID);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_NONE);
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
{ "pc", {}
|
||||
}, { "es3", {}
|
||||
}, { "android", {}
|
||||
}
|
||||
};
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(0), AssetBuilderSDK::Platform_PC);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_ES3);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_ANDROID);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(2), AssetBuilderSDK::Platform_NONE);
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
@@ -72,24 +72,24 @@ namespace AssetProcessor
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
{ "pc", {}
|
||||
}, { "es3", {}
|
||||
}, { "android", {}
|
||||
}, { "ios", {}
|
||||
}, { "osx_gl", {}
|
||||
}, { "mac", {}
|
||||
}
|
||||
};
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(0), AssetBuilderSDK::Platform_PC);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_ES3);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_ANDROID);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(2), AssetBuilderSDK::Platform_IOS);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(3), AssetBuilderSDK::Platform_OSX);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(3), AssetBuilderSDK::Platform_MAC);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(4), AssetBuilderSDK::Platform_NONE);
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
{ "pc", {}
|
||||
}, { "es3", {}
|
||||
}, { "android", {}
|
||||
}
|
||||
};
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(0), AssetBuilderSDK::Platform_PC);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_ES3);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_ANDROID);
|
||||
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(2), AssetBuilderSDK::Platform_NONE);
|
||||
// using a deprecated API should have generated warnings.
|
||||
// but we can't test for it because these warnings are WarningOnce and some other unit test might have already triggered it
|
||||
@@ -106,23 +106,23 @@ namespace AssetProcessor
|
||||
}
|
||||
};
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_PC));
|
||||
ASSERT_FALSE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_ES3));
|
||||
ASSERT_FALSE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_ANDROID));
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
{ "pc", {}
|
||||
}, { "es3", {}
|
||||
}, { "android", {}
|
||||
}
|
||||
};
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_PC));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_ES3));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_ANDROID));
|
||||
|
||||
createJobsRequest.m_enabledPlatforms = {
|
||||
{ "pc", {}
|
||||
}, { "es3", {}
|
||||
}, { "android", {}
|
||||
}
|
||||
};
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_PC));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_ES3));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformEnabled(AssetBuilderSDK::Platform_ANDROID));
|
||||
// using a deprecated API should have generated warnings.
|
||||
// but we can't test for it because these warnings are WarningOnce and some other unit test might have already triggered it
|
||||
}
|
||||
@@ -133,9 +133,9 @@ namespace AssetProcessor
|
||||
UnitTestUtils::AssertAbsorber absorb;
|
||||
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_PC));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_ES3));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_ANDROID));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_IOS));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_OSX));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_MAC));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_PROVO));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_SALEM));
|
||||
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_JASPER));
|
||||
|
||||
@@ -4020,15 +4020,15 @@ TEST_F(ModtimeScanningTest, ModtimeSkipping_EnablePlatform_ShouldProcessFilesFor
|
||||
m_assetProcessorManager->m_allowModtimeSkippingFeature = true;
|
||||
AssetUtilities::SetUseFileHashOverride(true, true);
|
||||
|
||||
// Enable es3 platform after the initial SetUp has already processed the files for pc
|
||||
// Enable android platform after the initial SetUp has already processed the files for pc
|
||||
QDir tempPath(m_tempDir.path());
|
||||
AssetBuilderSDK::PlatformInfo es3Platform("es3", { "host", "renderer" });
|
||||
m_config->EnablePlatform(es3Platform, true);
|
||||
AssetBuilderSDK::PlatformInfo androidPlatform("android", { "host", "renderer" });
|
||||
m_config->EnablePlatform(androidPlatform, true);
|
||||
|
||||
// There's no way to remove scanfolders and adding a new one after enabling the platform will cause the pc assets to build as well, which we don't want
|
||||
// Instead we'll just const cast the vector and modify the enabled platforms for the scanfolder
|
||||
auto& platforms = const_cast<AZStd::vector<AssetBuilderSDK::PlatformInfo>&>(m_config->GetScanFolderAt(0).GetPlatforms());
|
||||
platforms.push_back(es3Platform);
|
||||
platforms.push_back(androidPlatform);
|
||||
|
||||
// We need the builder fingerprints to be updated to reflect the newly enabled platform
|
||||
m_assetProcessorManager->ComputeBuilderDirty();
|
||||
@@ -4036,10 +4036,10 @@ TEST_F(ModtimeScanningTest, ModtimeSkipping_EnablePlatform_ShouldProcessFilesFor
|
||||
QSet<AssetFileInfo> filePaths = BuildFileSet();
|
||||
SimulateAssetScanner(filePaths);
|
||||
|
||||
ExpectWork(4, 2); // CreateJobs = 4, 2 files * 2 platforms. ProcessJobs = 2, just the es3 platform jobs (pc is already processed)
|
||||
ExpectWork(4, 2); // CreateJobs = 4, 2 files * 2 platforms. ProcessJobs = 2, just the android platform jobs (pc is already processed)
|
||||
|
||||
ASSERT_TRUE(m_data->m_processResults[0].m_destinationPath.contains("es3"));
|
||||
ASSERT_TRUE(m_data->m_processResults[1].m_destinationPath.contains("es3"));
|
||||
ASSERT_TRUE(m_data->m_processResults[0].m_destinationPath.contains("android"));
|
||||
ASSERT_TRUE(m_data->m_processResults[1].m_destinationPath.contains("android"));
|
||||
}
|
||||
|
||||
TEST_F(ModtimeScanningTest, ModtimeSkipping_ModifyTimestamp)
|
||||
|
||||
@@ -120,14 +120,14 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Regular_Platforms)
|
||||
|
||||
// verify the data.
|
||||
ASSERT_NE(config.GetPlatformByIdentifier(AzToolsFramework::AssetSystem::GetHostAssetPlatform()), nullptr);
|
||||
ASSERT_NE(config.GetPlatformByIdentifier("es3"), nullptr);
|
||||
ASSERT_NE(config.GetPlatformByIdentifier("android"), nullptr);
|
||||
ASSERT_NE(config.GetPlatformByIdentifier("server"), nullptr);
|
||||
|
||||
ASSERT_TRUE(config.GetPlatformByIdentifier("es3")->HasTag("mobile"));
|
||||
ASSERT_TRUE(config.GetPlatformByIdentifier("es3")->HasTag("renderer"));
|
||||
ASSERT_TRUE(config.GetPlatformByIdentifier("es3")->HasTag("android"));
|
||||
ASSERT_TRUE(config.GetPlatformByIdentifier("android")->HasTag("mobile"));
|
||||
ASSERT_TRUE(config.GetPlatformByIdentifier("android")->HasTag("renderer"));
|
||||
ASSERT_TRUE(config.GetPlatformByIdentifier("android")->HasTag("android"));
|
||||
ASSERT_TRUE(config.GetPlatformByIdentifier("server")->HasTag("server"));
|
||||
ASSERT_FALSE(config.GetPlatformByIdentifier("es3")->HasTag("server"));
|
||||
ASSERT_FALSE(config.GetPlatformByIdentifier("android")->HasTag("server"));
|
||||
ASSERT_FALSE(config.GetPlatformByIdentifier("server")->HasTag("renderer"));
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularScanfolderP
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms = config.GetScanFolderAt(0).GetPlatforms();
|
||||
ASSERT_EQ(platforms.size(), 4);
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo(AzToolsFramework::AssetSystem::GetHostAssetPlatform(), AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("es3", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("android", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("ios", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("server", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
|
||||
@@ -405,12 +405,12 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularScanfolderP
|
||||
platforms = config.GetScanFolderAt(1).GetPlatforms();
|
||||
ASSERT_EQ(platforms.size(), 2);
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo(AzToolsFramework::AssetSystem::GetHostAssetPlatform(), AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("es3", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("android", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
|
||||
ASSERT_EQ(config.GetScanFolderAt(2).GetDisplayName(), QString("folder1output"));
|
||||
platforms = config.GetScanFolderAt(2).GetPlatforms();
|
||||
ASSERT_EQ(platforms.size(), 1);
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("es3", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
ASSERT_TRUE(AZStd::find(platforms.begin(), platforms.end(), AssetBuilderSDK::PlatformInfo("android", AZStd::unordered_set<AZStd::string>{})) != platforms.end());
|
||||
|
||||
ASSERT_EQ(config.GetScanFolderAt(3).GetDisplayName(), QString("folder2output"));
|
||||
platforms = config.GetScanFolderAt(3).GetPlatforms();
|
||||
@@ -454,7 +454,7 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Recognizers)
|
||||
using namespace AzToolsFramework::AssetSystem;
|
||||
using namespace AssetProcessor;
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
const char* platformWhichIsNotCurrentPlatform = "osx_gl";
|
||||
const char* platformWhichIsNotCurrentPlatform = "mac";
|
||||
#else
|
||||
const char* platformWhichIsNotCurrentPlatform = "pc";
|
||||
#endif
|
||||
@@ -475,27 +475,27 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Recognizers)
|
||||
ASSERT_EQ(recogs["i_caf"].m_patternMatcher.GetBuilderPattern().m_pattern, "*.i_caf");
|
||||
ASSERT_EQ(recogs["i_caf"].m_patternMatcher.GetBuilderPattern().m_type, AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs.size(), 2);
|
||||
ASSERT_TRUE(recogs["i_caf"].m_platformSpecs.contains("es3"));
|
||||
ASSERT_TRUE(recogs["i_caf"].m_platformSpecs.contains("android"));
|
||||
ASSERT_TRUE(recogs["i_caf"].m_platformSpecs.contains(AzToolsFramework::AssetSystem::GetHostAssetPlatform()));
|
||||
ASSERT_FALSE(recogs["i_caf"].m_platformSpecs.contains("server")); // server has been set to skip.
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs["es3"].m_extraRCParams, "mobile");
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs["android"].m_extraRCParams, "mobile");
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs[AzToolsFramework::AssetSystem::GetHostAssetPlatform()].m_extraRCParams, "defaultparams");
|
||||
|
||||
ASSERT_TRUE(recogs.contains("caf"));
|
||||
ASSERT_TRUE(recogs["caf"].m_platformSpecs.contains("es3"));
|
||||
ASSERT_TRUE(recogs["caf"].m_platformSpecs.contains("android"));
|
||||
ASSERT_TRUE(recogs["caf"].m_platformSpecs.contains("server"));
|
||||
ASSERT_TRUE(recogs["caf"].m_platformSpecs.contains(AzToolsFramework::AssetSystem::GetHostAssetPlatform()));
|
||||
ASSERT_EQ(recogs["caf"].m_platformSpecs.size(), 3);
|
||||
ASSERT_EQ(recogs["caf"].m_platformSpecs["es3"].m_extraRCParams, "rendererparams");
|
||||
ASSERT_EQ(recogs["caf"].m_platformSpecs["android"].m_extraRCParams, "rendererparams");
|
||||
ASSERT_EQ(recogs["caf"].m_platformSpecs[AzToolsFramework::AssetSystem::GetHostAssetPlatform()].m_extraRCParams, "rendererparams");
|
||||
ASSERT_EQ(recogs["caf"].m_platformSpecs["server"].m_extraRCParams, "copy");
|
||||
|
||||
ASSERT_TRUE(recogs.contains("mov"));
|
||||
ASSERT_TRUE(recogs["mov"].m_platformSpecs.contains("es3"));
|
||||
ASSERT_TRUE(recogs["mov"].m_platformSpecs.contains("android"));
|
||||
ASSERT_TRUE(recogs["mov"].m_platformSpecs.contains("server"));
|
||||
ASSERT_TRUE(recogs["mov"].m_platformSpecs.contains(AzToolsFramework::AssetSystem::GetHostAssetPlatform()));
|
||||
ASSERT_EQ(recogs["mov"].m_platformSpecs.size(), 3);
|
||||
ASSERT_EQ(recogs["mov"].m_platformSpecs["es3"].m_extraRCParams, "platformspecificoverride");
|
||||
ASSERT_EQ(recogs["mov"].m_platformSpecs["android"].m_extraRCParams, "platformspecificoverride");
|
||||
ASSERT_EQ(recogs["mov"].m_platformSpecs[AzToolsFramework::AssetSystem::GetHostAssetPlatform()].m_extraRCParams, "rendererparams");
|
||||
ASSERT_EQ(recogs["mov"].m_platformSpecs["server"].m_extraRCParams, "copy");
|
||||
|
||||
@@ -503,27 +503,27 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Recognizers)
|
||||
// (but platforms can override it)
|
||||
ASSERT_TRUE(recogs.contains("rend"));
|
||||
ASSERT_TRUE(recogs["rend"].m_platformSpecs.contains(AzToolsFramework::AssetSystem::GetHostAssetPlatform()));
|
||||
ASSERT_TRUE(recogs["rend"].m_platformSpecs.contains("es3"));
|
||||
ASSERT_TRUE(recogs["rend"].m_platformSpecs.contains("android"));
|
||||
ASSERT_TRUE(recogs["rend"].m_platformSpecs.contains("server"));
|
||||
ASSERT_FALSE(recogs["rend"].m_platformSpecs.contains(platformWhichIsNotCurrentPlatform)); // this is not an enabled platform and should not be there.
|
||||
ASSERT_EQ(recogs["rend"].m_platformSpecs.size(), 3);
|
||||
ASSERT_EQ(recogs["rend"].m_platformSpecs[AzToolsFramework::AssetSystem::GetHostAssetPlatform()].m_extraRCParams, "rendererparams");
|
||||
ASSERT_EQ(recogs["rend"].m_platformSpecs["es3"].m_extraRCParams, "rendererparams");
|
||||
ASSERT_EQ(recogs["rend"].m_platformSpecs["android"].m_extraRCParams, "rendererparams");
|
||||
ASSERT_EQ(recogs["rend"].m_platformSpecs["server"].m_extraRCParams, ""); // default if not specified is empty string
|
||||
|
||||
ASSERT_TRUE(recogs.contains("alldefault"));
|
||||
ASSERT_TRUE(recogs["alldefault"].m_platformSpecs.contains(AzToolsFramework::AssetSystem::GetHostAssetPlatform()));
|
||||
ASSERT_TRUE(recogs["alldefault"].m_platformSpecs.contains("es3"));
|
||||
ASSERT_TRUE(recogs["alldefault"].m_platformSpecs.contains("android"));
|
||||
ASSERT_TRUE(recogs["alldefault"].m_platformSpecs.contains("server"));
|
||||
ASSERT_FALSE(recogs["alldefault"].m_platformSpecs.contains(platformWhichIsNotCurrentPlatform)); // this is not an enabled platform and should not be there.
|
||||
ASSERT_EQ(recogs["alldefault"].m_platformSpecs.size(), 3);
|
||||
ASSERT_EQ(recogs["alldefault"].m_platformSpecs[AzToolsFramework::AssetSystem::GetHostAssetPlatform()].m_extraRCParams, "");
|
||||
ASSERT_EQ(recogs["alldefault"].m_platformSpecs["es3"].m_extraRCParams, "");
|
||||
ASSERT_EQ(recogs["alldefault"].m_platformSpecs["android"].m_extraRCParams, "");
|
||||
ASSERT_EQ(recogs["alldefault"].m_platformSpecs["server"].m_extraRCParams, "");
|
||||
|
||||
ASSERT_TRUE(recogs.contains("skipallbutone"));
|
||||
ASSERT_FALSE(recogs["skipallbutone"].m_platformSpecs.contains(AzToolsFramework::AssetSystem::GetHostAssetPlatform()));
|
||||
ASSERT_FALSE(recogs["skipallbutone"].m_platformSpecs.contains("es3"));
|
||||
ASSERT_FALSE(recogs["skipallbutone"].m_platformSpecs.contains("android"));
|
||||
ASSERT_TRUE(recogs["skipallbutone"].m_platformSpecs.contains("server")); // server is only one enabled (set to copy)
|
||||
ASSERT_EQ(recogs["skipallbutone"].m_platformSpecs.size(), 1);
|
||||
ASSERT_EQ(recogs["skipallbutone"].m_platformSpecs["server"].m_extraRCParams, "copy");
|
||||
@@ -549,7 +549,7 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Overrides)
|
||||
|
||||
// verify the data.
|
||||
ASSERT_NE(config.GetPlatformByIdentifier(AzToolsFramework::AssetSystem::GetHostAssetPlatform()), nullptr);
|
||||
ASSERT_NE(config.GetPlatformByIdentifier("es3"), nullptr);
|
||||
ASSERT_NE(config.GetPlatformByIdentifier("android"), nullptr);
|
||||
ASSERT_NE(config.GetPlatformByIdentifier("provo"), nullptr);
|
||||
// this override swaps server with provo in that it turns ON provo, turns off server
|
||||
ASSERT_EQ(config.GetPlatformByIdentifier("server"), nullptr); // this should be off due to overrides
|
||||
@@ -566,11 +566,11 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Overrides)
|
||||
ASSERT_EQ(recogs["i_caf"].m_patternMatcher.GetBuilderPattern().m_pattern, "*.i_caf");
|
||||
ASSERT_EQ(recogs["i_caf"].m_patternMatcher.GetBuilderPattern().m_type, AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs.size(), 3);
|
||||
ASSERT_TRUE(recogs["i_caf"].m_platformSpecs.contains("es3"));
|
||||
ASSERT_TRUE(recogs["i_caf"].m_platformSpecs.contains("android"));
|
||||
ASSERT_TRUE(recogs["i_caf"].m_platformSpecs.contains("provo"));
|
||||
ASSERT_TRUE(recogs["i_caf"].m_platformSpecs.contains(AzToolsFramework::AssetSystem::GetHostAssetPlatform()));
|
||||
ASSERT_FALSE(recogs["i_caf"].m_platformSpecs.contains("server")); // server has been set to skip.
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs["es3"].m_extraRCParams, "mobile");
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs["android"].m_extraRCParams, "mobile");
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs[AzToolsFramework::AssetSystem::GetHostAssetPlatform()].m_extraRCParams, "defaultparams");
|
||||
ASSERT_EQ(recogs["i_caf"].m_platformSpecs["provo"].m_extraRCParams, "copy");
|
||||
|
||||
|
||||
@@ -90,34 +90,34 @@ namespace AssetProcessor
|
||||
//AZ_TracePrintf("test", "-------------------------\n");
|
||||
}
|
||||
|
||||
void ComputeFingerprints(unsigned int& fingerprintForPC, unsigned int& fingerprintForES3, PlatformConfiguration& config, QString scanFolderPath, QString relPath)
|
||||
void ComputeFingerprints(unsigned int& fingerprintForPC, unsigned int& fingerprintForANDROID, PlatformConfiguration& config, QString scanFolderPath, QString relPath)
|
||||
{
|
||||
QString extraInfoForPC;
|
||||
QString extraInfoForES3;
|
||||
QString extraInfoForANDROID;
|
||||
RecognizerPointerContainer output;
|
||||
QString filePath = scanFolderPath + "/" + relPath;
|
||||
config.GetMatchingRecognizers(filePath, output);
|
||||
for (const AssetRecognizer* assetRecogniser : output)
|
||||
{
|
||||
extraInfoForPC.append(assetRecogniser->m_platformSpecs["pc"].m_extraRCParams);
|
||||
extraInfoForES3.append(assetRecogniser->m_platformSpecs["es3"].m_extraRCParams);
|
||||
extraInfoForANDROID.append(assetRecogniser->m_platformSpecs["android"].m_extraRCParams);
|
||||
extraInfoForPC.append(assetRecogniser->m_version);
|
||||
extraInfoForES3.append(assetRecogniser->m_version);
|
||||
extraInfoForANDROID.append(assetRecogniser->m_version);
|
||||
}
|
||||
|
||||
//Calculating fingerprints for the file for pc and es3 platforms
|
||||
//Calculating fingerprints for the file for pc and android platforms
|
||||
AZ::Uuid sourceId = AZ::Uuid("{2206A6E0-FDBC-45DE-B6FE-C2FC63020BD5}");
|
||||
JobEntry jobEntryPC(scanFolderPath, relPath, relPath, 0, { "pc", {"desktop", "renderer"} }, "", 0, 1, sourceId);
|
||||
JobEntry jobEntryES3(scanFolderPath, relPath, relPath, 0, { "es3", {"mobile", "renderer"} }, "", 0, 2, sourceId);
|
||||
JobEntry jobEntryANDROID(scanFolderPath, relPath, relPath, 0, { "android", {"mobile", "renderer"} }, "", 0, 2, sourceId);
|
||||
|
||||
JobDetails jobDetailsPC;
|
||||
jobDetailsPC.m_extraInformationForFingerprinting = extraInfoForPC.toUtf8().constData();
|
||||
jobDetailsPC.m_jobEntry = jobEntryPC;
|
||||
JobDetails jobDetailsES3;
|
||||
jobDetailsES3.m_extraInformationForFingerprinting = extraInfoForES3.toUtf8().constData();
|
||||
jobDetailsES3.m_jobEntry = jobEntryES3;
|
||||
JobDetails jobDetailsANDROID;
|
||||
jobDetailsANDROID.m_extraInformationForFingerprinting = extraInfoForANDROID.toUtf8().constData();
|
||||
jobDetailsANDROID.m_jobEntry = jobEntryANDROID;
|
||||
fingerprintForPC = AssetUtilities::GenerateFingerprint(jobDetailsPC);
|
||||
fingerprintForES3 = AssetUtilities::GenerateFingerprint(jobDetailsES3);
|
||||
fingerprintForANDROID = AssetUtilities::GenerateFingerprint(jobDetailsANDROID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace AssetProcessor
|
||||
|
||||
PlatformConfiguration config;
|
||||
config.EnablePlatform({ "pc",{ "desktop", "renderer" } }, true);
|
||||
config.EnablePlatform({ "es3",{ "mobile", "renderer" } }, true);
|
||||
config.EnablePlatform({ "android",{ "mobile", "renderer" } }, true);
|
||||
config.EnablePlatform({ "fandago",{ "console", "renderer" } }, false);
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
@@ -261,9 +261,9 @@ namespace AssetProcessor
|
||||
|
||||
AssetRecognizer rec;
|
||||
AssetPlatformSpec specpc;
|
||||
AssetPlatformSpec speces3;
|
||||
AssetPlatformSpec specandroid;
|
||||
|
||||
speces3.m_extraRCParams = "somerandomparam";
|
||||
specandroid.m_extraRCParams = "somerandomparam";
|
||||
rec.m_name = "random files";
|
||||
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.random", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
rec.m_platformSpecs.insert("pc", specpc);
|
||||
@@ -271,13 +271,13 @@ namespace AssetProcessor
|
||||
UNIT_TEST_EXPECT_TRUE(mockAppManager.RegisterAssetRecognizerAsBuilder(rec));
|
||||
|
||||
specpc.m_extraRCParams = ""; // blank must work
|
||||
speces3.m_extraRCParams = "testextraparams";
|
||||
specandroid.m_extraRCParams = "testextraparams";
|
||||
|
||||
const char* builderTxt1Name = "txt files";
|
||||
rec.m_name = builderTxt1Name;
|
||||
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.txt", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
rec.m_platformSpecs.insert("pc", specpc);
|
||||
rec.m_platformSpecs.insert("es3", speces3);
|
||||
rec.m_platformSpecs.insert("android", specandroid);
|
||||
|
||||
config.AddRecognizer(rec);
|
||||
|
||||
@@ -307,21 +307,21 @@ namespace AssetProcessor
|
||||
rec.m_testLockSource = false;
|
||||
|
||||
specpc.m_extraRCParams = "pcparams";
|
||||
speces3.m_extraRCParams = "es3params";
|
||||
specandroid.m_extraRCParams = "androidparams";
|
||||
|
||||
rec.m_name = "xxx files";
|
||||
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.xxx", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
rec.m_platformSpecs.insert("pc", specpc);
|
||||
rec.m_platformSpecs.insert("es3", speces3);
|
||||
rec.m_platformSpecs.insert("android", specandroid);
|
||||
config.AddRecognizer(rec);
|
||||
mockAppManager.RegisterAssetRecognizerAsBuilder(rec);
|
||||
|
||||
// two recognizers for the same pattern.
|
||||
rec.m_name = "xxx files 2 (builder2)";
|
||||
specpc.m_extraRCParams = "pcparams2";
|
||||
speces3.m_extraRCParams = "es3params2";
|
||||
specandroid.m_extraRCParams = "androidparams2";
|
||||
rec.m_platformSpecs.insert("pc", specpc);
|
||||
rec.m_platformSpecs.insert("es3", speces3);
|
||||
rec.m_platformSpecs.insert("android", specandroid);
|
||||
config.AddRecognizer(rec);
|
||||
mockAppManager.RegisterAssetRecognizerAsBuilder(rec);
|
||||
|
||||
@@ -332,7 +332,7 @@ namespace AssetProcessor
|
||||
ignore_rec.m_name = "ignore files";
|
||||
ignore_rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.ignore", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
ignore_rec.m_platformSpecs.insert("pc", specpc);
|
||||
ignore_rec.m_platformSpecs.insert("es3", ignore_spec);
|
||||
ignore_rec.m_platformSpecs.insert("android", ignore_spec);
|
||||
config.AddRecognizer(ignore_rec);
|
||||
mockAppManager.RegisterAssetRecognizerAsBuilder(ignore_rec);
|
||||
|
||||
@@ -434,7 +434,7 @@ namespace AssetProcessor
|
||||
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1); // 1, since we have one recognizer for .ignore, but the 'es3' platform is marked as skip
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1); // 1, since we have one recognizer for .ignore, but the 'android' platform is marked as skip
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
|
||||
|
||||
@@ -457,16 +457,16 @@ namespace AssetProcessor
|
||||
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and es3,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and android,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
|
||||
|
||||
QList<int> es3JobsIndex;
|
||||
QList<int> androidJobsIndex;
|
||||
QList<int> pcJobsIndex;
|
||||
for (int checkIdx = 0; checkIdx < 4; ++checkIdx)
|
||||
{
|
||||
@@ -664,19 +664,19 @@ namespace AssetProcessor
|
||||
// ---------- test successes ----------
|
||||
|
||||
|
||||
QStringList es3outs;
|
||||
es3outs.push_back(cacheRoot.filePath(QString("es3/basefile.arc1")));
|
||||
es3outs.push_back(cacheRoot.filePath(QString("es3/basefile.arc2")));
|
||||
QStringList androidouts;
|
||||
androidouts.push_back(cacheRoot.filePath(QString("android/basefile.arc1")));
|
||||
androidouts.push_back(cacheRoot.filePath(QString("android/basefile.arc2")));
|
||||
|
||||
// feed it the messages its waiting for (create the files)
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs[0], "products."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs[1], "products."))
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts[0], "products."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts[1], "products."))
|
||||
|
||||
//Invoke Asset Processed for es3 platform , txt files job description
|
||||
//Invoke Asset Processed for android platform , txt files job description
|
||||
AssetBuilderSDK::ProcessJobResponse response;
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[0].toUtf8().constData(), AZ::Uuid::CreateNull(), 1));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[1].toUtf8().constData(), AZ::Uuid::CreateNull(), 2));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[0].toUtf8().constData(), AZ::Uuid::CreateNull(), 1));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[1].toUtf8().constData(), AZ::Uuid::CreateNull(), 2));
|
||||
|
||||
// make sure legacy SubIds get stored in the DB and in asset response messages.
|
||||
// also make sure they don't get filed for the wrong asset.
|
||||
@@ -695,8 +695,8 @@ namespace AssetProcessor
|
||||
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
|
||||
|
||||
// always RELATIVE, always with the product name.
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[1].m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "android");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[1].m_platform == "android");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "basefile.arc1");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[1].m_data == "basefile.arc2");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
|
||||
@@ -795,14 +795,14 @@ namespace AssetProcessor
|
||||
changedInputResults.clear();
|
||||
assetMessages.clear();
|
||||
|
||||
es3outs.clear();
|
||||
es3outs.push_back(cacheRoot.filePath(QString("es3/basefile.azm")));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs[0], "products."));
|
||||
androidouts.clear();
|
||||
androidouts.push_back(cacheRoot.filePath(QString("android/basefile.azm")));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts[0], "products."));
|
||||
|
||||
//Invoke Asset Processed for es3 platform , txt files2 job description
|
||||
//Invoke Asset Processed for android platform , txt files2 job description
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[0].toUtf8().constData()));
|
||||
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[1].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
@@ -814,7 +814,7 @@ namespace AssetProcessor
|
||||
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
|
||||
|
||||
// always RELATIVE, always with the product name.
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "android");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "basefile.azm");
|
||||
|
||||
changedInputResults.clear();
|
||||
@@ -1004,11 +1004,11 @@ namespace AssetProcessor
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
// --------- same result as above ----------
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and es3,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and android,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_computedFingerprint != 0);
|
||||
@@ -1027,25 +1027,25 @@ namespace AssetProcessor
|
||||
|
||||
// this time make different products:
|
||||
|
||||
QStringList oldes3outs;
|
||||
QStringList oldandroidouts;
|
||||
QStringList oldpcouts;
|
||||
oldes3outs = es3outs;
|
||||
oldandroidouts = androidouts;
|
||||
oldpcouts.append(pcouts);
|
||||
QStringList es3outs2;
|
||||
QStringList androidouts2;
|
||||
QStringList pcouts2;
|
||||
es3outs.clear();
|
||||
androidouts.clear();
|
||||
pcouts.clear();
|
||||
es3outs.push_back(cacheRoot.filePath(QString("es3/basefilea.arc1")));
|
||||
es3outs2.push_back(cacheRoot.filePath(QString("es3/basefilea.azm")));
|
||||
// note that the ES3 outs have changed
|
||||
androidouts.push_back(cacheRoot.filePath(QString("android/basefilea.arc1")));
|
||||
androidouts2.push_back(cacheRoot.filePath(QString("android/basefilea.azm")));
|
||||
// note that the android outs have changed
|
||||
// but the pc outs are still the same.
|
||||
pcouts.push_back(cacheRoot.filePath(QString("pc/basefile.arc1")));
|
||||
pcouts2.push_back(cacheRoot.filePath(QString("pc/basefile.azm")));
|
||||
|
||||
// feed it the messages its waiting for (create the files)
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs2[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts2[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts2[0], "newfile."));
|
||||
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents, 50);
|
||||
@@ -1057,12 +1057,12 @@ namespace AssetProcessor
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs2[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts2[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[1].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
@@ -1085,12 +1085,12 @@ namespace AssetProcessor
|
||||
// The files removed should be the ones we did not emit this time
|
||||
// note that order isn't guarantee but an example output it this
|
||||
|
||||
// [0] Removed: ES3, basefile.arc1
|
||||
// [1] Removed: ES3, basefile.arc2
|
||||
// [2] Changed: ES3, basefilea.arc1 (added)
|
||||
// [0] Removed: ANDROID, basefile.arc1
|
||||
// [1] Removed: ANDROID, basefile.arc2
|
||||
// [2] Changed: ANDROID, basefilea.arc1 (added)
|
||||
|
||||
// [3] Removed: ES3, basefile.azm
|
||||
// [4] Changed: ES3, basefilea.azm (added)
|
||||
// [3] Removed: ANDROID, basefile.azm
|
||||
// [4] Changed: ANDROID, basefilea.azm (added)
|
||||
|
||||
// [5] changed: PC, basefile.arc1 (changed)
|
||||
// [6] changed: PC, basefile.azm (changed)
|
||||
@@ -1112,18 +1112,18 @@ namespace AssetProcessor
|
||||
if (element.m_data == "basefilea.arc1")
|
||||
{
|
||||
UNIT_TEST_EXPECT_TRUE(element.m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
|
||||
UNIT_TEST_EXPECT_TRUE(element.m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(element.m_platform == "android");
|
||||
}
|
||||
|
||||
if (element.m_data == "basefile.arc2")
|
||||
{
|
||||
UNIT_TEST_EXPECT_TRUE(element.m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetRemoved);
|
||||
UNIT_TEST_EXPECT_TRUE(element.m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(element.m_platform == "android");
|
||||
}
|
||||
}
|
||||
|
||||
// original products must no longer exist since it should have found and deleted them!
|
||||
for (QString outFile: oldes3outs)
|
||||
for (QString outFile: oldandroidouts)
|
||||
{
|
||||
UNIT_TEST_EXPECT_FALSE(QFile::exists(outFile));
|
||||
}
|
||||
@@ -1147,11 +1147,11 @@ namespace AssetProcessor
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
// --------- same result as above ----------
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // pc and es3
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // pc and android
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_computedFingerprint != 0);
|
||||
@@ -1171,12 +1171,12 @@ namespace AssetProcessor
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs2[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts2[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[1].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
@@ -1207,11 +1207,11 @@ namespace AssetProcessor
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
// --------- same result as above ----------
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and es3,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and android,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_computedFingerprint != 0);
|
||||
@@ -1222,12 +1222,12 @@ namespace AssetProcessor
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs2[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts2[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[1].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
@@ -1245,9 +1245,9 @@ namespace AssetProcessor
|
||||
|
||||
// deleting the fingerprint file should not have erased the products
|
||||
UNIT_TEST_EXPECT_TRUE(QFile::exists(pcouts[0]));
|
||||
UNIT_TEST_EXPECT_TRUE(QFile::exists(es3outs[0]));
|
||||
UNIT_TEST_EXPECT_TRUE(QFile::exists(androidouts[0]));
|
||||
UNIT_TEST_EXPECT_TRUE(QFile::exists(pcouts2[0]));
|
||||
UNIT_TEST_EXPECT_TRUE(QFile::exists(es3outs2[0]));
|
||||
UNIT_TEST_EXPECT_TRUE(QFile::exists(androidouts2[0]));
|
||||
|
||||
changedInputResults.clear();
|
||||
assetMessages.clear();
|
||||
@@ -1306,9 +1306,9 @@ namespace AssetProcessor
|
||||
}
|
||||
|
||||
UNIT_TEST_EXPECT_FALSE(QFile::exists(pcouts[0]));
|
||||
UNIT_TEST_EXPECT_FALSE(QFile::exists(es3outs[0]));
|
||||
UNIT_TEST_EXPECT_FALSE(QFile::exists(androidouts[0]));
|
||||
UNIT_TEST_EXPECT_FALSE(QFile::exists(pcouts2[0]));
|
||||
UNIT_TEST_EXPECT_FALSE(QFile::exists(es3outs2[0]));
|
||||
UNIT_TEST_EXPECT_FALSE(QFile::exists(androidouts2[0]));
|
||||
|
||||
changedInputResults.clear();
|
||||
assetMessages.clear();
|
||||
@@ -1323,28 +1323,28 @@ namespace AssetProcessor
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
// --------- same result as above ----------
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and es3,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and android,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_computedFingerprint != 0);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs2[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts2[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts2[0], "newfile."));
|
||||
|
||||
// send both done messages simultaneously!
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs2[0].toUtf8().constData()));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts2[0].toUtf8().constData()));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[1].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
// send one failure only for PC :
|
||||
@@ -1422,12 +1422,12 @@ namespace AssetProcessor
|
||||
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 3);
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 3);
|
||||
|
||||
// which should be for the ES3:
|
||||
// which should be for the ANDROID:
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(changedInputResults[0].first) == absolutePath);
|
||||
|
||||
// always RELATIVE, always with the product name.
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "basefilea.arc1" || assetMessages[0].m_data == "basefilea.azm");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "android");
|
||||
|
||||
for (auto& payload : payloadList)
|
||||
{
|
||||
@@ -1528,28 +1528,28 @@ namespace AssetProcessor
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
// --------- same result as above ----------
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and es3,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and android,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_computedFingerprint != 0);
|
||||
|
||||
es3outs.clear();
|
||||
es3outs2.clear();
|
||||
androidouts.clear();
|
||||
androidouts2.clear();
|
||||
pcouts.clear();
|
||||
pcouts2.clear();
|
||||
es3outs.push_back(cacheRoot.filePath(QString("es3/basefilez.arc2")));
|
||||
es3outs2.push_back(cacheRoot.filePath(QString("es3/basefileaz.azm2")));
|
||||
// note that the ES3 outs have changed
|
||||
androidouts.push_back(cacheRoot.filePath(QString("android/basefilez.arc2")));
|
||||
androidouts2.push_back(cacheRoot.filePath(QString("android/basefileaz.azm2")));
|
||||
// note that the android outs have changed
|
||||
// but the pc outs are still the same.
|
||||
pcouts.push_back(cacheRoot.filePath(QString("pc/basefile.arc2")));
|
||||
pcouts2.push_back(cacheRoot.filePath(QString("pc/basefile.azm2")));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(es3outs2[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(androidouts2[0], "newfile."));
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts2[0], "newfile."));
|
||||
changedInputResults.clear();
|
||||
assetMessages.clear();
|
||||
@@ -1557,12 +1557,12 @@ namespace AssetProcessor
|
||||
// send all the done messages simultaneously:
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs[0].toUtf8().constData(), AZ::Uuid::CreateNull(), 1));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts[0].toUtf8().constData(), AZ::Uuid::CreateNull(), 1));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(es3outs2[0].toUtf8().constData(), AZ::Uuid::CreateNull(), 2));
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(androidouts2[0].toUtf8().constData(), AZ::Uuid::CreateNull(), 2));
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[1].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
response.m_outputProducts.clear();
|
||||
@@ -1622,11 +1622,11 @@ namespace AssetProcessor
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
// --------- same result as above ----------
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and es3,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // 2 each for pc and android,since we have two recognizer for .txt file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_computedFingerprint != 0);
|
||||
@@ -1647,9 +1647,9 @@ namespace AssetProcessor
|
||||
absolutePath = watchFolderPath + "/" + relativePathFromWatchFolder;
|
||||
|
||||
unsigned int fingerprintForPC = 0;
|
||||
unsigned int fingerprintForES3 = 0;
|
||||
unsigned int fingerprintForANDROID = 0;
|
||||
|
||||
ComputeFingerprints(fingerprintForPC, fingerprintForES3, config, watchFolderPath, relativePathFromWatchFolder);
|
||||
ComputeFingerprints(fingerprintForPC, fingerprintForANDROID, config, watchFolderPath, relativePathFromWatchFolder);
|
||||
|
||||
processResults.clear();
|
||||
QMetaObject::invokeMethod(&apm, "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, absolutePath));
|
||||
@@ -1657,11 +1657,11 @@ namespace AssetProcessor
|
||||
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // // 2 each for pc and es3,since we have two recognizer for .xxx file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // // 2 each for pc and android,since we have two recognizer for .xxx file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
|
||||
@@ -1683,11 +1683,11 @@ namespace AssetProcessor
|
||||
// we never actually submitted any fingerprints or indicated success, so the same number of jobs should occur as before
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // // 2 each for pc and es3,since we have two recognizer for .xxx file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 4); // // 2 each for pc and android,since we have two recognizer for .xxx file
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[2].m_jobEntry.m_platformInfo.m_identifier == processResults[3].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[2].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[3].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
|
||||
@@ -1707,7 +1707,7 @@ namespace AssetProcessor
|
||||
// now re-perform the same test, this time only the pc ones should re-appear.
|
||||
// this should happen because we're changing the extra params, which should be part of the fingerprint
|
||||
// if this unit test fails, check to make sure that the extra params are being ingested into the fingerprint computation functions
|
||||
// and also make sure that the jobs that are for the remaining es3 platform don't change.
|
||||
// and also make sure that the jobs that are for the remaining android platform don't change.
|
||||
|
||||
// store the UUID so that we can insert the new one with the same UUID
|
||||
AZStd::shared_ptr<InternalMockBuilder> builderTxt2Builder;
|
||||
@@ -1745,12 +1745,12 @@ namespace AssetProcessor
|
||||
// ---------------------
|
||||
|
||||
unsigned int newfingerprintForPC = 0;
|
||||
unsigned int newfingerprintForES3 = 0;
|
||||
unsigned int newfingerprintForANDROID = 0;
|
||||
|
||||
ComputeFingerprints(newfingerprintForPC, newfingerprintForES3, config, watchFolderPath, relativePathFromWatchFolder);
|
||||
ComputeFingerprints(newfingerprintForPC, newfingerprintForANDROID, config, watchFolderPath, relativePathFromWatchFolder);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(newfingerprintForPC != fingerprintForPC);//Fingerprints should be different
|
||||
UNIT_TEST_EXPECT_TRUE(newfingerprintForES3 == fingerprintForES3);//Fingerprints are same
|
||||
UNIT_TEST_EXPECT_TRUE(newfingerprintForANDROID == fingerprintForANDROID);//Fingerprints are same
|
||||
|
||||
config.RemoveRecognizer("xxx files 2 (builder2)");
|
||||
mockAppManager.UnRegisterAssetRecognizerAsBuilder("xxx files 2 (builder2)");
|
||||
@@ -1765,18 +1765,18 @@ namespace AssetProcessor
|
||||
absolutePath = AssetUtilities::NormalizeFilePath(absolutePath);
|
||||
QMetaObject::invokeMethod(&apm, "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, absolutePath));
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 2); // pc and es3
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 2); // pc and android
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier != processResults[1].m_jobEntry.m_platformInfo.m_identifier);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc") || (processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "pc") || (processResults[1].m_jobEntry.m_platformInfo.m_identifier == "es3"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc") || (processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[1].m_jobEntry.m_platformInfo.m_identifier == "pc") || (processResults[1].m_jobEntry.m_platformInfo.m_identifier == "android"));
|
||||
|
||||
unsigned int newfingerprintForPCAfterVersionChange = 0;
|
||||
unsigned int newfingerprintForES3AfterVersionChange = 0;
|
||||
unsigned int newfingerprintForANDROIDAfterVersionChange = 0;
|
||||
|
||||
ComputeFingerprints(newfingerprintForPCAfterVersionChange, newfingerprintForES3AfterVersionChange, config, watchFolderPath, relativePathFromWatchFolder);
|
||||
ComputeFingerprints(newfingerprintForPCAfterVersionChange, newfingerprintForANDROIDAfterVersionChange, config, watchFolderPath, relativePathFromWatchFolder);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE((newfingerprintForPCAfterVersionChange != fingerprintForPC) || (newfingerprintForPCAfterVersionChange != newfingerprintForPC));//Fingerprints should be different
|
||||
UNIT_TEST_EXPECT_TRUE((newfingerprintForES3AfterVersionChange != fingerprintForES3) || (newfingerprintForES3AfterVersionChange != newfingerprintForES3));//Fingerprints should be different
|
||||
UNIT_TEST_EXPECT_TRUE((newfingerprintForANDROIDAfterVersionChange != fingerprintForANDROID) || (newfingerprintForANDROIDAfterVersionChange != newfingerprintForANDROID));//Fingerprints should be different
|
||||
|
||||
//------Test for Files which are excluded
|
||||
processResults.clear();
|
||||
@@ -1921,7 +1921,7 @@ namespace AssetProcessor
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 0); // nothing to process
|
||||
|
||||
// we are aware that 4 products went missing (es3 and pc versions of the 2 files since we renamed the SOURCE folder)
|
||||
// we are aware that 4 products went missing (android and pc versions of the 2 files since we renamed the SOURCE folder)
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 4);
|
||||
for (auto element : assetMessages)
|
||||
{
|
||||
@@ -2180,8 +2180,8 @@ namespace AssetProcessor
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[2].m_assetId != AZ::Data::AssetId());
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[3].m_assetId != AZ::Data::AssetId());
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[1].m_platform == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "android");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[1].m_platform == "android");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[2].m_platform == "pc");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[3].m_platform == "pc");
|
||||
|
||||
@@ -2214,12 +2214,12 @@ namespace AssetProcessor
|
||||
mockAppManager.UnRegisterAllBuilders();
|
||||
|
||||
AssetRecognizer abt_rec1;
|
||||
AssetPlatformSpec abt_speces3;
|
||||
AssetPlatformSpec abt_specandroid;
|
||||
abt_rec1.m_name = "UnitTestTextBuilder1";
|
||||
abt_rec1.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.txt", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
//abt_rec1.m_regexp.setPatternSyntax(QRegExp::Wildcard);
|
||||
//abt_rec1.m_regexp.setPattern("*.txt");
|
||||
abt_rec1.m_platformSpecs.insert("es3", speces3);
|
||||
abt_rec1.m_platformSpecs.insert("android", specandroid);
|
||||
mockAppManager.RegisterAssetRecognizerAsBuilder(abt_rec1);
|
||||
|
||||
AssetRecognizer abt_rec2;
|
||||
@@ -2268,8 +2268,8 @@ namespace AssetProcessor
|
||||
|
||||
sortAssetToProcessResultList(processResults);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 2); // 1 for pc and es3
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 2); // 1 for pc and android
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_platformInfo.m_identifier == "android");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[1].m_jobEntry.m_platformInfo.m_identifier == "pc");
|
||||
UNIT_TEST_EXPECT_TRUE(QString::compare(processResults[0].m_jobEntry.GetAbsoluteSourcePath(), absolutePath, Qt::CaseInsensitive) == 0);
|
||||
UNIT_TEST_EXPECT_TRUE(QString::compare(processResults[1].m_jobEntry.GetAbsoluteSourcePath(), absolutePath, Qt::CaseInsensitive) == 0);
|
||||
|
||||
@@ -17,16 +17,16 @@ void ConnectionUnitTest::StartTest()
|
||||
m_testConnection.SetAssetPlatformsString("pc");
|
||||
AzFramework::AssetSystem::AssetNotificationMessage testMessage;
|
||||
EXPECT_CALL(m_testConnection, Send(testing::_, testing::_)).Times(0);
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "osx_gl");
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "mac");
|
||||
EXPECT_CALL(m_testConnection, Send(testing::_, testing::_)).Times(1);
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "pc");
|
||||
m_testConnection.SetAssetPlatformsString("pc,es3");
|
||||
m_testConnection.SetAssetPlatformsString("pc,android");
|
||||
EXPECT_CALL(m_testConnection, Send(testing::_, testing::_)).Times(1);
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "pc");
|
||||
EXPECT_CALL(m_testConnection, Send(testing::_, testing::_)).Times(0);
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "osx_gl");
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "mac");
|
||||
EXPECT_CALL(m_testConnection, Send(testing::_, testing::_)).Times(1);
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "es3");
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "android");
|
||||
EXPECT_CALL(m_testConnection, Send(testing::_, testing::_)).Times(0);
|
||||
// Intended partial string match test - shouldn't send
|
||||
m_testConnection.SendPerPlatform(0, testMessage, "es");
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace AssetProcessor
|
||||
|
||||
size_t SendPerPlatform(unsigned int serial, const AzFramework::AssetSystem::BaseAssetProcessorMessage& message, const QString& platform) override
|
||||
{
|
||||
if (QString::compare(platform, "pc", Qt::CaseInsensitive) == 0 || QString::compare(platform, "es3", Qt::CaseInsensitive) == 0)
|
||||
if (QString::compare(platform, "pc", Qt::CaseInsensitive) == 0 || QString::compare(platform, "android", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return Send(serial, message);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace AssetProcessor
|
||||
|
||||
size_t SendRawPerPlatform(unsigned int type, unsigned int serial, const QByteArray& data, const QString& platform) override
|
||||
{
|
||||
if (QString::compare(platform, "pc", Qt::CaseInsensitive) == 0 || QString::compare(platform, "es3", Qt::CaseInsensitive) == 0)
|
||||
if (QString::compare(platform, "pc", Qt::CaseInsensitive) == 0 || QString::compare(platform, "android", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return SendRaw(type, serial, data);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void PlatformConfigurationTests::StartTest()
|
||||
|
||||
PlatformConfiguration config;
|
||||
config.EnablePlatform({ "pc",{ "desktop", "host" } }, true);
|
||||
config.EnablePlatform({ "es3",{ "mobile", "android" } }, true);
|
||||
config.EnablePlatform({ "android",{ "mobile", "android" } }, true);
|
||||
config.EnablePlatform({ "fandago",{ "console" } }, false);
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
@@ -88,15 +88,15 @@ void PlatformConfigurationTests::StartTest()
|
||||
|
||||
AssetRecognizer rec;
|
||||
AssetPlatformSpec specpc;
|
||||
AssetPlatformSpec speces3;
|
||||
AssetPlatformSpec specandroid;
|
||||
AssetPlatformSpec specfandago;
|
||||
specpc.m_extraRCParams = ""; // blank must work
|
||||
speces3.m_extraRCParams = "testextraparams";
|
||||
specandroid.m_extraRCParams = "testextraparams";
|
||||
|
||||
rec.m_name = "txt files";
|
||||
rec.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.txt", AssetBuilderSDK::AssetBuilderPattern::Wildcard);
|
||||
rec.m_platformSpecs.insert("pc", specpc);
|
||||
rec.m_platformSpecs.insert("es3", speces3);
|
||||
rec.m_platformSpecs.insert("android", specandroid);
|
||||
rec.m_platformSpecs.insert("fandago", specfandago);
|
||||
config.AddRecognizer(rec);
|
||||
|
||||
@@ -111,7 +111,7 @@ void PlatformConfigurationTests::StartTest()
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetEnabledPlatforms().size() == 2);
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetEnabledPlatforms()[0].m_identifier == "pc");
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetEnabledPlatforms()[1].m_identifier == "es3");
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetEnabledPlatforms()[1].m_identifier == "android");
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderCount() == 11);
|
||||
UNIT_TEST_EXPECT_FALSE(config.GetScanFolderAt(0).IsRoot());
|
||||
|
||||
@@ -239,14 +239,14 @@ void RCcontrollerUnitTests::RunRCControllerTests()
|
||||
createdJobs.push_back(job);
|
||||
}
|
||||
|
||||
// double them up for "es3" to make sure that platform is respected
|
||||
// double them up for "android" to make sure that platform is respected
|
||||
for (QString name : tempJobNames)
|
||||
{
|
||||
AZ::Uuid uuidOfSource = AZ::Uuid::CreateName(name.toUtf8().constData());
|
||||
RCJob* job0 = new RCJob(rcJobListModel);
|
||||
AssetProcessor::JobDetails jobDetails;
|
||||
jobDetails.m_jobEntry.m_databaseSourceName = jobDetails.m_jobEntry.m_pathRelativeToWatchFolder = name;
|
||||
jobDetails.m_jobEntry.m_platformInfo = { "es3" ,{ "mobile", "renderer" } };
|
||||
jobDetails.m_jobEntry.m_platformInfo = { "android" ,{ "mobile", "renderer" } };
|
||||
jobDetails.m_jobEntry.m_jobKey = "Compile Other Stuff";
|
||||
jobDetails.m_jobEntry.m_sourceFileUUID = uuidOfSource;
|
||||
job0->Init(jobDetails);
|
||||
@@ -490,7 +490,7 @@ void RCcontrollerUnitTests::RunRCControllerTests()
|
||||
UNIT_TEST_EXPECT_FALSE(gotJobsInQueueCall);
|
||||
|
||||
// submit same job but different platform:
|
||||
details.m_jobEntry = JobEntry("d:/test", "test1.txt", "test1.txt", AZ::Uuid("{7954065D-CFD1-4666-9E4C-3F36F417C7AC}"), { "es3" ,{ "mobile", "renderer" } }, "Test Job", 1234, 3, sourceId);
|
||||
details.m_jobEntry = JobEntry("d:/test", "test1.txt", "test1.txt", AZ::Uuid("{7954065D-CFD1-4666-9E4C-3F36F417C7AC}"), { "android" ,{ "mobile", "renderer" } }, "Test Job", 1234, 3, sourceId);
|
||||
m_rcController.JobSubmitted(details);
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace UnitTestUtils
|
||||
{
|
||||
void SleepForMinimumFileSystemTime()
|
||||
{
|
||||
// note that on OSX, the file system has a resolution of 1 second, and since we're using modtime for a bunch of things,
|
||||
// note that on Mac, the file system has a resolution of 1 second, and since we're using modtime for a bunch of things,
|
||||
// not the actual hash files, we have to wait different amount depending on the OS.
|
||||
#ifdef AZ_PLATFORM_WINDOWS
|
||||
int milliseconds = 1;
|
||||
|
||||
@@ -622,13 +622,14 @@ bool ApplicationManager::Activate()
|
||||
{
|
||||
if (!AssetUtilities::ComputeAssetRoot(m_systemRoot))
|
||||
{
|
||||
AZ_Error(AssetProcessor::ConsoleChannel, false, "Unable to compute the asset root for the project, this application cannot launch until this is fixed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto projectName = AssetUtilities::ComputeProjectName();
|
||||
if (projectName.isEmpty())
|
||||
{
|
||||
AZ_Error(AssetProcessor::ConsoleChannel, false, "Unable to detect name of current game project. Is bootstrap.cfg appropriately configured?");
|
||||
AZ_Error(AssetProcessor::ConsoleChannel, false, "Unable to detect name of current game project. Configure your game project name to launch this application.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1191,6 +1191,7 @@ bool ApplicationManagerBase::Activate()
|
||||
QDir projectCache;
|
||||
if (!AssetUtilities::ComputeProjectCacheRoot(projectCache))
|
||||
{
|
||||
AZ_Error("AssetProcessor", false, "Could not compute project cache root, please configure your project correctly to launch Asset Processor.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1200,22 +1201,27 @@ bool ApplicationManagerBase::Activate()
|
||||
// Shutdown if the disk has less than 128MB of free space
|
||||
if (!CheckSufficientDiskSpace(projectCache.absolutePath(), 128 * 1024 * 1024, true))
|
||||
{
|
||||
// CheckSufficientDiskSpace reports an error if disk space is low.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool appInited = InitApplicationServer();
|
||||
if (!appInited)
|
||||
{
|
||||
AZ_Error(
|
||||
"AssetProcessor", false, "InitApplicationServer failed, something internal to Asset Processor has failed, please report this to support if you encounter this error.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitAssetDatabase())
|
||||
{
|
||||
// AssetDatabaseConnection::OpenDatabase reports any errors it encounters.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ApplicationManager::Activate())
|
||||
{
|
||||
// ApplicationManager::Activate() reports any errors it encounters.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1230,6 +1236,7 @@ bool ApplicationManagerBase::Activate()
|
||||
m_isCurrentlyLoadingGems = true;
|
||||
if (!ActivateModules())
|
||||
{
|
||||
// ActivateModules reports any errors it encounters.
|
||||
m_isCurrentlyLoadingGems = false;
|
||||
return false;
|
||||
}
|
||||
@@ -1299,6 +1306,7 @@ bool ApplicationManagerBase::Activate()
|
||||
{
|
||||
if (!m_applicationServer->startListening())
|
||||
{
|
||||
// startListening reports any errors it encounters.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"Platform mac": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platforms": {
|
||||
"es3": "enabled"
|
||||
"android": "enabled"
|
||||
},
|
||||
"ScanFolder Game": {
|
||||
"watch": "@PROJECTROOT@",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"Platform mac": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"RC i_caf": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"Platform mac": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"ScanFolder Game": {
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform es3": {
|
||||
"Platform android": {
|
||||
"tags": "android,mobile,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"Platform mac": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform server": {
|
||||
"tags": "server"
|
||||
},
|
||||
"Platforms": {
|
||||
"es3": "enabled",
|
||||
"android": "enabled",
|
||||
"server": "enabled"
|
||||
},
|
||||
"Jobs": {
|
||||
@@ -56,7 +56,7 @@
|
||||
"glob": "*.i_caf",
|
||||
"params": "defaultparams",
|
||||
"server": "skip",
|
||||
"es3": "mobile",
|
||||
"android": "mobile",
|
||||
"priority": 5,
|
||||
"checkServer": true
|
||||
},
|
||||
@@ -68,7 +68,7 @@
|
||||
"RC mov": {
|
||||
"glob": "*.mov",
|
||||
"params": "copy",
|
||||
"es3": "platformspecificoverride",
|
||||
"android": "platformspecificoverride",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC rend": {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform es3": {
|
||||
"Platform android": {
|
||||
"tags": "android,mobile,renderer"
|
||||
},
|
||||
"Platform ios": {
|
||||
"tags": "mobile,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"Platform mac": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform server": {
|
||||
@@ -21,7 +21,7 @@
|
||||
"tags": "console,renderer"
|
||||
},
|
||||
"Platforms": {
|
||||
"es3": "enabled",
|
||||
"android": "enabled",
|
||||
"ios": "enabled",
|
||||
"server": "enabled"
|
||||
},
|
||||
@@ -54,14 +54,14 @@
|
||||
"display": "folder1output",
|
||||
"recursive": 1,
|
||||
"order": 50000,
|
||||
"include": "es3"
|
||||
"include": "android"
|
||||
},
|
||||
"ScanFolder Folder2": {
|
||||
"watch": "@ENGINEROOT@/Folder2",
|
||||
"display": "folder2output",
|
||||
"recursive": 1,
|
||||
"order": 60000,
|
||||
"exclude": "es3"
|
||||
"exclude": "android"
|
||||
},
|
||||
"ScanFolder Folder3": {
|
||||
"watch": "@ENGINEROOT@/Folder3",
|
||||
@@ -80,7 +80,7 @@
|
||||
"glob": "*.i_caf",
|
||||
"params": "defaultparams",
|
||||
"server": "skip",
|
||||
"es3": "mobile",
|
||||
"android": "mobile",
|
||||
"test": "copy",
|
||||
"priority": 5
|
||||
},
|
||||
@@ -92,7 +92,7 @@
|
||||
"RC mov": {
|
||||
"glob": "*.mov",
|
||||
"params": "copy",
|
||||
"es3": "platformspecificoverride",
|
||||
"android": "platformspecificoverride",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC rend": {
|
||||
|
||||
@@ -552,7 +552,7 @@ GridHubComponent::OnMemberJoined([[maybe_unused]] GridMate::GridSession* session
|
||||
switch( member->GetPlatformId() )
|
||||
{
|
||||
case AZ::PlatformID::PLATFORM_WINDOWS_64:
|
||||
case AZ::PlatformID::PLATFORM_APPLE_OSX:
|
||||
case AZ::PlatformID::PLATFORM_APPLE_MAC:
|
||||
{
|
||||
GridMate::string localMachineName = GridMate::Utils::GetMachineAddress();
|
||||
if( member->GetMachineName() == localMachineName )
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg width="24" height="64" viewBox="0 0 24 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(0,40)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M13 3H11V11H3V13H11V21H13V13H21V11H13V3Z" fill="white"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 246 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="24" height="64" viewBox="0 0 24 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(0,40)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M13 3H11V11H3V13H11V21H13V13H21V11H13V3Z" fill="#1e70eb"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 248 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.02554 10L9 15.0362V18L0 9L9 0V2.98885L4 8H18V10H4.02554Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 228 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="24" height="64" viewBox="0 0 24 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(0,40)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.98407 4H2V6V7V19.8145H2.07539L6.02059 7.99123H19V6H11.328L9.98407 4ZM19 19.7473L22.0766 10H7.05436L3.68763 19.8329H18.973L18.9788 19.8145H19V19.7473Z" fill="white"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 358 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="24" height="64" viewBox="0 0 24 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(0,40)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.98407 4H2V6V7V19.8145H2.07539L6.02059 7.99123H19V6H11.328L9.98407 4ZM19 19.7473L22.0766 10H7.05436L3.68763 19.8329H18.973L18.9788 19.8145H19V19.7473Z" fill="#1e70eb"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 360 B |
@@ -4,6 +4,12 @@
|
||||
</qresource>
|
||||
<qresource prefix="/">
|
||||
<file>Add.svg</file>
|
||||
<file>AddOffset.svg</file>
|
||||
<file>AddOffset_Hover.svg</file>
|
||||
<file>ArrowBack.svg</file>
|
||||
<file>build.svg</file>
|
||||
<file>FolderOffset.svg</file>
|
||||
<file>FolderOffset_Hover.svg</file>
|
||||
<file>Select_Folder.svg</file>
|
||||
<file>o3de_editor.ico</file>
|
||||
<file>Windows.svg</file>
|
||||
@@ -14,6 +20,9 @@
|
||||
<file>DefaultProjectImage.png</file>
|
||||
<file>ArrowDownLine.svg</file>
|
||||
<file>ArrowUpLine.svg</file>
|
||||
<file>o3de.svg</file>
|
||||
<file>menu.svg</file>
|
||||
<file>menu_hover.svg</file>
|
||||
<file>Backgrounds/FirstTimeBackgroundImage.jpg</file>
|
||||
<file>ArrowDownLine.svg</file>
|
||||
<file>ArrowUpLine.svg</file>
|
||||
|
||||
@@ -1,29 +1,69 @@
|
||||
/************** General (MainWindow) **************/
|
||||
QMainWindow {
|
||||
background-color: #333333;
|
||||
background:#131313 url(:/o3de.svg) no-repeat top left;
|
||||
/* position the logo using padding and background-origin, Qt does not support background-position pixels */
|
||||
background-origin:content;
|
||||
padding:25px 16px;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
|
||||
QPushButton:focus {
|
||||
outline: none;
|
||||
border:1px solid #1e70eb;
|
||||
}
|
||||
|
||||
QTabBar {
|
||||
background-color: transparent;
|
||||
}
|
||||
QTabWidget::tab-bar
|
||||
{
|
||||
left: 78px; /* make room for the logo */
|
||||
}
|
||||
QTabBar::tab {
|
||||
height:82px;
|
||||
background-color: transparent;
|
||||
font-size:24px;
|
||||
min-width:100px;
|
||||
margin-right:40px;
|
||||
border-bottom: 3px solid transparent;
|
||||
}
|
||||
QTabBar::tab:text
|
||||
{
|
||||
text-align:left;
|
||||
}
|
||||
QTabWidget::pane {
|
||||
background-color: #333333;
|
||||
border:0 none;
|
||||
}
|
||||
QTabBar::tab:selected
|
||||
{
|
||||
border-bottom: 3px solid #1e70eb;
|
||||
color: #1e70eb;
|
||||
}
|
||||
QTabBar::tab:hover
|
||||
{
|
||||
color: #1e70eb;
|
||||
}
|
||||
QTabBar::tab:pressed
|
||||
{
|
||||
color: #0e60eb;
|
||||
}
|
||||
|
||||
/************** General (Forms) **************/
|
||||
|
||||
#formLineEditWidget,
|
||||
#formBrowseEditWidget {
|
||||
max-width: 780px;
|
||||
max-width: 890px;
|
||||
}
|
||||
|
||||
#formFrame {
|
||||
max-width: 720px;
|
||||
max-width: 840px;
|
||||
background-color: #444444;
|
||||
border:1px solid #dddddd;
|
||||
border-radius: 4px;
|
||||
padding: 0px 10px 2px 6px;
|
||||
margin-top:10px;
|
||||
margin-left:30px;
|
||||
margin-left:50px;
|
||||
}
|
||||
|
||||
#formFrame[Focus="true"] {
|
||||
@@ -59,16 +99,235 @@ QPushButton:focus {
|
||||
padding-top: -4px;
|
||||
}
|
||||
|
||||
|
||||
#formErrorLabel {
|
||||
color: #ec3030;
|
||||
font-size: 14px;
|
||||
margin-left: 40px;
|
||||
margin-left: 50px;
|
||||
}
|
||||
|
||||
#formTitleLabel {
|
||||
font-size:21px;
|
||||
color:#ffffff;
|
||||
margin: 10px 0 10px 30px;
|
||||
margin: 24px 0 10px 50px;
|
||||
}
|
||||
|
||||
/************** General (Modal windows) **************/
|
||||
|
||||
#header {
|
||||
background-color:#111111;
|
||||
min-height:80px;
|
||||
max-height:80px;
|
||||
}
|
||||
|
||||
#header QPushButton {
|
||||
/* settings min/max lets us use a fixed size */
|
||||
min-width: 24px;
|
||||
max-width: 24px;
|
||||
min-height: 24px;
|
||||
max-height: 24px;
|
||||
margin: 20px 10px 0px 10px;
|
||||
background:transparent url(:/ArrowBack.svg) no-repeat center;
|
||||
background-origin:content;
|
||||
qproperty-flat: true;
|
||||
qproperty-iconSize: 50px;
|
||||
}
|
||||
|
||||
#header QPushButton:focus {
|
||||
border:none;
|
||||
}
|
||||
#header QPushButton:hover {
|
||||
background:#333333 url(:/ArrowBack.svg) no-repeat center;
|
||||
}
|
||||
#header QPushButton:pressed {
|
||||
background:#222222 url(:/ArrowBack.svg) no-repeat center;
|
||||
}
|
||||
|
||||
#headerTitle {
|
||||
font-size:14px;
|
||||
text-align:left;
|
||||
margin:0;
|
||||
padding-top:10px;
|
||||
padding-bottom:-5px;
|
||||
min-height:15px;
|
||||
max-height:15px;
|
||||
}
|
||||
#headerSubTitle {
|
||||
font-size:24px;
|
||||
text-align:left;
|
||||
margin:0;
|
||||
min-height:42px;
|
||||
max-height:42px;
|
||||
}
|
||||
|
||||
#body {
|
||||
background-color:#333333;
|
||||
}
|
||||
#footer {
|
||||
/* settings min/max lets us use a fixed size */
|
||||
min-width: 50px;
|
||||
min-height:54px;
|
||||
max-height:54px;
|
||||
}
|
||||
|
||||
#footer > QPushButton {
|
||||
qproperty-flat: true;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #0095f2, stop: 1.0 #1e70eb);
|
||||
border-radius: 3px;
|
||||
min-height: 28px;
|
||||
max-height: 28px;
|
||||
min-width: 150px;
|
||||
margin-right:30px;
|
||||
}
|
||||
#footer > QPushButton:hover {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #10A5f2, stop: 1.0 #2e80eb);
|
||||
}
|
||||
#footer > QPushButton:pressed {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #0085e2, stop: 1.0 #0e60db);
|
||||
}
|
||||
|
||||
#footer > QPushButton[secondary="true"] {
|
||||
margin-right: 10px;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #888888, stop: 1.0 #555555);
|
||||
}
|
||||
#footer > QPushButton[secondary="true"]:hover {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #999999, stop: 1.0 #666666);
|
||||
}
|
||||
#footer > QPushButton[secondary="true"]:pressed {
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #555555, stop: 1.0 #777777);
|
||||
}
|
||||
|
||||
/************** Project Settings **************/
|
||||
#projectSettings {
|
||||
margin-top:42px;
|
||||
}
|
||||
|
||||
#projectTemplate {
|
||||
margin: 55px 0 0 50px;
|
||||
max-width: 780px;
|
||||
min-height:200px;
|
||||
max-height:200px;
|
||||
}
|
||||
#projectTemplateLabel {
|
||||
font-size:16px;
|
||||
font-weight:100;
|
||||
}
|
||||
|
||||
#projectTemplateDetailsLabel {
|
||||
font-size:14px;
|
||||
min-height:40px;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
|
||||
#projectTemplateDetails {
|
||||
background-color:#444444;
|
||||
max-width:240px;
|
||||
min-width:240px;
|
||||
margin-left:30px;
|
||||
}
|
||||
|
||||
/************** Projects **************/
|
||||
#firstTimeContent > #titleLabel {
|
||||
font-size:60px;
|
||||
margin:73px 0px 0px 0px;
|
||||
qproperty-indent: 0;
|
||||
}
|
||||
|
||||
#firstTimeContent > #introLabel {
|
||||
font-size:14px;
|
||||
margin:10px 0 60px 0;
|
||||
qproperty-indent: 0;
|
||||
}
|
||||
|
||||
#firstTimeContent > QPushButton {
|
||||
min-width: 210px;
|
||||
max-width: 210px;
|
||||
min-height: 276px;
|
||||
max-height: 276px;
|
||||
qproperty-flat: true;
|
||||
background-origin:content;
|
||||
font-size:14px;
|
||||
border: 1px solid #ffffff;
|
||||
}
|
||||
|
||||
#firstTimeContent > QPushButton:hover {
|
||||
border: 1px solid #1e70eb;
|
||||
color: #1e70eb;
|
||||
}
|
||||
|
||||
#firstTimeContent > QPushButton:pressed {
|
||||
border: 1px solid #0e60eb;
|
||||
color: #0e60eb;
|
||||
}
|
||||
|
||||
#createProjectButton {
|
||||
background:rgba(0,0,0,180) url(:/AddOffset.svg) no-repeat center center;
|
||||
}
|
||||
#createProjectButton:hover,
|
||||
#createProjectButton:pressed {
|
||||
background:rgba(0,0,0,180) url(:/AddOffset_Hover.svg) no-repeat center center;
|
||||
}
|
||||
|
||||
#addProjectButton {
|
||||
background:rgba(0,0,0,180) url(:/FolderOffset.svg) no-repeat center center;
|
||||
}
|
||||
#addProjectButton:hover,
|
||||
#addProjectButton:pressed {
|
||||
background:rgba(0,0,0,180) url(:/FolderOffset_Hover.svg) no-repeat center center;
|
||||
}
|
||||
|
||||
#projectsContent > QFrame {
|
||||
margin-top:60px;
|
||||
}
|
||||
|
||||
#projectsContent > QFrame > #titleLabel {
|
||||
font-size:24px;
|
||||
qproperty-indent: 0;
|
||||
}
|
||||
|
||||
#projectsContent > QScrollArea {
|
||||
margin-top:40px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
|
||||
#projectButton > #labelButton {
|
||||
border:1px solid white;
|
||||
}
|
||||
#projectButton > #labelButton:hover,
|
||||
#projectButton > #labelButton:pressed {
|
||||
border:1px solid #1e70eb;
|
||||
}
|
||||
|
||||
#projectButton > QFrame {
|
||||
margin-top:6px;
|
||||
}
|
||||
|
||||
#projectButton > QFrame > QLabel {
|
||||
font-weight:bold;
|
||||
font-size:14px;
|
||||
qproperty-indent: 0;
|
||||
}
|
||||
|
||||
#projectMenuButton {
|
||||
qproperty-flat: true;
|
||||
background:transparent url(:/menu.svg) no-repeat center center;
|
||||
max-width:30px;
|
||||
min-width:30px;
|
||||
max-height:14px;
|
||||
min-height:14px;
|
||||
}
|
||||
|
||||
#projectsContent > QFrame > #newProjectButton {
|
||||
min-width:150px;
|
||||
max-width:150px;
|
||||
min-height:26px;
|
||||
max-height:26px;
|
||||
}
|
||||
|
||||
#labelButtonOverlay {
|
||||
@@ -77,4 +336,4 @@ QPushButton:focus {
|
||||
max-width:210px;;
|
||||
min-height:278px;
|
||||
max-height:278px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="3" y="16" width="5" height="5" fill="white"/>
|
||||
<rect x="9.5" y="16" width="5" height="5" fill="white"/>
|
||||
<rect x="16" y="16" width="5" height="5" fill="white"/>
|
||||
<rect x="3" y="9.5" width="5" height="5" fill="white"/>
|
||||
<rect x="9.5" y="9.5" width="5" height="5" fill="white"/>
|
||||
<rect x="19.415" y="8.58496" width="5" height="5" transform="rotate(60 19.415 8.58496)" fill="white"/>
|
||||
<rect x="3" y="3" width="5" height="5" fill="white"/>
|
||||
<rect x="8.58496" y="6.41504" width="5" height="5" transform="rotate(-60 8.58496 6.41504)" fill="white"/>
|
||||
<rect x="19.5" y="0.964844" width="5" height="5" transform="rotate(45 19.5 0.964844)" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 749 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="24" height="16" viewBox="0 0 24 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="1.3335" y="2.66675" width="13.3333" height="1.33333" fill="white"/>
|
||||
<rect x="1.3335" y="7.33325" width="13.3333" height="1.33333" fill="white"/>
|
||||
<rect x="1.3335" y="12" width="13.3333" height="1.33333" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 329 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="24" height="16" viewBox="0 0 24 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="1.3335" y="2.66675" width="13.3333" height="1.33333" fill="#1e70eb"/>
|
||||
<rect x="1.3335" y="7.33325" width="13.3333" height="1.33333" fill="#1e70eb"/>
|
||||
<rect x="1.3335" y="12" width="13.3333" height="1.33333" fill="#1e70eb"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 335 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="38" height="32" viewBox="0 0 38 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.0335 27.6364C30.2006 30.4503 26.4498 32 22.4729 32H22.4719L22.4007 31.9999C18.3948 31.9813 14.6226 30.396 11.7792 27.5358C7.98134 23.7148 6.67845 18.3374 7.86239 13.445H13.291C12.8522 14.5772 12.6238 15.7937 12.6313 17.0465C12.6466 19.6692 13.682 22.1248 15.5465 23.9605C17.4134 25.7987 19.8692 26.811 22.462 26.811L22.4897 26.8108C25.0998 26.8025 27.555 25.7736 29.4067 23.9136C31.2794 22.0326 32.3023 19.5505 32.2872 16.9246C32.2718 14.2963 31.2187 11.8234 29.3215 9.96131C27.4791 8.153 25.0581 7.16098 22.4942 7.16098C22.4558 7.16098 22.4177 7.16127 22.379 7.16171C20.9514 7.17701 19.5695 7.49947 18.3061 8.09355V2.5551C19.6438 2.16896 21.0401 1.96569 22.4658 1.96569L22.5394 1.96598C26.5556 1.98507 30.3331 3.58486 33.1758 6.47058C35.976 9.31332 37.5035 13.0777 37.4771 17.0703C37.4508 21.0641 35.8727 24.8164 33.0335 27.6364ZM1.73437 2.98423H4.71974V0H1.73437V2.98423ZM0 11.9513H4.68388V7.26925H0V11.9513ZM7.65831 10.0451H14.8796V2.82656H7.65831V10.0451Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c042fce57915fc749abc7b37de765fd697c3c4d7de045a3d44805aa0ce29901a
|
||||
size 107016
|
||||
oid sha256:d717f77fe01f45df934a61bbc215e5322447d21e16f3cebcf2a02f148178f266
|
||||
size 106449
|
||||
|
||||
@@ -14,11 +14,17 @@
|
||||
#include <ScreensCtrl.h>
|
||||
#include <PythonBindingsInterface.h>
|
||||
#include <NewProjectSettingsScreen.h>
|
||||
#include <ScreenHeaderWidget.h>
|
||||
#include <GemCatalog/GemCatalogScreen.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QStackedWidget>
|
||||
#include <QLabel>
|
||||
#include <QSizePolicy>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
@@ -26,29 +32,34 @@ namespace O3DE::ProjectManager
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
setLayout(vLayout);
|
||||
vLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
m_screensCtrl = new ScreensCtrl();
|
||||
vLayout->addWidget(m_screensCtrl);
|
||||
m_header = new ScreenHeader(this);
|
||||
m_header->setTitle(tr("Create a New Project"));
|
||||
m_header->setSubTitle(tr("Enter Project Details"));
|
||||
connect(m_header->backButton(), &QPushButton::clicked, this, &CreateProjectCtrl::HandleBackButton);
|
||||
vLayout->addWidget(m_header);
|
||||
|
||||
m_stack = new QStackedWidget(this);
|
||||
m_stack->setObjectName("body");
|
||||
m_stack->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding));
|
||||
m_stack->addWidget(new NewProjectSettingsScreen());
|
||||
m_stack->addWidget(new GemCatalogScreen());
|
||||
vLayout->addWidget(m_stack);
|
||||
|
||||
QDialogButtonBox* backNextButtons = new QDialogButtonBox();
|
||||
backNextButtons->setObjectName("footer");
|
||||
vLayout->addWidget(backNextButtons);
|
||||
|
||||
m_backButton = backNextButtons->addButton(tr("Back"), QDialogButtonBox::RejectRole);
|
||||
m_backButton->setProperty("secondary", true);
|
||||
m_nextButton = backNextButtons->addButton(tr("Next"), QDialogButtonBox::ApplyRole);
|
||||
|
||||
connect(m_backButton, &QPushButton::pressed, this, &CreateProjectCtrl::HandleBackButton);
|
||||
connect(m_nextButton, &QPushButton::pressed, this, &CreateProjectCtrl::HandleNextButton);
|
||||
connect(m_backButton, &QPushButton::clicked, this, &CreateProjectCtrl::HandleBackButton);
|
||||
connect(m_nextButton, &QPushButton::clicked, this, &CreateProjectCtrl::HandleNextButton);
|
||||
|
||||
m_screensOrder =
|
||||
{
|
||||
ProjectManagerScreen::NewProjectSettings,
|
||||
ProjectManagerScreen::GemCatalog
|
||||
};
|
||||
m_screensCtrl->BuildScreens(m_screensOrder);
|
||||
m_screensCtrl->ForceChangeToScreen(ProjectManagerScreen::NewProjectSettings, false);
|
||||
|
||||
UpdateNextButtonText();
|
||||
Update();
|
||||
setLayout(vLayout);
|
||||
}
|
||||
|
||||
ProjectManagerScreen CreateProjectCtrl::GetScreenEnum()
|
||||
@@ -58,28 +69,20 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void CreateProjectCtrl::HandleBackButton()
|
||||
{
|
||||
if (!m_screensCtrl->GotoPreviousScreen())
|
||||
if (m_stack->currentIndex() > 0)
|
||||
{
|
||||
emit GotoPreviousScreenRequest();
|
||||
m_stack->setCurrentIndex(m_stack->currentIndex() - 1);
|
||||
Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateNextButtonText();
|
||||
emit GotoPreviousScreenRequest();
|
||||
}
|
||||
}
|
||||
void CreateProjectCtrl::HandleNextButton()
|
||||
{
|
||||
ScreenWidget* currentScreen = m_screensCtrl->GetCurrentScreen();
|
||||
ScreenWidget* currentScreen = reinterpret_cast<ScreenWidget*>(m_stack->currentWidget());
|
||||
ProjectManagerScreen screenEnum = currentScreen->GetScreenEnum();
|
||||
auto screenOrderIter = m_screensOrder.begin();
|
||||
for (; screenOrderIter != m_screensOrder.end(); ++screenOrderIter)
|
||||
{
|
||||
if (*screenOrderIter == screenEnum)
|
||||
{
|
||||
++screenOrderIter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (screenEnum == ProjectManagerScreen::NewProjectSettings)
|
||||
{
|
||||
@@ -97,10 +100,10 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
if (screenOrderIter != m_screensOrder.end())
|
||||
if (m_stack->currentIndex() != m_stack->count() - 1)
|
||||
{
|
||||
m_screensCtrl->ChangeToScreen(*screenOrderIter);
|
||||
UpdateNextButtonText();
|
||||
m_stack->setCurrentIndex(m_stack->currentIndex() + 1);
|
||||
Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -108,7 +111,7 @@ namespace O3DE::ProjectManager
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
// adding gems is not implemented yet because we don't know what targets to add or how to add them
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::ProjectsHome);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,14 +120,21 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
void CreateProjectCtrl::UpdateNextButtonText()
|
||||
void CreateProjectCtrl::Update()
|
||||
{
|
||||
QString nextButtonText = tr("Next");
|
||||
if (m_screensCtrl->GetCurrentScreen()->GetScreenEnum() == ProjectManagerScreen::GemCatalog)
|
||||
ScreenWidget* currentScreen = reinterpret_cast<ScreenWidget*>(m_stack->currentWidget());
|
||||
if (currentScreen && currentScreen->GetScreenEnum() == ProjectManagerScreen::GemCatalog)
|
||||
{
|
||||
nextButtonText = tr("Create Project");
|
||||
m_header->setTitle(tr("Create Project"));
|
||||
m_header->setSubTitle(tr("Configure project with Gems"));
|
||||
m_nextButton->setText(tr("Create Project"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_header->setTitle(tr("Create Project"));
|
||||
m_header->setSubTitle(tr("Enter Project Details"));
|
||||
m_nextButton->setText(tr("Next"));
|
||||
}
|
||||
m_nextButton->setText(nextButtonText);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -12,15 +12,18 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "ProjectInfo.h"
|
||||
#include <ScreenWidget.h>
|
||||
#include <ScreensCtrl.h>
|
||||
#include <QPushButton>
|
||||
#include <ProjectInfo.h>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QStackedWidget)
|
||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
QT_FORWARD_DECLARE_CLASS(ScreenHeader)
|
||||
|
||||
class CreateProjectCtrl
|
||||
: public ScreenWidget
|
||||
{
|
||||
@@ -34,12 +37,13 @@ namespace O3DE::ProjectManager
|
||||
void HandleNextButton();
|
||||
|
||||
private:
|
||||
void UpdateNextButtonText();
|
||||
void Update();
|
||||
|
||||
QStackedWidget* m_stack;
|
||||
ScreenHeader* m_header;
|
||||
|
||||
ScreensCtrl* m_screensCtrl;
|
||||
QPushButton* m_backButton;
|
||||
QPushButton* m_nextButton;
|
||||
QVector<ProjectManagerScreen> m_screensOrder;
|
||||
|
||||
QString m_projectTemplatePath;
|
||||
ProjectInfo m_projectInfo;
|
||||
|
||||
@@ -82,6 +82,16 @@ namespace O3DE::ProjectManager
|
||||
return ProjectManagerScreen::EngineSettings;
|
||||
}
|
||||
|
||||
QString EngineSettingsScreen::GetTabText()
|
||||
{
|
||||
return tr("Engine");
|
||||
}
|
||||
|
||||
bool EngineSettingsScreen::IsTab()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void EngineSettingsScreen::OnTextChanged()
|
||||
{
|
||||
// save engine settings
|
||||
|
||||
@@ -26,7 +26,10 @@ namespace O3DE::ProjectManager
|
||||
public:
|
||||
explicit EngineSettingsScreen(QWidget* parent = nullptr);
|
||||
~EngineSettingsScreen() = default;
|
||||
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
QString GetTabText() override;
|
||||
bool IsTab() override;
|
||||
|
||||
protected slots:
|
||||
void OnTextChanged();
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <FirstTimeUseScreen.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QIcon>
|
||||
#include <QSpacerItem>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
FirstTimeUseScreen::FirstTimeUseScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
setLayout(vLayout);
|
||||
vLayout->setContentsMargins(s_contentMargins, s_contentMargins, s_contentMargins, s_contentMargins);
|
||||
|
||||
QLabel* titleLabel = new QLabel(this);
|
||||
titleLabel->setText(tr("Ready. Set. Create!"));
|
||||
titleLabel->setStyleSheet("font-size: 60px");
|
||||
vLayout->addWidget(titleLabel);
|
||||
|
||||
QLabel* introLabel = new QLabel(this);
|
||||
introLabel->setTextFormat(Qt::AutoText);
|
||||
introLabel->setText(tr("<html><head/><body><p>Welcome to O3DE! Start something new by creating a project. Not sure what to create? </p><p>Explore what\342\200\231s available by downloading our sample project.</p></body></html>"));
|
||||
introLabel->setStyleSheet("font-size: 14px");
|
||||
vLayout->addWidget(introLabel);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout();
|
||||
buttonLayout->setSpacing(s_buttonSpacing);
|
||||
|
||||
m_createProjectButton = CreateLargeBoxButton(QIcon(":/Add.svg"), tr("Create Project"), this);
|
||||
m_createProjectButton->setIconSize(QSize(s_iconSize, s_iconSize));
|
||||
buttonLayout->addWidget(m_createProjectButton);
|
||||
|
||||
m_addProjectButton = CreateLargeBoxButton(QIcon(":/Select_Folder.svg"), tr("Add a Project"), this);
|
||||
m_addProjectButton->setIconSize(QSize(s_iconSize, s_iconSize));
|
||||
buttonLayout->addWidget(m_addProjectButton);
|
||||
|
||||
QSpacerItem* buttonSpacer = new QSpacerItem(s_spacerSize, s_spacerSize, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
buttonLayout->addItem(buttonSpacer);
|
||||
|
||||
vLayout->addItem(buttonLayout);
|
||||
|
||||
QSpacerItem* verticalSpacer = new QSpacerItem(s_spacerSize, s_spacerSize, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
vLayout->addItem(verticalSpacer);
|
||||
|
||||
// Using border-image allows for scaling options background-image does not support
|
||||
setStyleSheet("O3DE--ProjectManager--ScreenWidget { border-image: url(:/Backgrounds/FirstTimeBackgroundImage.jpg) repeat repeat; }");
|
||||
|
||||
connect(m_createProjectButton, &QPushButton::pressed, this, &FirstTimeUseScreen::HandleNewProjectButton);
|
||||
connect(m_addProjectButton, &QPushButton::pressed, this, &FirstTimeUseScreen::HandleAddProjectButton);
|
||||
}
|
||||
|
||||
ProjectManagerScreen FirstTimeUseScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::FirstTimeUse;
|
||||
}
|
||||
|
||||
void FirstTimeUseScreen::HandleNewProjectButton()
|
||||
{
|
||||
emit ResetScreenRequest(ProjectManagerScreen::CreateProject);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::CreateProject);
|
||||
}
|
||||
void FirstTimeUseScreen::HandleAddProjectButton()
|
||||
{
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
|
||||
QPushButton* FirstTimeUseScreen::CreateLargeBoxButton(const QIcon& icon, const QString& text, QWidget* parent)
|
||||
{
|
||||
QPushButton* largeBoxButton = new QPushButton(icon, text, parent);
|
||||
|
||||
largeBoxButton->setFixedSize(s_boxButtonWidth, s_boxButtonHeight);
|
||||
largeBoxButton->setFlat(true);
|
||||
largeBoxButton->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
largeBoxButton->setStyleSheet("QPushButton { font-size: 14px; background-color: rgba(0, 0, 0, 191); }");
|
||||
|
||||
return largeBoxButton;
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <ScreenWidget.h>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QIcon)
|
||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class FirstTimeUseScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
public:
|
||||
explicit FirstTimeUseScreen(QWidget* parent = nullptr);
|
||||
~FirstTimeUseScreen() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
|
||||
protected slots:
|
||||
void HandleNewProjectButton();
|
||||
void HandleAddProjectButton();
|
||||
|
||||
private:
|
||||
QPushButton* CreateLargeBoxButton(const QIcon& icon, const QString& text, QWidget* parent = nullptr);
|
||||
|
||||
QPushButton* m_createProjectButton;
|
||||
QPushButton* m_addProjectButton;
|
||||
|
||||
inline constexpr static int s_contentMargins = 80;
|
||||
inline constexpr static int s_buttonSpacing = 30;
|
||||
inline constexpr static int s_iconSize = 24;
|
||||
inline constexpr static int s_spacerSize = 20;
|
||||
inline constexpr static int s_boxButtonWidth = 210;
|
||||
inline constexpr static int s_boxButtonHeight = 280;
|
||||
};
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -12,6 +12,9 @@
|
||||
|
||||
#include <NewProjectSettingsScreen.h>
|
||||
#include <PythonBindingsInterface.h>
|
||||
#include <FormLineEditWidget.h>
|
||||
#include <FormBrowseEditWidget.h>
|
||||
#include <PathValidator.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
@@ -23,6 +26,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QSpacerItem>
|
||||
#include <QStandardPaths>
|
||||
#include <QFrame>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
@@ -31,64 +35,81 @@ namespace O3DE::ProjectManager
|
||||
NewProjectSettingsScreen::NewProjectSettingsScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
this->setLayout(hLayout);
|
||||
QHBoxLayout* hLayout = new QHBoxLayout(this);
|
||||
hLayout->setAlignment(Qt::AlignLeft);
|
||||
hLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
// if we don't provide a parent for this box layout the stylesheet doesn't take
|
||||
// if we don't set this in a frame (just use a sub-layout) all the content will align incorrectly horizontally
|
||||
QFrame* projectSettingsFrame = new QFrame(this);
|
||||
projectSettingsFrame->setObjectName("projectSettings");
|
||||
QVBoxLayout* vLayout = new QVBoxLayout(this);
|
||||
|
||||
QLabel* projectNameLabel = new QLabel(tr("Project Name"), this);
|
||||
vLayout->addWidget(projectNameLabel);
|
||||
|
||||
m_projectNameLineEdit = new QLineEdit(tr("New Project"), this);
|
||||
vLayout->addWidget(m_projectNameLineEdit);
|
||||
|
||||
QLabel* projectPathLabel = new QLabel(tr("Project Location"), this);
|
||||
vLayout->addWidget(projectPathLabel);
|
||||
|
||||
// you cannot remove content margins in qss
|
||||
vLayout->setContentsMargins(0,0,0,0);
|
||||
vLayout->setAlignment(Qt::AlignTop);
|
||||
{
|
||||
QHBoxLayout* projectPathLayout = new QHBoxLayout(this);
|
||||
m_projectName = new FormLineEditWidget(tr("Project name"), tr("New Project"), this);
|
||||
m_projectName->setErrorLabelText(
|
||||
tr("A project with this name already exists at this location. Please choose a new name or location."));
|
||||
vLayout->addWidget(m_projectName);
|
||||
|
||||
m_projectPathLineEdit = new QLineEdit(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), this);
|
||||
projectPathLayout->addWidget(m_projectPathLineEdit);
|
||||
m_projectPath =
|
||||
new FormBrowseEditWidget(tr("Project Location"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), this);
|
||||
m_projectPath->lineEdit()->setReadOnly(true);
|
||||
m_projectPath->setErrorLabelText(tr("Please provide a valid path to a folder that exists"));
|
||||
m_projectPath->lineEdit()->setValidator(new PathValidator(PathValidator::PathMode::ExistingFolder, this));
|
||||
vLayout->addWidget(m_projectPath);
|
||||
|
||||
QPushButton* browseButton = new QPushButton(tr("Browse"), this);
|
||||
connect(browseButton, &QPushButton::pressed, this, &NewProjectSettingsScreen::HandleBrowseButton);
|
||||
projectPathLayout->addWidget(browseButton);
|
||||
|
||||
vLayout->addLayout(projectPathLayout);
|
||||
}
|
||||
|
||||
QLabel* projectTemplateLabel = new QLabel(this);
|
||||
projectTemplateLabel->setText("Project Template");
|
||||
vLayout->addWidget(projectTemplateLabel);
|
||||
|
||||
QHBoxLayout* templateLayout = new QHBoxLayout(this);
|
||||
vLayout->addItem(templateLayout);
|
||||
|
||||
m_projectTemplateButtonGroup = new QButtonGroup(this);
|
||||
auto templatesResult = PythonBindingsInterface::Get()->GetProjectTemplates();
|
||||
if (templatesResult.IsSuccess() && !templatesResult.GetValue().isEmpty())
|
||||
{
|
||||
for (auto projectTemplate : templatesResult.GetValue())
|
||||
// if we don't use a QFrame we cannot "contain" the widgets inside and move them around
|
||||
// as a group
|
||||
QFrame* projectTemplateWidget = new QFrame(this);
|
||||
projectTemplateWidget->setObjectName("projectTemplate");
|
||||
QVBoxLayout* containerLayout = new QVBoxLayout();
|
||||
containerLayout->setAlignment(Qt::AlignTop);
|
||||
{
|
||||
QRadioButton* radioButton = new QRadioButton(projectTemplate.m_name, this);
|
||||
radioButton->setProperty(k_pathProperty, projectTemplate.m_path);
|
||||
m_projectTemplateButtonGroup->addButton(radioButton);
|
||||
QLabel* projectTemplateLabel = new QLabel(tr("Select a Project Template"));
|
||||
projectTemplateLabel->setObjectName("projectTemplateLabel");
|
||||
containerLayout->addWidget(projectTemplateLabel);
|
||||
|
||||
templateLayout->addWidget(radioButton);
|
||||
QLabel* projectTemplateDetailsLabel = new QLabel(tr("Project templates are pre-configured with relevant Gems that provide "
|
||||
"additional functionality and content to the project."));
|
||||
projectTemplateDetailsLabel->setWordWrap(true);
|
||||
projectTemplateDetailsLabel->setObjectName("projectTemplateDetailsLabel");
|
||||
containerLayout->addWidget(projectTemplateDetailsLabel);
|
||||
|
||||
QHBoxLayout* templateLayout = new QHBoxLayout(this);
|
||||
containerLayout->addItem(templateLayout);
|
||||
|
||||
m_projectTemplateButtonGroup = new QButtonGroup(this);
|
||||
m_projectTemplateButtonGroup->setObjectName("templateButtonGroup");
|
||||
auto templatesResult = PythonBindingsInterface::Get()->GetProjectTemplates();
|
||||
if (templatesResult.IsSuccess() && !templatesResult.GetValue().isEmpty())
|
||||
{
|
||||
for (auto projectTemplate : templatesResult.GetValue())
|
||||
{
|
||||
QRadioButton* radioButton = new QRadioButton(projectTemplate.m_name, this);
|
||||
radioButton->setProperty(k_pathProperty, projectTemplate.m_path);
|
||||
m_projectTemplateButtonGroup->addButton(radioButton);
|
||||
|
||||
containerLayout->addWidget(radioButton);
|
||||
}
|
||||
|
||||
m_projectTemplateButtonGroup->buttons().first()->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
m_projectTemplateButtonGroup->buttons().first()->setChecked(true);
|
||||
projectTemplateWidget->setLayout(containerLayout);
|
||||
vLayout->addWidget(projectTemplateWidget);
|
||||
}
|
||||
projectSettingsFrame->setLayout(vLayout);
|
||||
|
||||
QSpacerItem* verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
vLayout->addItem(verticalSpacer);
|
||||
hLayout->addWidget(projectSettingsFrame);
|
||||
|
||||
hLayout->addItem(vLayout);
|
||||
QWidget* projectTemplateDetails = new QWidget(this);
|
||||
projectTemplateDetails->setObjectName("projectTemplateDetails");
|
||||
hLayout->addWidget(projectTemplateDetails);
|
||||
|
||||
QWidget* gemsListPlaceholder = new QWidget(this);
|
||||
gemsListPlaceholder->setFixedWidth(250);
|
||||
hLayout->addWidget(gemsListPlaceholder);
|
||||
this->setLayout(hLayout);
|
||||
}
|
||||
|
||||
ProjectManagerScreen NewProjectSettingsScreen::GetScreenEnum()
|
||||
@@ -96,26 +117,12 @@ namespace O3DE::ProjectManager
|
||||
return ProjectManagerScreen::NewProjectSettings;
|
||||
}
|
||||
|
||||
void NewProjectSettingsScreen::HandleBrowseButton()
|
||||
{
|
||||
QString defaultPath = m_projectPathLineEdit->text();
|
||||
if (defaultPath.isEmpty())
|
||||
{
|
||||
defaultPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
}
|
||||
|
||||
QString directory = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("New project path"), defaultPath));
|
||||
if (!directory.isEmpty())
|
||||
{
|
||||
m_projectPathLineEdit->setText(directory);
|
||||
}
|
||||
}
|
||||
|
||||
ProjectInfo NewProjectSettingsScreen::GetProjectInfo()
|
||||
{
|
||||
ProjectInfo projectInfo;
|
||||
projectInfo.m_projectName = m_projectNameLineEdit->text();
|
||||
projectInfo.m_path = QDir::toNativeSeparators(m_projectPathLineEdit->text() + "/" + projectInfo.m_projectName);
|
||||
projectInfo.m_projectName = m_projectName->lineEdit()->text();
|
||||
projectInfo.m_path = QDir::toNativeSeparators(m_projectPath->lineEdit()->text() + "/" + projectInfo.m_projectName);
|
||||
return projectInfo;
|
||||
}
|
||||
|
||||
@@ -127,18 +134,18 @@ namespace O3DE::ProjectManager
|
||||
bool NewProjectSettingsScreen::Validate()
|
||||
{
|
||||
bool projectNameIsValid = true;
|
||||
if (m_projectNameLineEdit->text().isEmpty())
|
||||
if (m_projectName->lineEdit()->text().isEmpty())
|
||||
{
|
||||
projectNameIsValid = false;
|
||||
}
|
||||
|
||||
bool projectPathIsValid = true;
|
||||
if (m_projectPathLineEdit->text().isEmpty())
|
||||
if (m_projectPath->lineEdit()->text().isEmpty())
|
||||
{
|
||||
projectPathIsValid = false;
|
||||
}
|
||||
|
||||
QDir path(QDir::toNativeSeparators(m_projectPathLineEdit->text() + "/" + m_projectNameLineEdit->text()));
|
||||
QDir path(QDir::toNativeSeparators(m_projectPath->lineEdit()->text() + "/" + m_projectName->lineEdit()->text()));
|
||||
if (path.exists() && !path.isEmpty())
|
||||
{
|
||||
projectPathIsValid = false;
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QButtonGroup)
|
||||
QT_FORWARD_DECLARE_CLASS(QLineEdit)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
QT_FORWARD_DECLARE_CLASS(FormLineEditWidget)
|
||||
QT_FORWARD_DECLARE_CLASS(FormBrowseEditWidget)
|
||||
|
||||
class NewProjectSettingsScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
@@ -38,8 +40,8 @@ namespace O3DE::ProjectManager
|
||||
void HandleBrowseButton();
|
||||
|
||||
private:
|
||||
QLineEdit* m_projectNameLineEdit;
|
||||
QLineEdit* m_projectPathLineEdit;
|
||||
FormLineEditWidget* m_projectName;
|
||||
FormBrowseEditWidget* m_projectPath;
|
||||
QButtonGroup* m_projectTemplateButtonGroup;
|
||||
};
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace O3DE::ProjectManager
|
||||
LabelButton::LabelButton(QWidget* parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
setObjectName("labelButton");
|
||||
m_overlayLabel = new QLabel("", this);
|
||||
m_overlayLabel->setObjectName("labelButtonOverlay");
|
||||
m_overlayLabel->setWordWrap(true);
|
||||
@@ -75,6 +76,8 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void ProjectButton::Setup()
|
||||
{
|
||||
setObjectName("projectButton");
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->setSpacing(0);
|
||||
vLayout->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -98,14 +101,21 @@ namespace O3DE::ProjectManager
|
||||
m_deleteProjectAction = newProjectMenu->addAction(tr("Delete the Project"));
|
||||
#endif
|
||||
|
||||
m_projectSettingsMenuButton = new QPushButton(this);
|
||||
m_projectSettingsMenuButton->setText(m_projectName);
|
||||
m_projectSettingsMenuButton->setMenu(newProjectMenu);
|
||||
m_projectSettingsMenuButton->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
m_projectSettingsMenuButton->setStyleSheet("font-size: 14px; text-align:left;");
|
||||
vLayout->addWidget(m_projectSettingsMenuButton);
|
||||
QFrame* footer = new QFrame(this);
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
hLayout->setContentsMargins(0, 0, 0, 0);
|
||||
footer->setLayout(hLayout);
|
||||
{
|
||||
QLabel* projectNameLabel = new QLabel(m_projectName, this);
|
||||
hLayout->addWidget(projectNameLabel);
|
||||
|
||||
setFixedSize(s_projectImageWidth, s_projectImageHeight + m_projectSettingsMenuButton->height());
|
||||
QPushButton* projectMenuButton = new QPushButton(this);
|
||||
projectMenuButton->setObjectName("projectMenuButton");
|
||||
projectMenuButton->setMenu(newProjectMenu);
|
||||
hLayout->addWidget(projectMenuButton);
|
||||
}
|
||||
|
||||
vLayout->addWidget(footer);
|
||||
|
||||
connect(m_projectImageLabel, &LabelButton::triggered, [this]() { emit OpenProject(m_projectName); });
|
||||
connect(m_editProjectAction, &QAction::triggered, [this]() { emit EditProject(m_projectName); });
|
||||
|
||||
@@ -73,7 +73,6 @@ namespace O3DE::ProjectManager
|
||||
QString m_projectName;
|
||||
QString m_projectImagePath;
|
||||
LabelButton* m_projectImageLabel;
|
||||
QPushButton* m_projectSettingsMenuButton;
|
||||
QAction* m_editProjectAction;
|
||||
QAction* m_editProjectGemsAction;
|
||||
QAction* m_copyProjectAction;
|
||||
|
||||
@@ -11,52 +11,46 @@
|
||||
*/
|
||||
|
||||
#include <ProjectManagerWindow.h>
|
||||
#include <ScreenFactory.h>
|
||||
#include <ScreensCtrl.h>
|
||||
|
||||
#include <AzQtComponents/Components/StyleManager.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include <Source/ui_ProjectManagerWindow.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectManagerWindow::ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath)
|
||||
: QMainWindow(parent)
|
||||
, m_ui(new Ui::ProjectManagerWindowClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
QLayout* layout = m_ui->centralWidget->layout();
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_pythonBindings = AZStd::make_unique<PythonBindings>(engineRootPath);
|
||||
|
||||
m_screensCtrl = new ScreensCtrl();
|
||||
m_ui->verticalLayout->addWidget(m_screensCtrl);
|
||||
setWindowTitle(tr("O3DE Project Manager"));
|
||||
|
||||
connect(m_ui->projectsMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleProjectsMenu);
|
||||
connect(m_ui->engineMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleEngineMenu);
|
||||
ScreensCtrl* screensCtrl = new ScreensCtrl();
|
||||
|
||||
// currently the tab order on the home page is based on the order of this list
|
||||
QVector<ProjectManagerScreen> screenEnums =
|
||||
{
|
||||
ProjectManagerScreen::Projects,
|
||||
ProjectManagerScreen::EngineSettings,
|
||||
ProjectManagerScreen::CreateProject,
|
||||
ProjectManagerScreen::UpdateProject
|
||||
};
|
||||
screensCtrl->BuildScreens(screenEnums);
|
||||
|
||||
setCentralWidget(screensCtrl);
|
||||
|
||||
// setup stylesheets and hot reloading
|
||||
QDir rootDir = QString::fromUtf8(engineRootPath.Native().data(), aznumeric_cast<int>(engineRootPath.Native().size()));
|
||||
const auto pathOnDisk = rootDir.absoluteFilePath("Code/Tools/ProjectManager/Resources");
|
||||
const auto qrcPath = QStringLiteral(":/ProjectManager/style");
|
||||
AzQtComponents::StyleManager::addSearchPaths("style", pathOnDisk, qrcPath, engineRootPath);
|
||||
|
||||
// set stylesheet after creating the screens or their styles won't get updated
|
||||
AzQtComponents::StyleManager::setStyleSheet(this, QStringLiteral("style:ProjectManager.qss"));
|
||||
|
||||
QVector<ProjectManagerScreen> screenEnums =
|
||||
{
|
||||
ProjectManagerScreen::FirstTimeUse,
|
||||
ProjectManagerScreen::CreateProject,
|
||||
ProjectManagerScreen::ProjectsHome,
|
||||
ProjectManagerScreen::UpdateProject,
|
||||
ProjectManagerScreen::EngineSettings
|
||||
};
|
||||
m_screensCtrl->BuildScreens(screenEnums);
|
||||
m_screensCtrl->ForceChangeToScreen(ProjectManagerScreen::FirstTimeUse, false);
|
||||
screensCtrl->ForceChangeToScreen(ProjectManagerScreen::Projects, false);
|
||||
}
|
||||
|
||||
ProjectManagerWindow::~ProjectManagerWindow()
|
||||
@@ -64,13 +58,4 @@ namespace O3DE::ProjectManager
|
||||
m_pythonBindings.reset();
|
||||
}
|
||||
|
||||
void ProjectManagerWindow::HandleProjectsMenu()
|
||||
{
|
||||
m_screensCtrl->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
void ProjectManagerWindow::HandleEngineMenu()
|
||||
{
|
||||
m_screensCtrl->ChangeToScreen(ProjectManagerScreen::EngineSettings);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -13,17 +13,9 @@
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <ScreensCtrl.h>
|
||||
|
||||
#include <PythonBindings.h>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ProjectManagerWindowClass;
|
||||
}
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class ProjectManagerWindow
|
||||
@@ -35,13 +27,7 @@ namespace O3DE::ProjectManager
|
||||
explicit ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath);
|
||||
~ProjectManagerWindow();
|
||||
|
||||
protected slots:
|
||||
void HandleProjectsMenu();
|
||||
void HandleEngineMenu();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::ProjectManagerWindowClass> m_ui;
|
||||
ScreensCtrl* m_screensCtrl;
|
||||
AZStd::unique_ptr<PythonBindings> m_pythonBindings;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectManagerWindowClass</class>
|
||||
<widget class="QMainWindow" name="ProjectManagerWindowClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1200</width>
|
||||
<height>800</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>O3DE Project Manager</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1200</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="QMenu" name="iconMenu">
|
||||
<property name="title">
|
||||
<string>Icon</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/ProjectManager.qrc">
|
||||
<normaloff>:/o3de_editor.ico</normaloff>:/o3de_editor.ico</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="projectsMenu">
|
||||
<property name="title">
|
||||
<string>Projects</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="engineMenu">
|
||||
<property name="title">
|
||||
<string>Engine</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="iconMenu"/>
|
||||
<addaction name="projectsMenu"/>
|
||||
<addaction name="engineMenu"/>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../Resources/ProjectManager.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,206 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ProjectsHomeScreen.h>
|
||||
|
||||
#include <ProjectButtonWidget.h>
|
||||
#include <PythonBindingsInterface.h>
|
||||
#include <AzCore/Platform.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzFramework/AzFramework_Traits_Platform.h>
|
||||
#include <AzFramework/Process/ProcessCommon.h>
|
||||
#include <AzFramework/Process/ProcessWatcher.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QMenu>
|
||||
#include <QListView>
|
||||
#include <QSpacerItem>
|
||||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
#include <QFileInfo>
|
||||
#include <QScrollArea>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectsHomeScreen::ProjectsHomeScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
setLayout(vLayout);
|
||||
vLayout->setContentsMargins(s_contentMargins, s_contentMargins, s_contentMargins, s_contentMargins);
|
||||
|
||||
QHBoxLayout* topLayout = new QHBoxLayout();
|
||||
|
||||
QLabel* titleLabel = new QLabel(this);
|
||||
titleLabel->setText("My Projects");
|
||||
titleLabel->setStyleSheet("font-size: 24px");
|
||||
topLayout->addWidget(titleLabel);
|
||||
|
||||
QSpacerItem* topSpacer = new QSpacerItem(s_spacerSize, s_spacerSize, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
topLayout->addItem(topSpacer);
|
||||
|
||||
QMenu* newProjectMenu = new QMenu(this);
|
||||
m_createNewProjectAction = newProjectMenu->addAction("Create New Project");
|
||||
m_addExistingProjectAction = newProjectMenu->addAction("Add Existing Project");
|
||||
|
||||
QPushButton* newProjectMenuButton = new QPushButton(this);
|
||||
newProjectMenuButton->setText("New Project...");
|
||||
newProjectMenuButton->setMenu(newProjectMenu);
|
||||
newProjectMenuButton->setFixedWidth(s_newProjectButtonWidth);
|
||||
newProjectMenuButton->setStyleSheet("font-size: 14px;");
|
||||
topLayout->addWidget(newProjectMenuButton);
|
||||
|
||||
vLayout->addLayout(topLayout);
|
||||
|
||||
// Get all projects and create a horizontal scrolling list of them
|
||||
auto projectsResult = PythonBindingsInterface::Get()->GetProjects();
|
||||
if (projectsResult.IsSuccess() && !projectsResult.GetValue().isEmpty())
|
||||
{
|
||||
QScrollArea* projectsScrollArea = new QScrollArea(this);
|
||||
QWidget* scrollWidget = new QWidget();
|
||||
QGridLayout* projectGridLayout = new QGridLayout();
|
||||
scrollWidget->setLayout(projectGridLayout);
|
||||
projectsScrollArea->setWidget(scrollWidget);
|
||||
projectsScrollArea->setWidgetResizable(true);
|
||||
|
||||
int gridIndex = 0;
|
||||
for (auto project : projectsResult.GetValue())
|
||||
{
|
||||
ProjectButton* projectButton;
|
||||
QString projectPreviewPath = project.m_path + m_projectPreviewImagePath;
|
||||
QFileInfo doesPreviewExist(projectPreviewPath);
|
||||
if (doesPreviewExist.exists() && doesPreviewExist.isFile())
|
||||
{
|
||||
projectButton = new ProjectButton(project.m_projectName, projectPreviewPath, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectButton = new ProjectButton(project.m_projectName, this);
|
||||
}
|
||||
|
||||
// Create rows of projects buttons s_projectButtonRowCount buttons wide
|
||||
projectGridLayout->addWidget(projectButton, gridIndex / s_projectButtonRowCount, gridIndex % s_projectButtonRowCount);
|
||||
|
||||
connect(projectButton, &ProjectButton::OpenProject, this, &ProjectsHomeScreen::HandleOpenProject);
|
||||
connect(projectButton, &ProjectButton::EditProject, this, &ProjectsHomeScreen::HandleEditProject);
|
||||
|
||||
#ifdef SHOW_ALL_PROJECT_ACTIONS
|
||||
connect(projectButton, &ProjectButton::EditProjectGems, this, &ProjectsHomeScreen::HandleEditProjectGems);
|
||||
connect(projectButton, &ProjectButton::CopyProject, this, &ProjectsHomeScreen::HandleCopyProject);
|
||||
connect(projectButton, &ProjectButton::RemoveProject, this, &ProjectsHomeScreen::HandleRemoveProject);
|
||||
connect(projectButton, &ProjectButton::DeleteProject, this, &ProjectsHomeScreen::HandleDeleteProject);
|
||||
#endif
|
||||
++gridIndex;
|
||||
}
|
||||
|
||||
vLayout->addWidget(projectsScrollArea);
|
||||
}
|
||||
|
||||
// Using border-image allows for scaling options background-image does not support
|
||||
setStyleSheet("O3DE--ProjectManager--ScreenWidget { border-image: url(:/Backgrounds/FirstTimeBackgroundImage.jpg) repeat repeat; }");
|
||||
|
||||
connect(m_createNewProjectAction, &QAction::triggered, this, &ProjectsHomeScreen::HandleNewProjectButton);
|
||||
connect(m_addExistingProjectAction, &QAction::triggered, this, &ProjectsHomeScreen::HandleAddProjectButton);
|
||||
}
|
||||
|
||||
ProjectManagerScreen ProjectsHomeScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::ProjectsHome;
|
||||
}
|
||||
|
||||
void ProjectsHomeScreen::HandleNewProjectButton()
|
||||
{
|
||||
emit ResetScreenRequest(ProjectManagerScreen::CreateProject);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::CreateProject);
|
||||
}
|
||||
void ProjectsHomeScreen::HandleAddProjectButton()
|
||||
{
|
||||
// Do nothing for now
|
||||
}
|
||||
void ProjectsHomeScreen::HandleOpenProject(const QString& projectPath)
|
||||
{
|
||||
if (!projectPath.isEmpty())
|
||||
{
|
||||
AZ::IO::FixedMaxPath executableDirectory = AZ::Utils::GetExecutableDirectory();
|
||||
AZStd::string executableFilename = "Editor";
|
||||
AZ::IO::FixedMaxPath editorExecutablePath = executableDirectory / (executableFilename + AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
|
||||
auto cmdPath = AZ::IO::FixedMaxPathString::format("%s -regset=\"/Amazon/AzCore/Bootstrap/project_path=%s\"", editorExecutablePath.c_str(), projectPath.toStdString().c_str());
|
||||
|
||||
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
|
||||
processLaunchInfo.m_commandlineParameters = cmdPath;
|
||||
bool launchSucceeded = AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo);
|
||||
if (!launchSucceeded)
|
||||
{
|
||||
AZ_Error("ProjectManager", false, "Failed to launch editor");
|
||||
QMessageBox::critical( this, tr("Error"), tr("Failed to launch the Editor, please verify the project settings are valid."));
|
||||
}
|
||||
else
|
||||
{
|
||||
// prevent the user from accidentally pressing the button while the editor is launching
|
||||
// and let them know what's happening
|
||||
ProjectButton* button = qobject_cast<ProjectButton*>(sender());
|
||||
if (button)
|
||||
{
|
||||
button->SetButtonEnabled(false);
|
||||
button->SetButtonOverlayText(tr("Opening Editor..."));
|
||||
}
|
||||
|
||||
// enable the button after 3 seconds
|
||||
constexpr int waitTimeInMs = 3000;
|
||||
QTimer::singleShot(waitTimeInMs, this, [this, button] {
|
||||
if (button)
|
||||
{
|
||||
button->SetButtonEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("ProjectManager", false, "Cannot open editor because an empty project path was provided");
|
||||
QMessageBox::critical( this, tr("Error"), tr("Failed to launch the Editor because the project path is invalid."));
|
||||
}
|
||||
|
||||
}
|
||||
void ProjectsHomeScreen::HandleEditProject(const QString& projectPath)
|
||||
{
|
||||
emit NotifyCurrentProject(projectPath);
|
||||
emit ResetScreenRequest(ProjectManagerScreen::UpdateProject);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::UpdateProject);
|
||||
}
|
||||
void ProjectsHomeScreen::HandleEditProjectGems(const QString& projectPath)
|
||||
{
|
||||
emit NotifyCurrentProject(projectPath);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::GemCatalog);
|
||||
}
|
||||
void ProjectsHomeScreen::HandleCopyProject([[maybe_unused]] const QString& projectPath)
|
||||
{
|
||||
// Open file dialog and choose location for copied project then register copy with O3DE
|
||||
}
|
||||
void ProjectsHomeScreen::HandleRemoveProject([[maybe_unused]] const QString& projectPath)
|
||||
{
|
||||
// Unregister Project from O3DE
|
||||
}
|
||||
void ProjectsHomeScreen::HandleDeleteProject([[maybe_unused]] const QString& projectPath)
|
||||
{
|
||||
// Remove project from 03DE and delete from disk
|
||||
ProjectsHomeScreen::HandleRemoveProject(projectPath);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,347 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ProjectsScreen.h>
|
||||
|
||||
#include <ProjectButtonWidget.h>
|
||||
#include <PythonBindingsInterface.h>
|
||||
|
||||
#include <AzQtComponents/Components/FlowLayout.h>
|
||||
#include <AzCore/Platform.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzFramework/AzFramework_Traits_Platform.h>
|
||||
#include <AzFramework/Process/ProcessCommon.h>
|
||||
#include <AzFramework/Process/ProcessWatcher.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QMenu>
|
||||
#include <QListView>
|
||||
#include <QSpacerItem>
|
||||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
#include <QFileInfo>
|
||||
#include <QScrollArea>
|
||||
#include <QStackedWidget>
|
||||
#include <QFrame>
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
//#define DISPLAY_PROJECT_DEV_DATA true
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectsScreen::ProjectsScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->setAlignment(Qt::AlignTop);
|
||||
vLayout->setContentsMargins(s_contentMargins, 0, s_contentMargins, 0);
|
||||
setLayout(vLayout);
|
||||
|
||||
m_background.load(":/Backgrounds/FirstTimeBackgroundImage.jpg");
|
||||
|
||||
m_stack = new QStackedWidget(this);
|
||||
|
||||
m_firstTimeContent = CreateFirstTimeContent();
|
||||
m_stack->addWidget(m_firstTimeContent);
|
||||
|
||||
m_projectsContent = CreateProjectsContent();
|
||||
m_stack->addWidget(m_projectsContent);
|
||||
|
||||
vLayout->addWidget(m_stack);
|
||||
|
||||
connect(m_createNewProjectAction, &QAction::triggered, this, &ProjectsScreen::HandleNewProjectButton);
|
||||
connect(m_addExistingProjectAction, &QAction::triggered, this, &ProjectsScreen::HandleAddProjectButton);
|
||||
}
|
||||
|
||||
QFrame* ProjectsScreen::CreateFirstTimeContent()
|
||||
{
|
||||
QFrame* frame = new QFrame(this);
|
||||
frame->setObjectName("firstTimeContent");
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
frame->setLayout(layout);
|
||||
|
||||
QLabel* titleLabel = new QLabel(tr("Ready. Set. Create."), this);
|
||||
titleLabel->setObjectName("titleLabel");
|
||||
layout->addWidget(titleLabel);
|
||||
|
||||
QLabel* introLabel = new QLabel(this);
|
||||
introLabel->setObjectName("introLabel");
|
||||
introLabel->setText(tr("Welcome to O3DE! Start something new by creating a project. Not sure what to create? \nExplore what's "
|
||||
"available by downloading our sample project."));
|
||||
layout->addWidget(introLabel);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout(this);
|
||||
buttonLayout->setAlignment(Qt::AlignLeft);
|
||||
buttonLayout->setSpacing(s_spacerSize);
|
||||
|
||||
// use a newline to force the text up
|
||||
QPushButton* createProjectButton = new QPushButton(tr("Create a Project\n"), this);
|
||||
createProjectButton->setObjectName("createProjectButton");
|
||||
buttonLayout->addWidget(createProjectButton);
|
||||
|
||||
QPushButton* addProjectButton = new QPushButton(tr("Add a Project\n"), this);
|
||||
addProjectButton->setObjectName("addProjectButton");
|
||||
buttonLayout->addWidget(addProjectButton);
|
||||
|
||||
connect(createProjectButton, &QPushButton::clicked, this, &ProjectsScreen::HandleNewProjectButton);
|
||||
connect(addProjectButton, &QPushButton::clicked, this, &ProjectsScreen::HandleAddProjectButton);
|
||||
|
||||
layout->addLayout(buttonLayout);
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
QFrame* ProjectsScreen::CreateProjectsContent()
|
||||
{
|
||||
QFrame* frame = new QFrame(this);
|
||||
frame->setObjectName("projectsContent");
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
frame->setLayout(layout);
|
||||
|
||||
QFrame* header = new QFrame(this);
|
||||
QHBoxLayout* headerLayout = new QHBoxLayout();
|
||||
{
|
||||
QLabel* titleLabel = new QLabel(tr("My Projects"), this);
|
||||
titleLabel->setObjectName("titleLabel");
|
||||
headerLayout->addWidget(titleLabel);
|
||||
|
||||
QMenu* newProjectMenu = new QMenu(this);
|
||||
m_createNewProjectAction = newProjectMenu->addAction("Create New Project");
|
||||
m_addExistingProjectAction = newProjectMenu->addAction("Add Existing Project");
|
||||
|
||||
connect(m_createNewProjectAction, &QAction::triggered, this, &ProjectsScreen::HandleNewProjectButton);
|
||||
connect(m_addExistingProjectAction, &QAction::triggered, this, &ProjectsScreen::HandleAddProjectButton);
|
||||
|
||||
QPushButton* newProjectMenuButton = new QPushButton(tr("New Project..."), this);
|
||||
newProjectMenuButton->setObjectName("newProjectButton");
|
||||
newProjectMenuButton->setMenu(newProjectMenu);
|
||||
newProjectMenuButton->setDefault(true);
|
||||
headerLayout->addWidget(newProjectMenuButton);
|
||||
}
|
||||
header->setLayout(headerLayout);
|
||||
|
||||
layout->addWidget(header);
|
||||
|
||||
// Get all projects and create a horizontal scrolling list of them
|
||||
auto projectsResult = PythonBindingsInterface::Get()->GetProjects();
|
||||
if (projectsResult.IsSuccess() && !projectsResult.GetValue().isEmpty())
|
||||
{
|
||||
QScrollArea* projectsScrollArea = new QScrollArea(this);
|
||||
QWidget* scrollWidget = new QWidget();
|
||||
|
||||
FlowLayout* flowLayout = new FlowLayout(0, s_spacerSize, s_spacerSize);
|
||||
scrollWidget->setLayout(flowLayout);
|
||||
|
||||
projectsScrollArea->setWidget(scrollWidget);
|
||||
projectsScrollArea->setWidgetResizable(true);
|
||||
|
||||
#ifndef DISPLAY_PROJECT_DEV_DATA
|
||||
for (auto project : projectsResult.GetValue())
|
||||
#else
|
||||
ProjectInfo project = projectsResult.GetValue().at(0);
|
||||
for (int i = 0; i < 15; i++)
|
||||
#endif
|
||||
{
|
||||
ProjectButton* projectButton;
|
||||
QString projectPreviewPath = project.m_path + m_projectPreviewImagePath;
|
||||
QFileInfo doesPreviewExist(projectPreviewPath);
|
||||
if (doesPreviewExist.exists() && doesPreviewExist.isFile())
|
||||
{
|
||||
projectButton = new ProjectButton(project.m_projectName, projectPreviewPath, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectButton = new ProjectButton(project.m_projectName, this);
|
||||
}
|
||||
|
||||
flowLayout->addWidget(projectButton);
|
||||
|
||||
connect(projectButton, &ProjectButton::OpenProject, this, &ProjectsScreen::HandleOpenProject);
|
||||
connect(projectButton, &ProjectButton::EditProject, this, &ProjectsScreen::HandleEditProject);
|
||||
|
||||
#ifdef DISPLAY_PROJECT_DEV_DATA
|
||||
connect(projectButton, &ProjectButton::EditProjectGems, this, &ProjectsScreen::HandleEditProjectGems);
|
||||
connect(projectButton, &ProjectButton::CopyProject, this, &ProjectsScreen::HandleCopyProject);
|
||||
connect(projectButton, &ProjectButton::RemoveProject, this, &ProjectsScreen::HandleRemoveProject);
|
||||
connect(projectButton, &ProjectButton::DeleteProject, this, &ProjectsScreen::HandleDeleteProject);
|
||||
#endif
|
||||
}
|
||||
|
||||
layout->addWidget(projectsScrollArea);
|
||||
}
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
ProjectManagerScreen ProjectsScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::Projects;
|
||||
}
|
||||
|
||||
bool ProjectsScreen::IsTab()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QString ProjectsScreen::GetTabText()
|
||||
{
|
||||
return tr("Projects");
|
||||
}
|
||||
|
||||
void ProjectsScreen::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
{
|
||||
// we paint the background here because qss does not support background cover scaling
|
||||
QPainter painter(this);
|
||||
|
||||
auto winSize = size();
|
||||
auto pixmapRatio = (float)m_background.width() / m_background.height();
|
||||
auto windowRatio = (float)winSize.width() / winSize.height();
|
||||
|
||||
if (pixmapRatio > windowRatio)
|
||||
{
|
||||
auto newWidth = (int)(winSize.height() * pixmapRatio);
|
||||
auto offset = (newWidth - winSize.width()) / -2;
|
||||
painter.drawPixmap(offset, 0, newWidth, winSize.height(), m_background);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto newHeight = (int)(winSize.width() / pixmapRatio);
|
||||
painter.drawPixmap(0, 0, winSize.width(), newHeight, m_background);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectsScreen::HandleNewProjectButton()
|
||||
{
|
||||
emit ResetScreenRequest(ProjectManagerScreen::CreateProject);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::CreateProject);
|
||||
}
|
||||
void ProjectsScreen::HandleAddProjectButton()
|
||||
{
|
||||
// Do nothing for now
|
||||
}
|
||||
void ProjectsScreen::HandleOpenProject(const QString& projectPath)
|
||||
{
|
||||
if (!projectPath.isEmpty())
|
||||
{
|
||||
AZ::IO::FixedMaxPath executableDirectory = AZ::Utils::GetExecutableDirectory();
|
||||
AZStd::string executableFilename = "Editor";
|
||||
AZ::IO::FixedMaxPath editorExecutablePath = executableDirectory / (executableFilename + AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
|
||||
auto cmdPath = AZ::IO::FixedMaxPathString::format("%s -regset=\"/Amazon/AzCore/Bootstrap/project_path=%s\"", editorExecutablePath.c_str(), projectPath.toStdString().c_str());
|
||||
|
||||
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
|
||||
processLaunchInfo.m_commandlineParameters = cmdPath;
|
||||
bool launchSucceeded = AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo);
|
||||
if (!launchSucceeded)
|
||||
{
|
||||
AZ_Error("ProjectManager", false, "Failed to launch editor");
|
||||
QMessageBox::critical( this, tr("Error"), tr("Failed to launch the Editor, please verify the project settings are valid."));
|
||||
}
|
||||
else
|
||||
{
|
||||
// prevent the user from accidentally pressing the button while the editor is launching
|
||||
// and let them know what's happening
|
||||
ProjectButton* button = qobject_cast<ProjectButton*>(sender());
|
||||
if (button)
|
||||
{
|
||||
button->SetButtonEnabled(false);
|
||||
button->SetButtonOverlayText(tr("Opening Editor..."));
|
||||
}
|
||||
|
||||
// enable the button after 3 seconds
|
||||
constexpr int waitTimeInMs = 3000;
|
||||
QTimer::singleShot(waitTimeInMs, this, [this, button] {
|
||||
if (button)
|
||||
{
|
||||
button->SetButtonEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("ProjectManager", false, "Cannot open editor because an empty project path was provided");
|
||||
QMessageBox::critical( this, tr("Error"), tr("Failed to launch the Editor because the project path is invalid."));
|
||||
}
|
||||
|
||||
}
|
||||
void ProjectsScreen::HandleEditProject(const QString& projectPath)
|
||||
{
|
||||
emit NotifyCurrentProject(projectPath);
|
||||
emit ResetScreenRequest(ProjectManagerScreen::UpdateProject);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::UpdateProject);
|
||||
}
|
||||
void ProjectsScreen::HandleEditProjectGems(const QString& projectPath)
|
||||
{
|
||||
emit NotifyCurrentProject(projectPath);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::GemCatalog);
|
||||
}
|
||||
void ProjectsScreen::HandleCopyProject([[maybe_unused]] const QString& projectPath)
|
||||
{
|
||||
// Open file dialog and choose location for copied project then register copy with O3DE
|
||||
}
|
||||
void ProjectsScreen::HandleRemoveProject([[maybe_unused]] const QString& projectPath)
|
||||
{
|
||||
// Unregister Project from O3DE
|
||||
}
|
||||
void ProjectsScreen::HandleDeleteProject([[maybe_unused]] const QString& projectPath)
|
||||
{
|
||||
// Remove project from 03DE and delete from disk
|
||||
ProjectsScreen::HandleRemoveProject(projectPath);
|
||||
}
|
||||
|
||||
void ProjectsScreen::NotifyCurrentScreen()
|
||||
{
|
||||
if (ShouldDisplayFirstTimeContent())
|
||||
{
|
||||
m_stack->setCurrentWidget(m_firstTimeContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stack->setCurrentWidget(m_projectsContent);
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectsScreen::ShouldDisplayFirstTimeContent()
|
||||
{
|
||||
auto projectsResult = PythonBindingsInterface::Get()->GetProjects();
|
||||
if (!projectsResult.IsSuccess() || projectsResult.GetValue().isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
bool displayFirstTimeContent = settings.value("displayFirstTimeContent", true).toBool();
|
||||
if (displayFirstTimeContent)
|
||||
{
|
||||
settings.setValue("displayFirstTimeContent", false);
|
||||
}
|
||||
|
||||
return displayFirstTimeContent;
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -15,16 +15,26 @@
|
||||
#include <ScreenWidget.h>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QPaintEvent)
|
||||
QT_FORWARD_DECLARE_CLASS(QFrame)
|
||||
QT_FORWARD_DECLARE_CLASS(QStackedWidget)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class ProjectsHomeScreen
|
||||
class ProjectsScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
|
||||
public:
|
||||
explicit ProjectsHomeScreen(QWidget* parent = nullptr);
|
||||
~ProjectsHomeScreen() = default;
|
||||
explicit ProjectsScreen(QWidget* parent = nullptr);
|
||||
~ProjectsScreen() = default;
|
||||
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
QString GetTabText() override;
|
||||
bool IsTab() override;
|
||||
|
||||
protected:
|
||||
void NotifyCurrentScreen() override;
|
||||
|
||||
protected slots:
|
||||
void HandleNewProjectButton();
|
||||
@@ -36,16 +46,24 @@ namespace O3DE::ProjectManager
|
||||
void HandleRemoveProject(const QString& projectPath);
|
||||
void HandleDeleteProject(const QString& projectPath);
|
||||
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
private:
|
||||
QFrame* CreateFirstTimeContent();
|
||||
QFrame* CreateProjectsContent();
|
||||
bool ShouldDisplayFirstTimeContent();
|
||||
|
||||
QAction* m_createNewProjectAction;
|
||||
QAction* m_addExistingProjectAction;
|
||||
QPixmap m_background;
|
||||
QFrame* m_firstTimeContent;
|
||||
QFrame* m_projectsContent;
|
||||
QStackedWidget* m_stack;
|
||||
|
||||
const QString m_projectPreviewImagePath = "/preview.png";
|
||||
|
||||
inline constexpr static int s_contentMargins = 80;
|
||||
inline constexpr static int s_spacerSize = 20;
|
||||
inline constexpr static int s_projectButtonRowCount = 4;
|
||||
inline constexpr static int s_newProjectButtonWidth = 156;
|
||||
|
||||
};
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -17,11 +17,10 @@ namespace O3DE::ProjectManager
|
||||
{
|
||||
Invalid = -1,
|
||||
Empty,
|
||||
FirstTimeUse,
|
||||
CreateProject,
|
||||
NewProjectSettings,
|
||||
GemCatalog,
|
||||
ProjectsHome,
|
||||
Projects,
|
||||
UpdateProject,
|
||||
ProjectSettings,
|
||||
EngineSettings
|
||||
|
||||