merging latest origin
This commit is contained in:
@@ -284,6 +284,10 @@ namespace AzToolsFramework
|
||||
void ToolsApplication::Start(const Descriptor& descriptor, const StartupParameters& startupParameters/* = StartupParameters()*/)
|
||||
{
|
||||
Application::Start(descriptor, startupParameters);
|
||||
if (!m_isStarted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_editorEntityManager.Start();
|
||||
|
||||
@@ -671,20 +675,8 @@ namespace AzToolsFramework
|
||||
// if the new viewport interaction model is enabled we do not want to
|
||||
// filter out locked entities as this breaks with the logic of being
|
||||
// able to select locked entities in the entity outliner
|
||||
if (IsNewViewportInteractionModelEnabled())
|
||||
{
|
||||
selectedEntitiesFiltered.insert(
|
||||
selectedEntitiesFiltered.begin(), selectedEntities.begin(), selectedEntities.end());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (AZ::EntityId nowSelectedId : selectedEntities)
|
||||
{
|
||||
AZ_Assert(nowSelectedId.IsValid(), "Invalid entity Id being marked as selected.");
|
||||
|
||||
selectedEntitiesFiltered.push_back(nowSelectedId);
|
||||
}
|
||||
}
|
||||
selectedEntitiesFiltered.insert(
|
||||
selectedEntitiesFiltered.begin(), selectedEntities.begin(), selectedEntities.end());
|
||||
|
||||
EntityIdList newlySelectedIds;
|
||||
EntityIdList newlyDeselectedIds;
|
||||
|
||||
@@ -216,14 +216,9 @@ namespace AzToolsFramework::AssetUtils
|
||||
constexpr const char* AssetProcessorGamePlatformConfigFileName = "AssetProcessorGamePlatformConfig.ini";
|
||||
constexpr const char* AssetProcessorGamePlatformConfigSetreg = "AssetProcessorGamePlatformConfig.setreg";
|
||||
AZStd::vector<AZ::IO::Path> configFiles;
|
||||
AZ::IO::Path configRoot(engineRoot);
|
||||
|
||||
AZ::IO::Path rootConfigFile = configRoot / AssetProcessorPlatformConfigFileName;
|
||||
configFiles.push_back(rootConfigFile);
|
||||
|
||||
// Add a file entry for the Engine Root AssetProcessor setreg file
|
||||
rootConfigFile = configRoot / AssetProcessorPlatformConfigSetreg;
|
||||
configFiles.push_back(rootConfigFile);
|
||||
// Add the AssetProcessorPlatformConfig setreg file at the engine root
|
||||
configFiles.push_back(AZ::IO::Path(engineRoot) / AssetProcessorPlatformConfigSetreg);
|
||||
|
||||
if (addPlatformConfigs)
|
||||
{
|
||||
|
||||
+14
-14
@@ -200,67 +200,67 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".abc"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/ABC_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/ABC_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".bnk"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Audio_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Audio_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".cgf"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacyMesh_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/LegacyMesh_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".font"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".fontfamily"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".i_caf"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacyAnimation_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/LegacyAnimation_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".inputbindings"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/InputBindings_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/InputBindings_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".lua"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Lua_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Lua_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".mtl"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Material_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Material_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), AzToolsFramework::SliceUtilities::GetSliceFileExtension().c_str()))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Slice_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Slice_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".skin"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacySkin_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/LegacySkin_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".ttf"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".xml"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/XML_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/XML_16.svg");
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace AzToolsFramework
|
||||
const char* sourceFormatExtension = sourceFormats[sourceImageFormatIndex];
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), sourceFormatExtension))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Image_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Image_16.svg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-38
@@ -52,17 +52,16 @@ namespace AzToolsFramework
|
||||
return AssetEntryType::Root;
|
||||
}
|
||||
|
||||
void RootAssetBrowserEntry::Update(const char* devPath)
|
||||
void RootAssetBrowserEntry::Update(const char* enginePath)
|
||||
{
|
||||
RemoveChildren();
|
||||
EntryCache::GetInstance()->Clear();
|
||||
m_scanFolderOutputPrefixMap.clear();
|
||||
|
||||
m_devPath = devPath;
|
||||
m_enginePath = enginePath;
|
||||
|
||||
// there is no "Gems" scan folder registered in db, create one manually
|
||||
auto gemFolder = aznew FolderAssetBrowserEntry();
|
||||
gemFolder->m_name = m_devPath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
|
||||
gemFolder->m_name = m_enginePath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
|
||||
gemFolder->m_displayName = GEMS_FOLDER_NAME;
|
||||
gemFolder->m_isGemsFolder = true;
|
||||
AddChild(gemFolder);
|
||||
@@ -90,11 +89,6 @@ namespace AzToolsFramework
|
||||
scanFolder->m_displayName = QString::fromUtf8(scanFolderDatabaseEntry.m_displayName.c_str());
|
||||
EntryCache::GetInstance()->m_scanFolderIdMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolder;
|
||||
}
|
||||
|
||||
if (!scanFolderDatabaseEntry.m_outputPrefix.empty())
|
||||
{
|
||||
m_scanFolderOutputPrefixMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolderDatabaseEntry.m_outputPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
void RootAssetBrowserEntry::AddFile(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry)
|
||||
@@ -132,7 +126,7 @@ namespace AzToolsFramework
|
||||
return;
|
||||
}
|
||||
|
||||
const char* filePath = GetScanFolderOutputAdjustedPath(fileDatabaseEntry, scanFolder);
|
||||
const char* filePath = fileDatabaseEntry.m_fileName.c_str();
|
||||
|
||||
AssetBrowserEntry* file;
|
||||
// file can be either folder or actual file
|
||||
@@ -441,33 +435,5 @@ namespace AzToolsFramework
|
||||
{
|
||||
return MAKE_TKEY(ThumbnailKey);
|
||||
}
|
||||
|
||||
const char* RootAssetBrowserEntry::GetScanFolderOutputAdjustedPath(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry, const AssetBrowserEntry* scanFolder)
|
||||
{
|
||||
Q_UNUSED(scanFolder);
|
||||
|
||||
const char* filePath = fileDatabaseEntry.m_fileName.c_str();
|
||||
|
||||
// adjust for output prefixes on scan folders (i.e. "editor")
|
||||
auto itScanFolderOutputPrefix = m_scanFolderOutputPrefixMap.find(fileDatabaseEntry.m_scanFolderPK);
|
||||
if (itScanFolderOutputPrefix != m_scanFolderOutputPrefixMap.end())
|
||||
{
|
||||
const AZStd::string& outputPrefix = itScanFolderOutputPrefix->second;
|
||||
|
||||
// Check if the input path starts with the output prefix.
|
||||
// If it doesn't, something probably went seriously wrong,
|
||||
// or someone is calling this function with an absolute path.
|
||||
bool pathStartsWithPrefix = ((strncmp(filePath, outputPrefix.c_str(), outputPrefix.length()) == 0) && (fileDatabaseEntry.m_fileName.length() > (outputPrefix.length() + 1)));
|
||||
AZ_Warning("Asset Browser", pathStartsWithPrefix, "Entry %s reported as under a ScanFolder (%s) with an 'output=%s', but the new entry does not begin with the output prefix! RootAssetBrowserEntry::GetScanFolderOutputAdjustedPath expects relative paths, not absolute; treating the input path as if it does not contain the ScanFolder output prefix.", filePath, scanFolder->m_name.c_str(), outputPrefix.c_str());
|
||||
|
||||
if (pathStartsWithPrefix)
|
||||
{
|
||||
// move the beginning ahead by the output prefix plus the separator
|
||||
filePath += (outputPrefix.length() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
+3
-6
@@ -60,8 +60,8 @@ namespace AzToolsFramework
|
||||
|
||||
AssetEntryType GetEntryType() const override;
|
||||
|
||||
//! Update root node to new dev location
|
||||
void Update(const char* devPath);
|
||||
//! Update root node to new engine location
|
||||
void Update(const char* enginePath);
|
||||
|
||||
void AddScanFolder(const AssetDatabase::ScanFolderDatabaseEntry& scanFolderDatabaseEntry);
|
||||
void AddFile(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry);
|
||||
@@ -82,15 +82,12 @@ namespace AzToolsFramework
|
||||
private:
|
||||
AZ_DISABLE_COPY_MOVE(RootAssetBrowserEntry);
|
||||
|
||||
AZStd::string m_devPath;
|
||||
AZStd::unordered_map<AZ::s64, AZStd::string> m_scanFolderOutputPrefixMap;
|
||||
AZStd::string m_enginePath;
|
||||
|
||||
//! Create folder entry child
|
||||
FolderAssetBrowserEntry* CreateFolder(const char* folderName, AssetBrowserEntry* parent);
|
||||
//! Recursively create folder structure leading to relative path from parent
|
||||
AssetBrowserEntry* CreateFolders(const char* relativePath, AssetBrowserEntry* parent);
|
||||
//! Get the path for the fileDatabaseEntry, offset by the output prefix for the scan folder ancestor, if it's been specified and if it's appropriate
|
||||
const char* GetScanFolderOutputAdjustedPath(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry, const AssetBrowserEntry* scanFolder);
|
||||
|
||||
bool m_isInitialUpdate = false;
|
||||
};
|
||||
|
||||
+8
-12
@@ -10,8 +10,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Thumbnails/FolderThumbnail.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <QPixmap>
|
||||
@@ -50,11 +50,11 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// FolderThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static constexpr const char* FolderIconPath = "Editor/Icons/AssetBrowser/Folder_16.svg";
|
||||
static constexpr const char* GemIconPath = "Editor/Icons/AssetBrowser/GemFolder_16.svg";
|
||||
static constexpr const char* FolderIconPath = "Assets/Editor/Icons/AssetBrowser/Folder_16.svg";
|
||||
static constexpr const char* GemIconPath = "Assets/Editor/Icons/AssetBrowser/GemFolder_16.svg";
|
||||
|
||||
FolderThumbnail::FolderThumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
FolderThumbnail::FolderThumbnail(SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{}
|
||||
|
||||
void FolderThumbnail::LoadThread()
|
||||
@@ -62,14 +62,10 @@ namespace AzToolsFramework
|
||||
auto folderKey = azrtti_cast<const FolderThumbnailKey*>(m_key.data());
|
||||
AZ_Assert(folderKey, "Incorrect key type, excpected FolderThumbnailKey");
|
||||
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
AZ_Assert(engineRoot, "Engine Root not initialized");
|
||||
const char* folderIcon = folderKey->IsGem() ? GemIconPath : FolderIconPath;
|
||||
AZStd::string absoluteIconPath;
|
||||
AZ::StringFunc::Path::Join(engineRoot, folderIcon, absoluteIconPath);
|
||||
|
||||
m_icon = QIcon(absoluteIconPath.c_str());
|
||||
auto absoluteIconPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / folderIcon;
|
||||
m_pixmap.load(absoluteIconPath.c_str());
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FolderThumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
FolderThumbnail(SharedThumbnailKey key);
|
||||
void LoadThread() override;
|
||||
};
|
||||
|
||||
|
||||
+5
-9
@@ -55,10 +55,10 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ProductThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const char* DEFAULT_PRODUCT_ICON_PATH = "Editor/Icons/AssetBrowser/DefaultProduct_16.svg";
|
||||
static const char* DEFAULT_PRODUCT_ICON_PATH = "Icons/AssetBrowser/DefaultProduct_16.svg";
|
||||
|
||||
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{}
|
||||
|
||||
void ProductThumbnail::LoadThread()
|
||||
@@ -96,12 +96,8 @@ namespace AzToolsFramework
|
||||
iconPath = QString::fromUtf8(DEFAULT_PRODUCT_ICON_PATH);
|
||||
}
|
||||
|
||||
m_icon = QIcon(iconPath);
|
||||
|
||||
if (m_icon.isNull())
|
||||
{
|
||||
m_state = State::Failed;
|
||||
}
|
||||
m_pixmap.load(iconPath);
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize);
|
||||
ProductThumbnail(Thumbnailer::SharedThumbnailKey key);
|
||||
|
||||
protected:
|
||||
void LoadThread() override;
|
||||
|
||||
+5
-4
@@ -55,11 +55,11 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SourceThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static constexpr const char* DefaultFileIconPath = "Editor/Icons/AssetBrowser/Default_16.svg";
|
||||
static constexpr const char* DefaultFileIconPath = "Icons/AssetBrowser/Default_16.svg";
|
||||
QMutex SourceThumbnail::m_mutex;
|
||||
|
||||
SourceThumbnail::SourceThumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
SourceThumbnail::SourceThumbnail(SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -124,7 +124,8 @@ namespace AzToolsFramework
|
||||
iconPathToUse = iconPath.c_str();
|
||||
}
|
||||
|
||||
m_icon = QIcon(iconPathToUse);
|
||||
m_pixmap.load(iconPathToUse);
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourceThumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
SourceThumbnail(SharedThumbnailKey key);
|
||||
|
||||
protected:
|
||||
void LoadThread() override;
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ namespace AzToolsFramework
|
||||
else
|
||||
{
|
||||
// Scaling and centering pixmap within bounds to preserve aspect ratio
|
||||
const QPixmap pixmap = thumbnail->GetPixmap(size).scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
const QPixmap pixmap = thumbnail->GetPixmap().scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
const QSize sizeDelta = size - pixmap.size();
|
||||
const QPoint pointDelta = QPoint(sizeDelta.width() / 2, sizeDelta.height() / 2);
|
||||
painter->drawPixmap(point + pointDelta, pixmap);
|
||||
|
||||
+6
-23
@@ -17,7 +17,7 @@
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/Utils.h>
|
||||
#include <AzCore/std/parallel/thread.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/Asset/AssetBundleManifest.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
@@ -250,7 +250,7 @@ namespace AzToolsFramework
|
||||
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
AZ_Assert(fileIO != nullptr, "AZ::IO::FileIOBase must be ready for use.\n");
|
||||
|
||||
AZStd::string bundleFilePath = assetBundleSettings.m_bundleFilePath;
|
||||
AZ::IO::Path bundleFilePath = AZ::IO::Path(AZStd::string_view{ AZ::Utils::GetEnginePath() }) / assetBundleSettings.m_bundleFilePath;
|
||||
|
||||
AzFramework::PlatformId platformId = static_cast<AzFramework::PlatformId>(AzFramework::PlatformHelper::GetPlatformIndexFromName(assetBundleSettings.m_platform.c_str()));
|
||||
|
||||
@@ -259,22 +259,13 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* appRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
|
||||
|
||||
if (AzFramework::StringFunc::Path::IsRelative(bundleFilePath.c_str()))
|
||||
{
|
||||
AzFramework::StringFunc::Path::ConstructFull(appRoot, bundleFilePath.c_str(), bundleFilePath, true);
|
||||
}
|
||||
|
||||
AZ::u64 maxSizeInBytes = static_cast<AZ::u64>(assetBundleSettings.m_maxBundleSizeInMB * NumOfBytesInMB);
|
||||
AZ::u64 assetCatalogFileSizeBuffer = static_cast<AZ::u64>(AssetCatalogFileSizeBufferPercentage * assetBundleSettings.m_maxBundleSizeInMB * NumOfBytesInMB) / 100;
|
||||
AZ::u64 bundleSize = 0;
|
||||
AZ::u64 totalFileSize = 0;
|
||||
int bundleIndex = 0;
|
||||
|
||||
AZStd::string bundleFullPath = bundleFilePath;
|
||||
AZStd::string tempBundleFilePath = bundleFullPath + "_temp";
|
||||
AZStd::string tempBundleFilePath = bundleFilePath.Native() + "_temp";
|
||||
|
||||
AZStd::vector<AZStd::string> dependentBundleNames;
|
||||
AZStd::vector<AZStd::string> levelDirs;
|
||||
@@ -301,7 +292,7 @@ namespace AzToolsFramework
|
||||
if (fileIO->Exists(bundleFilePath.c_str()))
|
||||
{
|
||||
// This will delete both the parent bundle as well as all the dependent bundles mentioned in the manifest file of the parent bundle.
|
||||
if (!DeleteBundleFiles(bundleFilePath))
|
||||
if (!DeleteBundleFiles(bundleFilePath.Native()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -390,7 +381,7 @@ namespace AzToolsFramework
|
||||
// we need to find a bundle which does not exist on disk;
|
||||
bundleIndex++;
|
||||
numOfTries--;
|
||||
dependentBundleFileName = CreateAssetBundleFileName(bundleFilePath, bundleIndex);
|
||||
dependentBundleFileName = CreateAssetBundleFileName(bundleFilePath.Native(), bundleIndex);
|
||||
AzFramework::StringFunc::Path::ReplaceFullName(tempBundleFilePath, (dependentBundleFileName + tempBundleFileSuffix).c_str());
|
||||
} while (numOfTries && fileIO->Exists(tempBundleFilePath.c_str()));
|
||||
|
||||
@@ -463,15 +454,7 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
|
||||
AZStd::string assetFileInfoListPath = assetBundleSettings.m_assetFileInfoListPath;
|
||||
|
||||
const char* appRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
|
||||
|
||||
if (AzFramework::StringFunc::Path::IsRelative(assetFileInfoListPath.c_str()))
|
||||
{
|
||||
AzFramework::StringFunc::Path::ConstructFull(appRoot, assetFileInfoListPath.c_str(), assetFileInfoListPath, true);
|
||||
}
|
||||
AZ::IO::Path assetFileInfoListPath = AZ::IO::Path{ AZStd::string_view{AZ::Utils::GetEnginePath()} } / assetBundleSettings.m_assetFileInfoListPath;
|
||||
|
||||
if (!fileIO->Exists(assetFileInfoListPath.c_str()))
|
||||
{
|
||||
|
||||
+1
-9
@@ -943,10 +943,8 @@ namespace AzToolsFramework
|
||||
const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot)
|
||||
: m_scanFolderID(scanFolderID)
|
||||
, m_outputPrefix(outputPrefix)
|
||||
, m_isRoot(isRoot)
|
||||
{
|
||||
if (scanFolder)
|
||||
@@ -967,10 +965,8 @@ namespace AzToolsFramework
|
||||
const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot)
|
||||
: m_outputPrefix(outputPrefix)
|
||||
, m_isRoot(isRoot)
|
||||
: m_isRoot(isRoot)
|
||||
{
|
||||
if (scanFolder)
|
||||
{
|
||||
@@ -993,7 +989,6 @@ namespace AzToolsFramework
|
||||
, m_scanFolder(other.m_scanFolder)
|
||||
, m_displayName(other.m_displayName)
|
||||
, m_portableKey(other.m_portableKey)
|
||||
, m_outputPrefix(other.m_outputPrefix)
|
||||
, m_isRoot(other.m_isRoot)
|
||||
{
|
||||
}
|
||||
@@ -1011,7 +1006,6 @@ namespace AzToolsFramework
|
||||
m_scanFolderID = other.m_scanFolderID;
|
||||
m_displayName = AZStd::move(other.m_displayName);
|
||||
m_portableKey = AZStd::move(other.m_portableKey);
|
||||
m_outputPrefix = AZStd::move(other.m_outputPrefix);
|
||||
m_isRoot = other.m_isRoot;
|
||||
}
|
||||
return *this;
|
||||
@@ -1023,7 +1017,6 @@ namespace AzToolsFramework
|
||||
m_scanFolderID = other.m_scanFolderID;
|
||||
m_displayName = other.m_displayName;
|
||||
m_portableKey = other.m_portableKey;
|
||||
m_outputPrefix = other.m_outputPrefix;
|
||||
m_isRoot = other.m_isRoot;
|
||||
return *this;
|
||||
}
|
||||
@@ -1050,7 +1043,6 @@ namespace AzToolsFramework
|
||||
MakeColumn("ScanFolder", m_scanFolder),
|
||||
MakeColumn("DisplayName", m_displayName),
|
||||
MakeColumn("PortableKey", m_portableKey),
|
||||
MakeColumn("OutputPrefix", m_outputPrefix),
|
||||
MakeColumn("IsRoot", m_isRoot)
|
||||
);
|
||||
}
|
||||
|
||||
+1
-3
@@ -68,6 +68,7 @@ namespace AzToolsFramework
|
||||
AddedLastScanTimeField = 28,
|
||||
AddedScanTimeSecondsSinceEpochField = 29,
|
||||
ChangedSortFunctionFromQSortToStdStableSort = 30,
|
||||
RemoveOutputPrefixFromScanFolders,
|
||||
//Add all new versions before this
|
||||
DatabaseVersionCount,
|
||||
LatestVersion = DatabaseVersionCount - 1
|
||||
@@ -99,12 +100,10 @@ namespace AzToolsFramework
|
||||
const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot = 0);
|
||||
ScanFolderDatabaseEntry(const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot = 0);
|
||||
ScanFolderDatabaseEntry(const ScanFolderDatabaseEntry& other);
|
||||
ScanFolderDatabaseEntry(ScanFolderDatabaseEntry&& other);
|
||||
@@ -120,7 +119,6 @@ namespace AzToolsFramework
|
||||
AZStd::string m_scanFolder; // the actual local computer path to that scan folder.
|
||||
AZStd::string m_displayName; // a display name, blank means it should not show up in UIs
|
||||
AZStd::string m_portableKey; // a key that uniquely identifies a scan folder so that we can recognize the same one in other databases/computer
|
||||
AZStd::string m_outputPrefix;
|
||||
int m_isRoot = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiSystemComponent.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerComponent.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserComponent.h>
|
||||
#include <AzToolsFramework/MaterialBrowser/MaterialBrowserComponent.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
@@ -93,7 +92,6 @@ namespace AzToolsFramework
|
||||
AzToolsFramework::SliceDependencyBrowserComponent::CreateDescriptor(),
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerComponent::CreateDescriptor(),
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserComponent::CreateDescriptor(),
|
||||
AzToolsFramework::MaterialBrowser::MaterialBrowserComponent::CreateDescriptor(),
|
||||
AzToolsFramework::EditorInteractionSystemComponent::CreateDescriptor(),
|
||||
AzToolsFramework::Components::EditorComponentAPIComponent::CreateDescriptor(),
|
||||
AzToolsFramework::Components::EditorLevelComponentAPIComponent::CreateDescriptor(),
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace AzToolsFramework
|
||||
/// Retrieve the Id of the editor entity context.
|
||||
virtual AzFramework::EntityContextId GetEditorEntityContextId() = 0;
|
||||
|
||||
virtual AzFramework::EntityContext* GetEditorEntityContextInstance() = 0;
|
||||
|
||||
/// Creates an entity in the editor context.
|
||||
/// \return the EntityId for the created Entity
|
||||
virtual AZ::EntityId CreateNewEditorEntity(const char* name) = 0;
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EditorEntityContextRequestBus
|
||||
AzFramework::EntityContextId GetEditorEntityContextId() override { return GetContextId(); }
|
||||
AzFramework::EntityContext* GetEditorEntityContextInstance() override { return this; }
|
||||
void ResetEditorContext() override;
|
||||
|
||||
AZ::EntityId CreateNewEditorEntity(const char* name) override;
|
||||
|
||||
+2
-2
@@ -769,12 +769,12 @@ namespace AzToolsFramework
|
||||
|
||||
template<typename Vertex>
|
||||
void EditorVertexSelectionBase<Vertex>::DisplayViewport2d(
|
||||
const AzFramework::ViewportInfo& /*viewportInfo*/,
|
||||
const AzFramework::ViewportInfo& viewportInfo,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
m_editorBoxSelect.Display2d(debugDisplay);
|
||||
m_editorBoxSelect.Display2d(viewportInfo, debugDisplay);
|
||||
}
|
||||
|
||||
template<typename Vertex>
|
||||
|
||||
@@ -1,43 +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
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
struct AssetId;
|
||||
}
|
||||
}
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace MaterialBrowser
|
||||
{
|
||||
class MaterialBrowserRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
// Only a single handler is allowed
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
|
||||
virtual bool HasRecord(const AZ::Data::AssetId& assetId) = 0;
|
||||
virtual bool IsMultiMaterial(const AZ::Data::AssetId& assetId) = 0;
|
||||
};
|
||||
|
||||
using MaterialBrowserRequestBus = AZ::EBus<MaterialBrowserRequests>;
|
||||
} // namespace MaterialBrowser
|
||||
} // namespace AzToolsFramework
|
||||
-66
@@ -1,66 +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 <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <AzToolsFramework/MaterialBrowser/MaterialBrowserComponent.h>
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Thumbnails/FolderThumbnail.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Thumbnails/SourceThumbnail.h>
|
||||
#include <AzToolsFramework/MaterialBrowser/MaterialThumbnail.h>
|
||||
#include <AzToolsFramework/Thumbnails/SourceControlThumbnail.h>
|
||||
|
||||
#include <QApplication>
|
||||
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: 'QBrush::d': class 'QScopedPointer<QBrushData,QBrushDataPointerDeleter>' needs to have dll-interface to be used by clients of class 'QBrush'
|
||||
#include <QStyle>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace MaterialBrowser
|
||||
{
|
||||
MaterialBrowserComponent::MaterialBrowserComponent()
|
||||
{
|
||||
}
|
||||
|
||||
void MaterialBrowserComponent::Activate()
|
||||
{
|
||||
using namespace Thumbnailer;
|
||||
using namespace AssetBrowser;
|
||||
const char* contextName = "MaterialBrowser";
|
||||
int thumbnailSize = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterContext, contextName, thumbnailSize);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(FolderThumbnailCache), contextName);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(SourceThumbnailCache), contextName);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(MaterialThumbnailCache), contextName);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(SourceControlThumbnailCache), contextName);
|
||||
}
|
||||
|
||||
void MaterialBrowserComponent::Deactivate()
|
||||
{
|
||||
}
|
||||
|
||||
void MaterialBrowserComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
{
|
||||
serialize->Class<MaterialBrowserComponent, AZ::Component>();
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialBrowserComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
required.push_back(AZ_CRC("ThumbnailerService", 0x65422b97));
|
||||
}
|
||||
} // namespace MaterialBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
-41
@@ -1,41 +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
|
||||
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace MaterialBrowser
|
||||
{
|
||||
//! MaterialBrowserComponent allows initialization of MaterialBrowser systems, such as thumbnails
|
||||
class MaterialBrowserComponent
|
||||
: public AZ::Component
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(MaterialBrowserComponent, "{121F3F3B-2412-490D-9E3E-C205C677F476}")
|
||||
|
||||
MaterialBrowserComponent();
|
||||
virtual ~MaterialBrowserComponent() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
};
|
||||
} // namespace MaterialBrowser
|
||||
} // namespace AzToolsFramework
|
||||
-66
@@ -1,66 +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 <AzToolsFramework/MaterialBrowser/MaterialThumbnail.h>
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace MaterialBrowser
|
||||
{
|
||||
static constexpr const char* SimpleMaterialIconPath = ":/MaterialBrowser/images/material_04.png";
|
||||
static constexpr const char* MultiMaterialIconPath = ":/MaterialBrowser/images/material_06.png";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// MaterialThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
MaterialThumbnail::MaterialThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
{
|
||||
auto productKey = azrtti_cast<const AzToolsFramework::AssetBrowser::ProductThumbnailKey*>(m_key.data());
|
||||
AZ_Assert(productKey, "Incorrect key type, excpected ProductThumbnailKey");
|
||||
|
||||
bool multiMat = false;
|
||||
MaterialBrowserRequestBus::BroadcastResult(multiMat, &MaterialBrowserRequests::IsMultiMaterial, productKey->GetAssetId());
|
||||
|
||||
QString iconPath = multiMat ? MultiMaterialIconPath : SimpleMaterialIconPath;
|
||||
m_pixmap = QPixmap(iconPath).scaled(m_thumbnailSize, m_thumbnailSize, Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// MaterialThumbnailCache
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
MaterialThumbnailCache::MaterialThumbnailCache()
|
||||
: ThumbnailCache<MaterialThumbnail, MaterialKeyHash, MaterialKeyEqual>() {}
|
||||
|
||||
MaterialThumbnailCache::~MaterialThumbnailCache() = default;
|
||||
|
||||
int MaterialThumbnailCache::GetPriority() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* MaterialThumbnailCache::GetProviderName() const
|
||||
{
|
||||
return ProviderName;
|
||||
}
|
||||
|
||||
bool MaterialThumbnailCache::IsSupportedThumbnail(Thumbnailer::SharedThumbnailKey key) const
|
||||
{
|
||||
return azrtti_istypeof<const AzToolsFramework::AssetBrowser::ProductThumbnailKey*>(key.data());
|
||||
}
|
||||
|
||||
} // namespace MaterialBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
#include "MaterialBrowser/moc_MaterialThumbnail.cpp"
|
||||
@@ -1,86 +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 <AzToolsFramework/Thumbnails/Thumbnail.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Thumbnails/ProductThumbnail.h>
|
||||
#include <AzToolsFramework/MaterialBrowser/MaterialBrowserBus.h>
|
||||
#endif
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace MaterialBrowser
|
||||
{
|
||||
//! Material Browser uses only 2 thumbnails: simple and multimaterial
|
||||
class MaterialThumbnail
|
||||
: public Thumbnailer::Thumbnail
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MaterialThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize);
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
class MaterialKeyHash
|
||||
{
|
||||
public:
|
||||
size_t operator()(const Thumbnailer::SharedThumbnailKey& /*val*/) const
|
||||
{
|
||||
return 0; // there is only 2 thumbnails in this cache
|
||||
}
|
||||
};
|
||||
|
||||
class MaterialKeyEqual
|
||||
{
|
||||
public:
|
||||
bool operator()(const Thumbnailer::SharedThumbnailKey& val1, const Thumbnailer::SharedThumbnailKey& val2) const
|
||||
{
|
||||
auto productThumbnailKey1 = azrtti_cast<const AzToolsFramework::AssetBrowser::ProductThumbnailKey*>(val1.data());
|
||||
auto productThumbnailKey2 = azrtti_cast<const AzToolsFramework::AssetBrowser::ProductThumbnailKey*>(val2.data());
|
||||
if (!productThumbnailKey1 || !productThumbnailKey2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check whether keys point to single or multimaterial asset type
|
||||
bool multiMat1 = false;
|
||||
bool multiMat2 = false;
|
||||
MaterialBrowserRequestBus::BroadcastResult(multiMat1, &MaterialBrowserRequests::IsMultiMaterial, productThumbnailKey1->GetAssetId());
|
||||
MaterialBrowserRequestBus::BroadcastResult(multiMat2, &MaterialBrowserRequests::IsMultiMaterial, productThumbnailKey2->GetAssetId());
|
||||
return multiMat1 == multiMat2;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//! MaterialBrowserEntry thumbnails
|
||||
class MaterialThumbnailCache
|
||||
: public Thumbnailer::ThumbnailCache<MaterialThumbnail, MaterialKeyHash, MaterialKeyEqual>
|
||||
{
|
||||
public:
|
||||
MaterialThumbnailCache();
|
||||
~MaterialThumbnailCache() override;
|
||||
|
||||
int GetPriority() const override;
|
||||
const char* GetProviderName() const override;
|
||||
|
||||
static constexpr const char* ProviderName = "CryMaterial Thumbnails";
|
||||
|
||||
protected:
|
||||
bool IsSupportedThumbnail(Thumbnailer::SharedThumbnailKey key) const override;
|
||||
};
|
||||
} // namespace MaterialBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiInterface.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
|
||||
+6
-20
@@ -21,9 +21,9 @@
|
||||
#include <AzToolsFramework/Prefab/Instance/TemplateInstanceMapperInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
|
||||
#include <AzToolsFramework/Prefab/Template/Template.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -90,17 +90,13 @@ namespace AzToolsFramework
|
||||
|
||||
if (instanceCountToUpdateInBatch > 0)
|
||||
{
|
||||
// Notify Propagation has begun
|
||||
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationBegin);
|
||||
|
||||
EntityIdList selectedEntityIds;
|
||||
ToolsApplicationRequestBus::BroadcastResult(selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, EntityIdList());
|
||||
|
||||
// Disable the Outliner to avoid showing the propagation steps
|
||||
EntityOutlinerWidgetInterface* entityOutlinerWidgetInterface = AZ::Interface<EntityOutlinerWidgetInterface>::Get();
|
||||
if (entityOutlinerWidgetInterface)
|
||||
{
|
||||
entityOutlinerWidgetInterface->SetUpdatesEnabled(false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < instanceCountToUpdateInBatch; ++i)
|
||||
{
|
||||
Instance* instanceToUpdate = m_instancesUpdateQueue.front();
|
||||
@@ -168,18 +164,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, selectedEntityIds);
|
||||
|
||||
// Enable the Outliner
|
||||
if (entityOutlinerWidgetInterface)
|
||||
{
|
||||
entityOutlinerWidgetInterface->SetUpdatesEnabled(true);
|
||||
|
||||
auto prefabPublicInterface = AZ::Interface<PrefabPublicInterface>::Get();
|
||||
if (prefabPublicInterface)
|
||||
{
|
||||
AZ::EntityId rootEntityId = prefabPublicInterface->GetLevelInstanceContainerEntityId();
|
||||
entityOutlinerWidgetInterface->ExpandEntityChildren(rootEntityId);
|
||||
}
|
||||
}
|
||||
// Notify Propagation has ended
|
||||
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationEnd);
|
||||
}
|
||||
|
||||
m_updatingTemplateInstancesInQueue = false;
|
||||
|
||||
@@ -108,11 +108,9 @@ namespace AzToolsFramework
|
||||
m_targetTemplateId = id;
|
||||
}
|
||||
|
||||
void Link::SetTemplatePatches(const PrefabDomValue& patches)
|
||||
void Link::SetLinkDom(const PrefabDomValue& linkDom)
|
||||
{
|
||||
PrefabDom newPatches;
|
||||
newPatches.CopyFrom(patches, newPatches.GetAllocator());
|
||||
m_linkDom.Swap(newPatches);
|
||||
m_linkDom.CopyFrom(linkDom, m_linkDom.GetAllocator());
|
||||
}
|
||||
|
||||
void Link::SetInstanceName(const char* instanceName)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace AzToolsFramework
|
||||
|
||||
void SetSourceTemplateId(TemplateId id);
|
||||
void SetTargetTemplateId(TemplateId id);
|
||||
void SetTemplatePatches(const PrefabDomValue& patches);
|
||||
void SetLinkDom(const PrefabDomValue& linkDom);
|
||||
void SetInstanceName(const char* instanceName);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
class PrefabPublicNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
virtual ~PrefabPublicNotifications() = default;
|
||||
|
||||
virtual void OnPrefabInstancePropagationBegin() {}
|
||||
virtual void OnPrefabInstancePropagationEnd() {}
|
||||
};
|
||||
|
||||
using PrefabPublicNotificationBus = AZ::EBus<PrefabPublicNotifications>;
|
||||
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
@@ -770,8 +770,8 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
Template& sourceTemplate = sourceTemplateReference->get();
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
Template& sourceTemplate = sourceTemplateReference->get();
|
||||
Template& targetTemplate = targetTemplateReference->get();
|
||||
#endif
|
||||
|
||||
@@ -782,22 +782,21 @@ namespace AzToolsFramework
|
||||
link.SetInstanceName(instanceName.data());
|
||||
|
||||
PrefabDomValue& instance = instanceIterator->value;
|
||||
AZ_Assert(instance.IsObject(), "Nested instance DOM provided is not a valid JSON object.");
|
||||
PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName);
|
||||
AZ_Assert(sourceTemplateName, "Couldn't find source template name in the DOM of the nested instance while creating a link.");
|
||||
AZ_Assert(
|
||||
sourceTemplateName->get() == sourceTemplate.GetFilePath().c_str(),
|
||||
"The name of the source template in the nested instance DOM does not match the name of the source template already loaded");
|
||||
|
||||
PrefabDomValueReference patchesReference = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::PatchesName);
|
||||
if (!patchesReference.has_value())
|
||||
if (patchesReference.has_value())
|
||||
{
|
||||
PrefabDom& newLinkDom = link.GetLinkDom();
|
||||
|
||||
newLinkDom.SetObject();
|
||||
|
||||
newLinkDom.AddMember(rapidjson::StringRef(PrefabDomUtils::SourceName),
|
||||
rapidjson::StringRef(sourceTemplate.GetFilePath().c_str()), newLinkDom.GetAllocator());
|
||||
}
|
||||
else
|
||||
{
|
||||
link.SetTemplatePatches(patchesReference->get());
|
||||
AZ_Assert(patchesReference->get().IsArray(), "Patches in the nested instance DOM are not represented as an array.");
|
||||
}
|
||||
|
||||
link.SetLinkDom(instance);
|
||||
|
||||
if (!link.UpdateTarget())
|
||||
{
|
||||
AZ_Error("Prefab", false,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzToolsFramework/Thumbnails/LoadingThumbnail.h>
|
||||
#include <AzFramework/Application/Application.h>
|
||||
|
||||
@@ -18,23 +18,21 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
static constexpr const int LoadingThumbnailSize = 128;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// LoadingThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const char* LoadingIconPath = "Editor/Icons/AssetBrowser/in_progress.gif";
|
||||
static constexpr const char* LoadingIconPath = "Assets/Editor/Icons/AssetBrowser/in_progress.gif";
|
||||
|
||||
LoadingThumbnail::LoadingThumbnail(int thumbnailSize)
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey), thumbnailSize)
|
||||
LoadingThumbnail::LoadingThumbnail()
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey))
|
||||
, m_angle(0)
|
||||
{
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
AZ_Assert(engineRoot, "Engine Root not initialized");
|
||||
AZStd::string iconPath;
|
||||
AZ::StringFunc::Path::Join(engineRoot, LoadingIconPath, iconPath);
|
||||
m_loadingMovie.setFileName(iconPath.c_str());
|
||||
auto absoluteIconPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / LoadingIconPath;
|
||||
m_loadingMovie.setFileName(absoluteIconPath.c_str());
|
||||
m_loadingMovie.setCacheMode(QMovie::CacheMode::CacheAll);
|
||||
m_loadingMovie.setScaledSize(QSize(m_thumbnailSize, m_thumbnailSize));
|
||||
m_loadingMovie.setScaledSize(QSize(LoadingThumbnailSize, LoadingThumbnailSize));
|
||||
m_loadingMovie.start();
|
||||
m_pixmap = m_loadingMovie.currentPixmap();
|
||||
m_state = State::Ready;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LoadingThumbnail(int thumbnailSize);
|
||||
LoadingThumbnail();
|
||||
~LoadingThumbnail() override;
|
||||
|
||||
void UpdateTime(float /*deltaTime*/) override;
|
||||
|
||||
@@ -10,19 +10,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzToolsFramework/Thumbnails/MissingThumbnail.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
static const char* MISSING_ICON_PATH = "Editor/Icons/AssetBrowser/Default_16.svg";
|
||||
static constexpr const char* MissingIconPath = "Assets/Editor/Icons/AssetBrowser/Default_16.svg";
|
||||
|
||||
MissingThumbnail::MissingThumbnail(int thumbnailSize)
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey), thumbnailSize)
|
||||
MissingThumbnail::MissingThumbnail()
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey))
|
||||
{
|
||||
m_icon = QIcon(MISSING_ICON_PATH);
|
||||
m_state = State::Ready;
|
||||
auto absoluteIconPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / MissingIconPath;
|
||||
m_pixmap.load(absoluteIconPath.c_str());
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
} // namespace Thumbnailer
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MissingThumbnail(int thumbnailSize);
|
||||
MissingThumbnail();
|
||||
};
|
||||
} // namespace Thumbnailer
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
+7
-7
@@ -64,13 +64,13 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SourceControlThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const char* WRITABLE_ICON_PATH = "Editor/Icons/AssetBrowser/Writable_16.svg";
|
||||
static const char* NONWRITABLE_ICON_PATH = "Editor/Icons/AssetBrowser/NonWritable_16.svg";
|
||||
static const char* WRITABLE_ICON_PATH = "Icons/AssetBrowser/Writable_16.svg";
|
||||
static const char* NONWRITABLE_ICON_PATH = "Icons/AssetBrowser/NonWritable_16.svg";
|
||||
|
||||
bool SourceControlThumbnail::m_readyForUpdate = true;
|
||||
|
||||
SourceControlThumbnail::SourceControlThumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
SourceControlThumbnail::SourceControlThumbnail(SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
@@ -122,16 +122,16 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (fileInfo.HasFlag(AzToolsFramework::SCF_Writeable))
|
||||
{
|
||||
m_icon = QIcon(m_writableIconPath.c_str());
|
||||
m_pixmap.load(m_writableIconPath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_icon = QIcon(m_nonWritableIconPath.c_str());
|
||||
m_pixmap.load(m_nonWritableIconPath.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_icon = QIcon();
|
||||
m_pixmap = QPixmap();
|
||||
}
|
||||
m_readyForUpdate = true;
|
||||
emit Updated();
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourceControlThumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
SourceControlThumbnail(SharedThumbnailKey key);
|
||||
~SourceControlThumbnail() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
static const int DefaultIconSize = 16;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ThumbnailKey
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -54,10 +52,9 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Thumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Thumbnail::Thumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
Thumbnail::Thumbnail(SharedThumbnailKey key)
|
||||
: QObject()
|
||||
, m_state(State::Unloaded)
|
||||
, m_thumbnailSize(thumbnailSize)
|
||||
, m_key(key)
|
||||
{
|
||||
connect(&m_watcher, &QFutureWatcher<void>::finished, this, [this]()
|
||||
@@ -91,19 +88,9 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap Thumbnail::GetPixmap() const
|
||||
const QPixmap& Thumbnail::GetPixmap() const
|
||||
{
|
||||
return GetPixmap(QSize(DefaultIconSize, DefaultIconSize));
|
||||
}
|
||||
|
||||
QPixmap Thumbnail::GetPixmap(const QSize& size) const
|
||||
{
|
||||
if (m_icon.isNull())
|
||||
{
|
||||
return m_pixmap;
|
||||
}
|
||||
|
||||
return m_icon.pixmap(size);
|
||||
return m_pixmap;
|
||||
}
|
||||
|
||||
SharedThumbnailKey Thumbnail::GetKey() const
|
||||
|
||||
@@ -19,7 +19,6 @@ AZ_PUSH_DISABLE_WARNING(4127 4251 4800, "-Wunknown-warning-option") // 4127: con
|
||||
// 4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
#include <QFutureWatcher>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
#endif
|
||||
@@ -86,12 +85,11 @@ namespace AzToolsFramework
|
||||
Failed
|
||||
};
|
||||
|
||||
Thumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
Thumbnail(SharedThumbnailKey key);
|
||||
~Thumbnail() override;
|
||||
bool operator == (const Thumbnail& other) const;
|
||||
void Load();
|
||||
virtual QPixmap GetPixmap() const;
|
||||
virtual QPixmap GetPixmap(const QSize& size) const;
|
||||
const QPixmap& GetPixmap() const;
|
||||
virtual void UpdateTime(float /*deltaTime*/) {}
|
||||
SharedThumbnailKey GetKey() const;
|
||||
State GetState() const;
|
||||
@@ -105,10 +103,8 @@ namespace AzToolsFramework
|
||||
protected:
|
||||
QFutureWatcher<void> m_watcher;
|
||||
State m_state;
|
||||
int m_thumbnailSize;
|
||||
SharedThumbnailKey m_key;
|
||||
QPixmap m_pixmap;
|
||||
QIcon m_icon;
|
||||
|
||||
virtual void LoadThread() {}
|
||||
};
|
||||
@@ -122,7 +118,6 @@ namespace AzToolsFramework
|
||||
ThumbnailProvider() = default;
|
||||
virtual ~ThumbnailProvider() = default;
|
||||
virtual bool GetThumbnail(SharedThumbnailKey key, SharedThumbnail& thumbnail) = 0;
|
||||
virtual void SetThumbnailSize(int thumbnailSize) = 0;
|
||||
//! Priority identifies ThumbnailProvider order in ThumbnailContext
|
||||
//! Higher priority means this ThumbnailProvider will take precedence in generating a thumbnail when
|
||||
//! a supplied ThumbnailKey is supported by multiple providers.
|
||||
@@ -185,10 +180,7 @@ namespace AzToolsFramework
|
||||
|
||||
bool GetThumbnail(SharedThumbnailKey key, SharedThumbnail& thumbnail) override;
|
||||
|
||||
void SetThumbnailSize(int thumbnailSize) override;
|
||||
|
||||
protected:
|
||||
int m_thumbnailSize;
|
||||
AZStd::unordered_map<SharedThumbnailKey, SharedThumbnail, Hasher, EqualKey> m_cache;
|
||||
|
||||
//! Check if thumbnail key is handled by this provider, overload in derived class
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace AzToolsFramework
|
||||
{
|
||||
template <class ThumbnailType, class Hasher, class EqualKey>
|
||||
ThumbnailCache<ThumbnailType, Hasher, EqualKey>::ThumbnailCache()
|
||||
: m_thumbnailSize(0)
|
||||
{
|
||||
BusConnect();
|
||||
}
|
||||
@@ -49,17 +48,11 @@ namespace AzToolsFramework
|
||||
}
|
||||
if (IsSupportedThumbnail(key))
|
||||
{
|
||||
thumbnail = QSharedPointer<ThumbnailType>(new ThumbnailType(key, m_thumbnailSize));
|
||||
thumbnail = QSharedPointer<ThumbnailType>(new ThumbnailType(key));
|
||||
m_cache[key] = thumbnail;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class ThumbnailType, class Hasher, class EqualKey>
|
||||
void ThumbnailCache<ThumbnailType, Hasher, EqualKey>::SetThumbnailSize(int thumbnailSize)
|
||||
{
|
||||
m_thumbnailSize = thumbnailSize;
|
||||
}
|
||||
} // namespace Thumbnailer
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -24,10 +24,9 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
ThumbnailContext::ThumbnailContext(int thumbnailSize)
|
||||
: m_missingThumbnail(new MissingThumbnail(thumbnailSize))
|
||||
, m_loadingThumbnail(new LoadingThumbnail(thumbnailSize))
|
||||
, m_thumbnailSize(thumbnailSize)
|
||||
ThumbnailContext::ThumbnailContext()
|
||||
: m_missingThumbnail(new MissingThumbnail())
|
||||
, m_loadingThumbnail(new LoadingThumbnail())
|
||||
, m_threadPool(this)
|
||||
{
|
||||
ThumbnailContextRequestBus::Handler::BusConnect();
|
||||
@@ -120,7 +119,6 @@ namespace AzToolsFramework
|
||||
return;
|
||||
}
|
||||
|
||||
providerToAdd->SetThumbnailSize(m_thumbnailSize);
|
||||
m_providers.insert(providerToAdd);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ThumbnailContext, AZ::SystemAllocator, 0)
|
||||
AZ_CLASS_ALLOCATOR(ThumbnailContext, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit ThumbnailContext(int thumbnailSize);
|
||||
ThumbnailContext();
|
||||
~ThumbnailContext() override;
|
||||
|
||||
//! Is the thumbnail currently loading or is about to load.
|
||||
@@ -82,8 +82,6 @@ namespace AzToolsFramework
|
||||
SharedThumbnail m_missingThumbnail;
|
||||
//! Default loading thumbnail used when thumbnail is found by is not yet generated
|
||||
SharedThumbnail m_loadingThumbnail;
|
||||
//! Thumbnail size (width and height in pixels)
|
||||
int m_thumbnailSize;
|
||||
//! There is only a limited number of threads on global threadPool, because there can be many thumbnails rendering at once
|
||||
//! an individual threadPool is needed to avoid deadlocks
|
||||
QThreadPool m_threadPool;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
public:
|
||||
//! Add thumbnail context
|
||||
virtual void RegisterContext(const char* contextName, int thumbnailSize) = 0;
|
||||
virtual void RegisterContext(const char* contextName) = 0;
|
||||
|
||||
//! Remove thumbnail context and all associated ThumbnailProviders
|
||||
virtual void UnregisterContext(const char* contextName) = 0;
|
||||
|
||||
+3
-4
@@ -32,8 +32,7 @@ namespace AzToolsFramework
|
||||
|
||||
void ThumbnailerComponent::Activate()
|
||||
{
|
||||
int thumbnailSize = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
RegisterContext(ThumbnailContext::DefaultContext, thumbnailSize);
|
||||
RegisterContext(ThumbnailContext::DefaultContext);
|
||||
BusConnect();
|
||||
}
|
||||
|
||||
@@ -62,10 +61,10 @@ namespace AzToolsFramework
|
||||
provided.push_back(AZ_CRC("ThumbnailerService", 0x65422b97));
|
||||
}
|
||||
|
||||
void ThumbnailerComponent::RegisterContext(const char* contextName, int thumbnailSize)
|
||||
void ThumbnailerComponent::RegisterContext(const char* contextName)
|
||||
{
|
||||
AZ_Assert(m_thumbnails.find(contextName) == m_thumbnails.end(), "Context %s already registered", contextName);
|
||||
m_thumbnails[contextName] = AZStd::make_shared<ThumbnailContext>(thumbnailSize);
|
||||
m_thumbnails[contextName] = AZStd::make_shared<ThumbnailContext>();
|
||||
}
|
||||
|
||||
void ThumbnailerComponent::UnregisterContext(const char* contextName)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ThumbnailerRequests
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RegisterContext(const char* contextName, int thumbnailSize) override;
|
||||
void RegisterContext(const char* contextName) override;
|
||||
void UnregisterContext(const char* contextName) override;
|
||||
bool HasContext(const char* contextName) const override;
|
||||
void RegisterThumbnailProvider(SharedThumbnailProvider provider, const char* contextName) override;
|
||||
|
||||
+33
-8
@@ -16,7 +16,7 @@
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
#include <AzFramework/Scene/Scene.h>
|
||||
#include <AzFramework/Scene/SceneSystemBus.h>
|
||||
#include <AzFramework/Scene/SceneSystemInterface.h>
|
||||
|
||||
#include <AzToolsFramework/Editor/EditorSettingsAPIBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextComponent.h>
|
||||
@@ -56,22 +56,47 @@ namespace AzToolsFramework
|
||||
|
||||
void AzToolsFrameworkConfigurationSystemComponent::Activate()
|
||||
{
|
||||
// Associate the EditorEntityContext with the default scene.
|
||||
// Create the editor specific child scene to the main scene and add the editor entity context to it.
|
||||
AzFramework::EntityContextId editorEntityContextId;
|
||||
EditorEntityContextRequestBus::BroadcastResult(editorEntityContextId, &EditorEntityContextRequests::GetEditorEntityContextId);
|
||||
|
||||
AzFramework::Scene* defaultScene = nullptr;
|
||||
AzFramework::SceneSystemRequestBus::BroadcastResult(defaultScene, &AzFramework::SceneSystemRequests::GetScene, "default");
|
||||
|
||||
if (!editorEntityContextId.IsNull() && defaultScene)
|
||||
if (!editorEntityContextId.IsNull())
|
||||
{
|
||||
bool success = false;
|
||||
AzFramework::SceneSystemRequestBus::BroadcastResult(success, &AzFramework::SceneSystemRequests::SetSceneForEntityContextId, editorEntityContextId, defaultScene);
|
||||
auto sceneSystem = AzFramework::SceneSystemInterface::Get();
|
||||
AZ_Assert(sceneSystem, "Scene system not available to create the editor scene.");
|
||||
AZStd::shared_ptr<AzFramework::Scene> mainScene = sceneSystem->GetScene(AzFramework::Scene::MainSceneName);
|
||||
if (mainScene)
|
||||
{
|
||||
AZ::Outcome<AZStd::shared_ptr<AzFramework::Scene>, AZStd::string> editorScene =
|
||||
sceneSystem->CreateSceneWithParent(AzFramework::Scene::EditorMainSceneName, mainScene);
|
||||
if (editorScene.IsSuccess())
|
||||
{
|
||||
AzFramework::EntityContext* editorEntityContext = nullptr;
|
||||
EditorEntityContextRequestBus::BroadcastResult(
|
||||
editorEntityContext, &EditorEntityContextRequests::GetEditorEntityContextInstance);
|
||||
if (editorEntityContext != nullptr)
|
||||
{
|
||||
[[maybe_unused]] bool contextAdded =
|
||||
editorScene.GetValue()->SetSubsystem<AzFramework::EntityContext::SceneStorageType&>(editorEntityContext);
|
||||
AZ_Assert(contextAdded, "Unable to add editor entity context to scene.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Assert(false, "Failed to create editor scene because: %s", editorScene.GetError().c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Assert(false, "No main scene to parent the editor scene under.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AzToolsFrameworkConfigurationSystemComponent::Deactivate()
|
||||
{
|
||||
[[maybe_unused]] bool success = AzFramework::SceneSystemInterface::Get()->RemoveScene(AzFramework::Scene::EditorMainSceneName);
|
||||
AZ_Assert(success, "Unable to remove the main editor scene.");
|
||||
}
|
||||
|
||||
void AzToolsFrameworkConfigurationSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
|
||||
+2
-2
@@ -101,8 +101,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
editContext->Class<EditorLayerComponent>("Layer", "The layer component allows entities to be saved to different files on disk.")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Layers.svg")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Layers.svg")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Layers.svg")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Layers.svg")
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Layer", 0xe4db211a))
|
||||
->Attribute(AZ::Edit::Attributes::AddableByUser, false)
|
||||
->Attribute(AZ::Edit::Attributes::RemoveableByUser, false)
|
||||
|
||||
+2
-2
@@ -1025,9 +1025,9 @@ namespace AzToolsFramework
|
||||
->Attribute(AZ::Edit::Attributes::NameLabelOverride, &ScriptEditorComponent::m_customName)
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Scripting")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/LuaScript.svg")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/LuaScript.svg")
|
||||
->Attribute(AZ::Edit::Attributes::PrimaryAssetType, AZ::AzTypeInfo<AZ::ScriptAsset>::Uuid())
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Script.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Script.png")
|
||||
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://docs.aws.amazon.com/lumberyard/latest/userguide/component-lua-script.html")
|
||||
->DataElement("AssetRef", &ScriptEditorComponent::m_scriptAsset, "Script", "Which script to use")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &ScriptEditorComponent::ScriptHasChanged)
|
||||
|
||||
+2
-2
@@ -1227,8 +1227,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
ptrEdit->Class<TransformComponent>("Transform", "Controls the placement of the entity in the world in 3d")->
|
||||
ClassElement(AZ::Edit::ClassElements::EditorData, "")->
|
||||
Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Transform.svg")->
|
||||
Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Transform.png")->
|
||||
Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Transform.svg")->
|
||||
Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Transform.png")->
|
||||
Attribute(AZ::Edit::Attributes::AutoExpand, true)->
|
||||
DataElement(AZ::Edit::UIHandlers::Default, &TransformComponent::m_parentEntityId, "Parent entity", "")->
|
||||
Attribute(AZ::Edit::Attributes::ChangeValidate, &TransformComponent::ValidatePotentialParent)->
|
||||
|
||||
+10
-17
@@ -286,12 +286,12 @@ namespace AzToolsFramework
|
||||
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
|
||||
GetEntityContextId());
|
||||
EditorEntityInfoNotificationBus::Handler::BusConnect();
|
||||
AZ::Interface<EntityOutlinerWidgetInterface>::Register(this);
|
||||
Prefab::PrefabPublicNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
EntityOutlinerWidget::~EntityOutlinerWidget()
|
||||
{
|
||||
AZ::Interface<EntityOutlinerWidgetInterface>::Unregister(this);
|
||||
Prefab::PrefabPublicNotificationBus::Handler::BusDisconnect();
|
||||
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
|
||||
EditorEntityInfoNotificationBus::Handler::BusDisconnect();
|
||||
EditorPickModeNotificationBus::Handler::BusDisconnect();
|
||||
@@ -1109,25 +1109,18 @@ namespace AzToolsFramework
|
||||
setEnabled(true);
|
||||
SetEntityOutlinerState(m_gui, true);
|
||||
}
|
||||
|
||||
void EntityOutlinerWidget::SetUpdatesEnabled(bool enable)
|
||||
|
||||
void EntityOutlinerWidget::OnPrefabInstancePropagationBegin()
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
QTimer::singleShot(1, this, [this]() {
|
||||
m_gui->m_objectTree->setUpdatesEnabled(true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gui->m_objectTree->setUpdatesEnabled(false);
|
||||
}
|
||||
m_gui->m_objectTree->setUpdatesEnabled(false);
|
||||
}
|
||||
|
||||
void EntityOutlinerWidget::ExpandEntityChildren(AZ::EntityId entityId)
|
||||
void EntityOutlinerWidget::OnPrefabInstancePropagationEnd()
|
||||
{
|
||||
QModelIndex index = GetIndexFromEntityId(entityId);
|
||||
m_gui->m_objectTree->expand(index);
|
||||
QTimer::singleShot(1, this, [this]() {
|
||||
m_gui->m_objectTree->setUpdatesEnabled(true);
|
||||
m_gui->m_objectTree->expand(m_proxyModel->index(0,0));
|
||||
});
|
||||
}
|
||||
|
||||
void EntityOutlinerWidget::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId /*parentId*/, AZ::EntityId childId)
|
||||
|
||||
+5
-5
@@ -20,10 +20,10 @@
|
||||
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
|
||||
#include <AzToolsFramework/ToolsMessaging/EntityHighlightBus.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerCacheBus.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerSearchWidget.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
|
||||
#include <AzToolsFramework/UI/SearchWidget/SearchWidgetTypes.hxx>
|
||||
|
||||
#include <QIcon>
|
||||
@@ -62,7 +62,7 @@ namespace AzToolsFramework
|
||||
, private EditorEntityContextNotificationBus::Handler
|
||||
, private EditorEntityInfoNotificationBus::Handler
|
||||
, private ComponentModeFramework::EditorComponentModeNotificationBus::Handler
|
||||
, private EntityOutlinerWidgetInterface
|
||||
, private Prefab::PrefabPublicNotificationBus::Handler
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
@@ -106,9 +106,9 @@ namespace AzToolsFramework
|
||||
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
|
||||
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
|
||||
|
||||
// EntityOutlinerWidgetInterface
|
||||
void SetUpdatesEnabled(bool enable) override;
|
||||
void ExpandEntityChildren(AZ::EntityId entityId) override;
|
||||
// PrefabPublicNotificationBus
|
||||
void OnPrefabInstancePropagationBegin() override;
|
||||
void OnPrefabInstancePropagationEnd() override;
|
||||
|
||||
// Build a selection object from the given entities. Entities already in the Widget's selection buffers are ignored.
|
||||
template <class EntityIdCollection>
|
||||
|
||||
-30
@@ -1,30 +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
|
||||
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
class EntityOutlinerWidgetInterface
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EntityOutlinerWidgetInterface, "{30C0F252-EC84-4196-BF59-EB9E73B8ADCB}");
|
||||
|
||||
virtual void SetUpdatesEnabled(bool enable) = 0;
|
||||
virtual void ExpandEntityChildren(AZ::EntityId entityId) = 0;
|
||||
};
|
||||
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
+28
-3
@@ -544,7 +544,7 @@ namespace AzToolsFramework
|
||||
m_errorButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_errorButton->setFixedSize(QSize(16, 16));
|
||||
m_errorButton->setMouseTracking(true);
|
||||
m_errorButton->setIcon(QIcon("Editor/Icons/PropertyEditor/error_icon.png"));
|
||||
m_errorButton->setIcon(QIcon("Icons/PropertyEditor/error_icon.png"));
|
||||
m_errorButton->setToolTip("Show Errors");
|
||||
|
||||
// Insert the error button after the asset label
|
||||
@@ -680,6 +680,13 @@ namespace AzToolsFramework
|
||||
AzQtComponents::BrowseEdit::removeDropTargetStyle(m_browseEdit);
|
||||
}
|
||||
|
||||
AssetSelectionModel PropertyAssetCtrl::GetAssetSelectionModel()
|
||||
{
|
||||
auto selectionModel = AssetSelectionModel::AssetTypeSelection(GetCurrentAssetType());
|
||||
selectionModel.SetTitle(m_title);
|
||||
return selectionModel;
|
||||
}
|
||||
|
||||
void PropertyAssetCtrl::UpdateTabOrder()
|
||||
{
|
||||
setTabOrder(m_browseEdit, m_editButton);
|
||||
@@ -1058,6 +1065,11 @@ namespace AzToolsFramework
|
||||
m_editButton->setIcon(icon);
|
||||
}
|
||||
|
||||
void PropertyAssetCtrl::SetTitle(const QString& title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
void PropertyAssetCtrl::SetEditNotifyTarget(void* editNotifyTarget)
|
||||
{
|
||||
m_editNotifyTarget = editNotifyTarget;
|
||||
@@ -1193,7 +1205,16 @@ namespace AzToolsFramework
|
||||
{
|
||||
(void)debugName;
|
||||
|
||||
if (attrib == AZ_CRC("EditCallback", 0xb74f2ee1))
|
||||
if (attrib == AZ_CRC_CE("AssetPickerTitle"))
|
||||
{
|
||||
AZStd::string title;
|
||||
attrValue->Read<AZStd::string>(title);
|
||||
if (!title.empty())
|
||||
{
|
||||
GUI->SetTitle(title.c_str());
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ_CRC("EditCallback", 0xb74f2ee1))
|
||||
{
|
||||
PropertyAssetCtrl::EditCallbackType* func = azdynamic_cast<PropertyAssetCtrl::EditCallbackType*>(attrValue->GetAttribute());
|
||||
if (func)
|
||||
@@ -1283,7 +1304,11 @@ namespace AzToolsFramework
|
||||
}
|
||||
else if (attrib == AZ_CRC_CE("Thumbnail"))
|
||||
{
|
||||
GUI->SetShowThumbnail(true);
|
||||
bool showThumbnail = false;
|
||||
if (attrValue->Read<bool>(showThumbnail))
|
||||
{
|
||||
GUI->SetShowThumbnail(showThumbnail);
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ_CRC_CE("ThumbnailCallback"))
|
||||
{
|
||||
|
||||
+3
-1
@@ -89,12 +89,13 @@ namespace AzToolsFramework
|
||||
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
|
||||
virtual AssetSelectionModel GetAssetSelectionModel() { return AssetSelectionModel::AssetTypeSelection(GetCurrentAssetType()); }
|
||||
virtual AssetSelectionModel GetAssetSelectionModel();
|
||||
|
||||
signals:
|
||||
void OnAssetIDChanged(AZ::Data::AssetId newAssetID);
|
||||
|
||||
protected:
|
||||
QString m_title;
|
||||
ThumbnailPropertyCtrl* m_thumbnail = nullptr;
|
||||
QPushButton* m_errorButton = nullptr;
|
||||
QToolButton* m_editButton = nullptr;
|
||||
@@ -191,6 +192,7 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public slots:
|
||||
void SetTitle(const QString& title);
|
||||
void SetEditNotifyTarget(void* editNotifyTarget);
|
||||
void SetEditNotifyCallback(EditCallbackType* editNotifyCallback); // This is meant to be used with the "EditCallback" Attribute
|
||||
void SetClearNotifyCallback(ClearCallbackType* clearNotifyCallback); // This is meant to be used with the "ClearNotify" Attribute
|
||||
|
||||
+10
-16
@@ -121,17 +121,14 @@ namespace AzToolsFramework
|
||||
EditorPickModeRequestBus::Handler::BusConnect(pickModeEntityContextId);
|
||||
EditorEventsBus::Handler::BusConnect();
|
||||
|
||||
if (IsNewViewportInteractionModelEnabled())
|
||||
// replace the default input handler with one specific for dealing with
|
||||
// entity selection in the viewport
|
||||
EditorInteractionSystemViewportSelectionRequestBus::Event(
|
||||
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetHandler,
|
||||
[](const EditorVisibleEntityDataCache* entityDataCache)
|
||||
{
|
||||
// replace the default input handler with one specific for dealing with
|
||||
// entity selection in the viewport
|
||||
EditorInteractionSystemViewportSelectionRequestBus::Event(
|
||||
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetHandler,
|
||||
[](const EditorVisibleEntityDataCache* entityDataCache)
|
||||
{
|
||||
return AZStd::make_unique<EditorPickEntitySelection>(entityDataCache);
|
||||
});
|
||||
}
|
||||
return AZStd::make_unique<EditorPickEntitySelection>(entityDataCache);
|
||||
});
|
||||
|
||||
if (!pickModeEntityContextId.IsNull())
|
||||
{
|
||||
@@ -162,12 +159,9 @@ namespace AzToolsFramework
|
||||
EditorEventsBus::Handler::BusDisconnect();
|
||||
emit OnPickComplete();
|
||||
|
||||
if (IsNewViewportInteractionModelEnabled())
|
||||
{
|
||||
// return to the default viewport editor selection
|
||||
EditorInteractionSystemViewportSelectionRequestBus::Event(
|
||||
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetDefaultHandler);
|
||||
}
|
||||
// return to the default viewport editor selection
|
||||
EditorInteractionSystemViewportSelectionRequestBus::Event(
|
||||
GetEntityContextId(), &EditorInteractionSystemViewportSelection::SetDefaultHandler);
|
||||
|
||||
EditorPickModeNotificationBus::Broadcast(&EditorPickModeNotifications::OnEntityPickModeStopped);
|
||||
}
|
||||
|
||||
+1
@@ -114,6 +114,7 @@ namespace AzToolsFramework
|
||||
m_thumbnailEnlarged->move(position);
|
||||
m_thumbnailEnlarged->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||
m_thumbnailEnlarged->SetThumbnailKey(m_key);
|
||||
m_thumbnailEnlarged->raise();
|
||||
m_thumbnailEnlarged->show();
|
||||
}
|
||||
QWidget::enterEvent(e);
|
||||
|
||||
+5
-5
@@ -70,7 +70,7 @@ namespace AzToolsFramework
|
||||
m_tagLabel->setMinimumSize(24, 22);
|
||||
m_tagLabel->setAttribute(Qt::WA_TransparentForMouseEvents, true);
|
||||
|
||||
QIcon closeIcon("Editor/Icons/animation/close.png");
|
||||
QIcon closeIcon("Icons/animation/close.png");
|
||||
|
||||
QPushButton* button = new QPushButton(this);
|
||||
button->setStyleSheet(button->styleSheet() + "border: 0px;");
|
||||
@@ -233,14 +233,14 @@ namespace AzToolsFramework
|
||||
QPushButton* loadButton = new QPushButton(this);
|
||||
loadButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
loadButton->setFixedSize(QSize(24, 24));
|
||||
loadButton->setIcon(QIcon("Editor/UI/Icons/toolbar/libraryLoad.png"));
|
||||
loadButton->setIcon(QIcon("UI/Icons/toolbar/libraryLoad.png"));
|
||||
loadButton->setToolTip(tr("Load a saved filter"));
|
||||
loadButton->setProperty("iconButton", "true");
|
||||
|
||||
m_saveButton = new QPushButton(this);
|
||||
m_saveButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_saveButton->setFixedSize(QSize(24, 24));
|
||||
m_saveButton->setIcon(QIcon("Editor/UI/Icons/toolbar/librarySave.png"));
|
||||
m_saveButton->setIcon(QIcon("UI/Icons/toolbar/librarySave.png"));
|
||||
m_saveButton->setToolTip(tr("Save the current filter"));
|
||||
m_saveButton->setEnabled(false);
|
||||
m_saveButton->setProperty("iconButton", "true");
|
||||
@@ -248,7 +248,7 @@ namespace AzToolsFramework
|
||||
m_toggleAllFiltersButton = new QPushButton(this);
|
||||
m_toggleAllFiltersButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_toggleAllFiltersButton->setFixedSize(QSize(24, 24));
|
||||
m_toggleAllFiltersButton->setIcon(QIcon("Editor/Icons/animation/filter_16.png"));
|
||||
m_toggleAllFiltersButton->setIcon(QIcon("Icons/animation/filter_16.png"));
|
||||
m_toggleAllFiltersButton->setVisible(false);
|
||||
m_toggleAllFiltersButton->setToolTip(tr("Toggle all filters on/off"));
|
||||
m_toggleAllFiltersButton->setProperty("iconButton", "true");
|
||||
@@ -267,7 +267,7 @@ namespace AzToolsFramework
|
||||
m_clearAllButton = new QPushButton(this);
|
||||
m_clearAllButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_clearAllButton->setFixedSize(QSize(24, 24));
|
||||
m_clearAllButton->setIcon(QIcon("Editor/Icons/animation/close.png"));
|
||||
m_clearAllButton->setIcon(QIcon("Icons/animation/close.png"));
|
||||
m_clearAllButton->setVisible(false);
|
||||
m_clearAllButton->setToolTip(tr("Clear all filters"));
|
||||
m_clearAllButton->setProperty("iconButton", "true");
|
||||
|
||||
-12
@@ -126,7 +126,6 @@ namespace UnitTest
|
||||
/// Base fixture for ToolsApplication editor tests.
|
||||
class ToolsApplicationFixture
|
||||
: public AllocatorsTestFixture
|
||||
, private AzToolsFramework::NewViewportInteractionModelEnabledRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
void SetUp() override final
|
||||
@@ -148,8 +147,6 @@ namespace UnitTest
|
||||
// in the unit tests.
|
||||
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
|
||||
|
||||
AzToolsFramework::NewViewportInteractionModelEnabledRequestBus::Handler::BusConnect();
|
||||
|
||||
m_editorActions.Connect();
|
||||
|
||||
const auto viewportHandlerBuilder =
|
||||
@@ -184,7 +181,6 @@ namespace UnitTest
|
||||
|
||||
TearDownEditorFixtureImpl();
|
||||
m_editorActions.Disconnect();
|
||||
AzToolsFramework::NewViewportInteractionModelEnabledRequestBus::Handler::BusDisconnect();
|
||||
|
||||
// Stop & delete the Application created by this fixture, hence not using GetApplication() here
|
||||
if (m_app)
|
||||
@@ -222,14 +218,6 @@ namespace UnitTest
|
||||
|
||||
private:
|
||||
AZStd::unique_ptr<ToolsTestApplication> m_app;
|
||||
|
||||
// NewViewportInteractionModelEnabledRequestBus ...
|
||||
bool IsNewViewportInteractionModelEnabled() override
|
||||
{
|
||||
// default to the new viewport interaction model bus being enabled so the
|
||||
// manipulator manager is correctly instantiated in EditorDefaultSelection
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class EditorEntityComponentChangeDetector
|
||||
|
||||
@@ -277,20 +277,6 @@ namespace AzToolsFramework
|
||||
|
||||
} // namespace ViewportInteraction
|
||||
|
||||
/// Temporary bus to query if the new Viewport Interaction Model mode is enabled or not.
|
||||
class NewViewportInteractionModelEnabledRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
virtual bool IsNewViewportInteractionModelEnabled() = 0;
|
||||
|
||||
protected:
|
||||
~NewViewportInteractionModelEnabledRequests() = default;
|
||||
};
|
||||
|
||||
/// Type to inherit to implement NewViewportInteractionModelEnabledRequests
|
||||
using NewViewportInteractionModelEnabledRequestBus = AZ::EBus<NewViewportInteractionModelEnabledRequests>;
|
||||
|
||||
/// Utility function to return EntityContextId.
|
||||
inline AzFramework::EntityContextId GetEntityContextId()
|
||||
{
|
||||
@@ -300,16 +286,4 @@ namespace AzToolsFramework
|
||||
|
||||
return entityContextId;
|
||||
}
|
||||
|
||||
/// Utility function to return if the new Viewport Interaction Model
|
||||
/// is enabled (wraps NewViewportInteractionModelEnabledRequests).
|
||||
inline bool IsNewViewportInteractionModelEnabled()
|
||||
{
|
||||
bool newViewportInteractionModelEnabled = false;
|
||||
NewViewportInteractionModelEnabledRequestBus::BroadcastResult(
|
||||
newViewportInteractionModelEnabled,
|
||||
&NewViewportInteractionModelEnabledRequests::IsNewViewportInteractionModelEnabled);
|
||||
|
||||
return newViewportInteractionModelEnabled;
|
||||
}
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
+11
-7
@@ -13,6 +13,7 @@
|
||||
#include "EditorBoxSelect.h"
|
||||
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
@@ -72,7 +73,7 @@ namespace AzToolsFramework
|
||||
m_previousModifiers = mouseInteraction.m_mouseInteraction.m_keyboardModifiers;
|
||||
}
|
||||
|
||||
void EditorBoxSelect::Display2d(AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
void EditorBoxSelect::Display2d(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
@@ -82,12 +83,15 @@ namespace AzToolsFramework
|
||||
debugDisplay.SetLineWidth(s_boxSelectLineWidth);
|
||||
debugDisplay.SetColor(s_boxSelectColor);
|
||||
|
||||
debugDisplay.DrawWireBox(
|
||||
AZ::Vector3(
|
||||
static_cast<float>(m_boxSelectRegion->x()), static_cast<float>(m_boxSelectRegion->y()), 0.0f),
|
||||
AZ::Vector3(
|
||||
static_cast<float>(m_boxSelectRegion->x()) + static_cast<float>(m_boxSelectRegion->width()),
|
||||
static_cast<float>(m_boxSelectRegion->y()) + static_cast<float>(m_boxSelectRegion->height()), 0.0f));
|
||||
AZ::Vector2 viewportSize = AzToolsFramework::GetCameraState(viewportInfo.m_viewportId).m_viewportSize;
|
||||
|
||||
debugDisplay.DrawWireQuad2d(
|
||||
AZ::Vector2(
|
||||
aznumeric_cast<float>(m_boxSelectRegion->x()), aznumeric_cast<float>(m_boxSelectRegion->y())) / viewportSize,
|
||||
AZ::Vector2(
|
||||
aznumeric_cast<float>(m_boxSelectRegion->x()) + aznumeric_cast<float>(m_boxSelectRegion->width()),
|
||||
aznumeric_cast<float>(m_boxSelectRegion->y()) + aznumeric_cast<float>(m_boxSelectRegion->height())) / viewportSize,
|
||||
0.f);
|
||||
|
||||
debugDisplay.DepthTestOn();
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ namespace AzToolsFramework
|
||||
const ViewportInteraction::MouseInteractionEvent& mouseInteraction);
|
||||
|
||||
/// Responsible for drawing the 2d box representing the selection in screen space.
|
||||
void Display2d(AzFramework::DebugDisplayRequests& debugDisplay);
|
||||
void Display2d(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay);
|
||||
|
||||
/// Custom drawing behavior to happen during a box select.
|
||||
void DisplayScene(
|
||||
|
||||
+11
-20
@@ -30,15 +30,9 @@ namespace AzToolsFramework
|
||||
ActionOverrideRequestBus::Handler::BusConnect(GetEntityContextId());
|
||||
ComponentModeFramework::ComponentModeSystemRequestBus::Handler::BusConnect();
|
||||
|
||||
// only create EditorTransformComponentSelection if we are using the new viewport interaction model
|
||||
// note: EditorDefaultSelection is still used when the new viewport interaction model is disabled to support
|
||||
// Component Mode when using legacy viewport interaction model
|
||||
if (IsNewViewportInteractionModelEnabled())
|
||||
{
|
||||
m_manipulatorManager =
|
||||
AZStd::make_shared<AzToolsFramework::ManipulatorManager>(AzToolsFramework::g_mainManipulatorManagerId);
|
||||
m_transformComponentSelection = AZStd::make_unique<EditorTransformComponentSelection>(entityDataCache);
|
||||
}
|
||||
m_manipulatorManager =
|
||||
AZStd::make_shared<AzToolsFramework::ManipulatorManager>(AzToolsFramework::g_mainManipulatorManagerId);
|
||||
m_transformComponentSelection = AZStd::make_unique<EditorTransformComponentSelection>(entityDataCache);
|
||||
}
|
||||
|
||||
EditorDefaultSelection::~EditorDefaultSelection()
|
||||
@@ -325,17 +319,14 @@ namespace AzToolsFramework
|
||||
m_transformComponentSelection->DisplayViewportSelection(viewportInfo, debugDisplay);
|
||||
}
|
||||
|
||||
if (IsNewViewportInteractionModelEnabled())
|
||||
{
|
||||
// poll and set the keyboard modifiers to ensure the mouse interaction is up to date
|
||||
m_currentInteraction.m_keyboardModifiers =
|
||||
AzToolsFramework::ViewportInteraction::BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
// draw the manipulators
|
||||
const AzFramework::CameraState cameraState = GetCameraState(viewportInfo.m_viewportId);
|
||||
debugDisplay.DepthTestOff();
|
||||
m_manipulatorManager->DrawManipulators(debugDisplay, cameraState, m_currentInteraction);
|
||||
debugDisplay.DepthTestOn();
|
||||
}
|
||||
// poll and set the keyboard modifiers to ensure the mouse interaction is up to date
|
||||
m_currentInteraction.m_keyboardModifiers =
|
||||
AzToolsFramework::ViewportInteraction::BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
// draw the manipulators
|
||||
const AzFramework::CameraState cameraState = GetCameraState(viewportInfo.m_viewportId);
|
||||
debugDisplay.DepthTestOff();
|
||||
m_manipulatorManager->DrawManipulators(debugDisplay, cameraState, m_currentInteraction);
|
||||
debugDisplay.DepthTestOn();
|
||||
}
|
||||
|
||||
void EditorDefaultSelection::DisplayViewportSelection2d(
|
||||
|
||||
+4
-4
@@ -441,7 +441,7 @@ namespace AzToolsFramework
|
||||
clusterId);
|
||||
}
|
||||
|
||||
static void SetViewportUiClusterVisible(ViewportUi::ClusterId clusterId, bool visible)
|
||||
static void SetViewportUiClusterVisible(const ViewportUi::ClusterId clusterId, const bool visible)
|
||||
{
|
||||
ViewportUi::ViewportUiRequestBus::Event(
|
||||
ViewportUi::DefaultViewportId,
|
||||
@@ -449,7 +449,7 @@ namespace AzToolsFramework
|
||||
clusterId, visible);
|
||||
}
|
||||
|
||||
static void SetViewportUiClusterActiveButton(ViewportUi::ClusterId clusterId, ViewportUi::ButtonId buttonId)
|
||||
static void SetViewportUiClusterActiveButton(const ViewportUi::ClusterId clusterId, const ViewportUi::ButtonId buttonId)
|
||||
{
|
||||
ViewportUi::ViewportUiRequestBus::Event(
|
||||
ViewportUi::DefaultViewportId,
|
||||
@@ -457,7 +457,7 @@ namespace AzToolsFramework
|
||||
clusterId, buttonId);
|
||||
}
|
||||
|
||||
static ViewportUi::ButtonId RegisterClusterButton(ViewportUi::ClusterId clusterId, const char* iconName)
|
||||
static ViewportUi::ButtonId RegisterClusterButton(const ViewportUi::ClusterId clusterId, const char* iconName)
|
||||
{
|
||||
ViewportUi::ButtonId buttonId;
|
||||
ViewportUi::ViewportUiRequestBus::EventResult(
|
||||
@@ -3494,7 +3494,7 @@ namespace AzToolsFramework
|
||||
|
||||
DrawAxisGizmo(viewportInfo, debugDisplay);
|
||||
|
||||
m_boxSelect.Display2d(debugDisplay);
|
||||
m_boxSelect.Display2d(viewportInfo, debugDisplay);
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::RefreshSelectedEntityIds()
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "AzToolsFramework_precompiled.h"
|
||||
|
||||
#include <AzToolsFramework/ViewportUi/Button.h>
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
|
||||
namespace AzToolsFramework::ViewportUi::Internal
|
||||
{
|
||||
@@ -22,4 +21,11 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
, m_buttonId(buttonId)
|
||||
{
|
||||
}
|
||||
|
||||
Button::Button(AZStd::string icon, AZStd::string name, ButtonId buttonId)
|
||||
: m_icon(AZStd::move(icon))
|
||||
, m_name(AZStd::move(name))
|
||||
, m_buttonId(buttonId)
|
||||
{
|
||||
}
|
||||
} // namespace AzToolsFramework::ViewportUi::Internal
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiRequestBus.h>
|
||||
|
||||
namespace AzToolsFramework::ViewportUi::Internal
|
||||
@@ -27,10 +26,12 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
Deselected
|
||||
};
|
||||
|
||||
explicit Button(AZStd::string icon, ButtonId buttonId);
|
||||
Button(AZStd::string icon, ButtonId buttonId);
|
||||
Button(AZStd::string icon, AZStd::string name, ButtonId buttonId);
|
||||
~Button() = default;
|
||||
|
||||
AZStd::string m_icon; //!< The icon for this button, string path to an image.
|
||||
AZStd::string m_name; //!< The name displayed as a label next to the button's icon.
|
||||
State m_state = State::Deselected;
|
||||
ButtonId m_buttonId;
|
||||
};
|
||||
|
||||
+18
-21
@@ -11,37 +11,27 @@
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/ViewportUi/Button.h>
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
|
||||
|
||||
namespace AzToolsFramework::ViewportUi::Internal
|
||||
{
|
||||
Cluster::Cluster()
|
||||
ButtonGroup::ButtonGroup()
|
||||
: m_buttons()
|
||||
, m_buttonTriggeredEvent()
|
||||
{
|
||||
}
|
||||
|
||||
void Cluster::SetViewportUiElementId(const ViewportUiElementId id)
|
||||
void ButtonGroup::SetViewportUiElementId(const ViewportUiElementId id)
|
||||
{
|
||||
m_viewportUiId = id;
|
||||
}
|
||||
|
||||
ViewportUiElementId Cluster::GetViewportUiElementId() const
|
||||
ViewportUiElementId ButtonGroup::GetViewportUiElementId() const
|
||||
{
|
||||
return m_viewportUiId;
|
||||
}
|
||||
|
||||
void Cluster::SetClusterId(const ClusterId clusterId)
|
||||
{
|
||||
m_clusterId = clusterId;
|
||||
}
|
||||
|
||||
ClusterId Cluster::GetClusterId() const
|
||||
{
|
||||
return m_clusterId;
|
||||
}
|
||||
|
||||
void Cluster::SetHighlightedButton(ButtonId buttonId)
|
||||
void ButtonGroup::SetHighlightedButton(ButtonId buttonId)
|
||||
{
|
||||
if (auto buttonEntry = m_buttons.find(buttonId); buttonEntry != m_buttons.end())
|
||||
{
|
||||
@@ -53,15 +43,22 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
}
|
||||
}
|
||||
|
||||
ButtonId Cluster::AddButton(const AZStd::string& icon)
|
||||
ButtonId ButtonGroup::AddButton(const AZStd::string& icon, const AZStd::string& name)
|
||||
{
|
||||
auto buttonId = ButtonId(m_buttons.size() + 1);
|
||||
|
||||
m_buttons.insert({buttonId, AZStd::make_unique<Button>(icon, buttonId)});
|
||||
if (name.empty())
|
||||
{
|
||||
m_buttons.insert({buttonId, AZStd::make_unique<Button>(icon, buttonId)});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buttons.insert({buttonId, AZStd::make_unique<Button>(icon, name, buttonId)});
|
||||
}
|
||||
return buttonId;
|
||||
}
|
||||
|
||||
Button* Cluster::GetButton(ButtonId buttonId)
|
||||
Button* ButtonGroup::GetButton(ButtonId buttonId)
|
||||
{
|
||||
if (auto buttonEntry = m_buttons.find(buttonId); buttonEntry != m_buttons.end())
|
||||
{
|
||||
@@ -70,7 +67,7 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AZStd::vector<Button*> Cluster::GetButtons()
|
||||
AZStd::vector<Button*> ButtonGroup::GetButtons()
|
||||
{
|
||||
auto buttons = AZStd::vector<Button*>();
|
||||
for (const auto& button : m_buttons)
|
||||
@@ -80,11 +77,11 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
return buttons;
|
||||
}
|
||||
|
||||
void Cluster::ConnectEventHandler(AZ::Event<ButtonId>::Handler& handler) {
|
||||
void ButtonGroup::ConnectEventHandler(AZ::Event<ButtonId>::Handler& handler) {
|
||||
handler.Connect(m_buttonTriggeredEvent);
|
||||
}
|
||||
|
||||
void Cluster::PressButton(ButtonId buttonId)
|
||||
void ButtonGroup::PressButton(ButtonId buttonId)
|
||||
{
|
||||
m_buttonTriggeredEvent.Signal(buttonId);
|
||||
}
|
||||
+6
-9
@@ -18,23 +18,21 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
{
|
||||
class Button;
|
||||
|
||||
//! Data class for a cluster on the Viewport UI. A cluster is defined as a group of buttons with icons
|
||||
//! Data class for a button group on the Viewport UI. A button group is defined as a group of buttons with icons
|
||||
//! each of which can be clicked to trigger an event e.g. toggling between modes.
|
||||
class Cluster
|
||||
//! @note This can be used with either a Cluster or a Switcher with slightly different visuals for each.
|
||||
class ButtonGroup
|
||||
{
|
||||
public:
|
||||
Cluster();
|
||||
~Cluster() = default;
|
||||
ButtonGroup();
|
||||
~ButtonGroup() = default;
|
||||
|
||||
void SetHighlightedButton(ButtonId buttonId);
|
||||
|
||||
void SetViewportUiElementId(ViewportUiElementId id);
|
||||
ViewportUiElementId GetViewportUiElementId() const;
|
||||
|
||||
void SetClusterId(ClusterId id);
|
||||
ClusterId GetClusterId() const;
|
||||
|
||||
ButtonId AddButton(const AZStd::string& icon);
|
||||
ButtonId AddButton(const AZStd::string& icon, const AZStd::string& name = AZStd::string());
|
||||
Button* GetButton(ButtonId buttonId);
|
||||
AZStd::vector<Button*> GetButtons();
|
||||
|
||||
@@ -44,7 +42,6 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
private:
|
||||
AZ::Event<ButtonId> m_buttonTriggeredEvent;
|
||||
ViewportUiElementId m_viewportUiId;
|
||||
ClusterId m_clusterId;
|
||||
AZStd::unordered_map<ButtonId, AZStd::unique_ptr<Button>> m_buttons;
|
||||
};
|
||||
} // namespace AzToolsFramework::ViewportUi::Internal
|
||||
@@ -9,21 +9,22 @@
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AzToolsFramework_precompiled.h"
|
||||
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiCluster.h>
|
||||
|
||||
namespace AzToolsFramework::ViewportUi::Internal
|
||||
{
|
||||
ViewportUiCluster::ViewportUiCluster(AZStd::shared_ptr<Cluster> cluster)
|
||||
ViewportUiCluster::ViewportUiCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup)
|
||||
: QToolBar(nullptr)
|
||||
, m_cluster(cluster)
|
||||
, m_buttonGroup(buttonGroup)
|
||||
{
|
||||
setOrientation(Qt::Orientation::Vertical);
|
||||
setStyleSheet("background: black;");
|
||||
|
||||
const AZStd::vector<Button*> buttons = cluster->GetButtons();
|
||||
const AZStd::vector<Button*> buttons = buttonGroup->GetButtons();
|
||||
for (auto button : buttons)
|
||||
{
|
||||
RegisterButton(button);
|
||||
@@ -39,7 +40,7 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
AddClusterAction(
|
||||
action,
|
||||
[this, button]() {
|
||||
m_cluster->PressButton(button->m_buttonId);
|
||||
m_buttonGroup->PressButton(button->m_buttonId);
|
||||
},
|
||||
[button](QAction* action) {
|
||||
action->setChecked(button->m_state == Button::State::Selected);
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.h>
|
||||
#include <QToolBar>
|
||||
|
||||
class Cluster;
|
||||
|
||||
namespace AzToolsFramework::ViewportUi::Internal
|
||||
{
|
||||
class ButtonGroup;
|
||||
|
||||
//! Helper class to make clusters (toolbars) for display in Viewport UI.
|
||||
class ViewportUiCluster
|
||||
: public QToolBar
|
||||
@@ -29,7 +29,7 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ViewportUiCluster(AZStd::shared_ptr<Cluster> cluster);
|
||||
ViewportUiCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup);
|
||||
~ViewportUiCluster() = default;
|
||||
|
||||
//! Adds a new button to the cluster.
|
||||
@@ -49,7 +49,7 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
//! Removes an action from the Viewport UI Cluster.
|
||||
void RemoveClusterAction(QAction* action);
|
||||
|
||||
AZStd::shared_ptr<Cluster> m_cluster; //!< Data structure which the cluster will be displaying to the Viewport UI.
|
||||
AZStd::shared_ptr<ButtonGroup> m_buttonGroup; //!< Data structure which the cluster will be displaying to the Viewport UI.
|
||||
AZStd::unordered_map<ButtonId, QPointer<QAction>> m_buttonActionMap; //!< Map for buttons to their corresponding actions.
|
||||
ViewportUiWidgetCallbacks m_widgetCallbacks; //!< Registers actions and manages updates.
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiCluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiSwitcher.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiTextField.h>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -55,16 +56,16 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
UnparentWidgets(m_viewportUiElements);
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::AddCluster(AZStd::shared_ptr<Cluster> cluster)
|
||||
void ViewportUiDisplay::AddCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup)
|
||||
{
|
||||
if (!cluster.get())
|
||||
if (!buttonGroup.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto viewportUiCluster = AZStd::make_shared<ViewportUiCluster>(cluster);
|
||||
auto viewportUiCluster = AZStd::make_shared<ViewportUiCluster>(buttonGroup);
|
||||
auto id = AddViewportUiElement(viewportUiCluster);
|
||||
cluster->SetViewportUiElementId(id);
|
||||
buttonGroup->SetViewportUiElementId(id);
|
||||
PositionViewportUiElementAnchored(id, Qt::AlignTop | Qt::AlignLeft);
|
||||
}
|
||||
|
||||
@@ -93,6 +94,51 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::AddSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup)
|
||||
{
|
||||
if (!buttonGroup.get())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto viewportUiSwitcher = AZStd::make_shared<ViewportUiSwitcher>(buttonGroup);
|
||||
auto id = AddViewportUiElement(viewportUiSwitcher);
|
||||
buttonGroup->SetViewportUiElementId(id);
|
||||
PositionViewportUiElementAnchored(id, Qt::AlignTop | Qt::AlignLeft);
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::AddSwitcherButton(const ViewportUiElementId clusterId, Button* button)
|
||||
{
|
||||
if (auto viewportUiSwitcher = qobject_cast<ViewportUiSwitcher*>(GetViewportUiElement(clusterId).get()))
|
||||
{
|
||||
viewportUiSwitcher->AddButton(button);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::RemoveSwitcherButton(ViewportUiElementId clusterId, ButtonId buttonId)
|
||||
{
|
||||
if (auto cluster = qobject_cast<ViewportUiSwitcher*>(GetViewportUiElement(clusterId).get()))
|
||||
{
|
||||
cluster->RemoveButton(buttonId);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::UpdateSwitcher(ViewportUiElementId clusterId)
|
||||
{
|
||||
if (auto cluster = qobject_cast<ViewportUiSwitcher*>(GetViewportUiElement(clusterId).get()))
|
||||
{
|
||||
cluster->Update();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::SetSwitcherActiveButton(ViewportUiElementId clusterId, ButtonId buttonId)
|
||||
{
|
||||
if (auto viewportUiSwitcher = qobject_cast<ViewportUiSwitcher*>(GetViewportUiElement(clusterId).get()))
|
||||
{
|
||||
viewportUiSwitcher->SetActiveButton(buttonId);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiDisplay::AddTextField(AZStd::shared_ptr<TextField> textField)
|
||||
{
|
||||
if (!textField.get())
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/ViewportUi/Button.h>
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
|
||||
#include <AzToolsFramework/ViewportUi/TextField.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiRequestBus.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.h>
|
||||
@@ -56,11 +56,17 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
ViewportUiDisplay(QWidget* parent, QWidget* renderOverlay);
|
||||
~ViewportUiDisplay();
|
||||
|
||||
void AddCluster(AZStd::shared_ptr<Cluster> cluster);
|
||||
void AddCluster(AZStd::shared_ptr<ButtonGroup> buttonGroup);
|
||||
void AddClusterButton(ViewportUiElementId clusterId, Button* button);
|
||||
void RemoveClusterButton(ViewportUiElementId clusterId, ButtonId buttonId);
|
||||
void UpdateCluster(const ViewportUiElementId clusterId);
|
||||
|
||||
void AddSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup);
|
||||
void AddSwitcherButton(ViewportUiElementId switcherId, Button* button);
|
||||
void RemoveSwitcherButton(ViewportUiElementId switcherId, ButtonId buttonId);
|
||||
void UpdateSwitcher(ViewportUiElementId switcherId);
|
||||
void SetSwitcherActiveButton(ViewportUiElementId switcherId, ButtonId buttonId);
|
||||
|
||||
void AddTextField(AZStd::shared_ptr<TextField> textField);
|
||||
void UpdateTextField(ViewportUiElementId textFieldId);
|
||||
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
|
||||
// create a 3x2 map of sub layouts which will stack widgets according to their mapped alignment
|
||||
m_internalLayouts = AZStd::unordered_map<Qt::Alignment, QBoxLayout*> {
|
||||
CreateSubLayout(new QHBoxLayout(), 0, 0, Qt::AlignTop | Qt::AlignLeft),
|
||||
CreateSubLayout(new QVBoxLayout(), 0, 0, Qt::AlignTop | Qt::AlignLeft),
|
||||
CreateSubLayout(new QHBoxLayout(), 1, 0, Qt::AlignBottom | Qt::AlignLeft),
|
||||
CreateSubLayout(new QVBoxLayout(), 0, 1, Qt::AlignTop),
|
||||
CreateSubLayout(new QHBoxLayout(), 1, 1, Qt::AlignBottom),
|
||||
@@ -60,7 +60,7 @@ namespace AzToolsFramework::ViewportUi::Internal
|
||||
AZStd::pair<Qt::Alignment, QBoxLayout*> ViewportUiDisplayLayout::CreateSubLayout(
|
||||
QBoxLayout* layout, const int row, const int column, const Qt::Alignment alignment)
|
||||
{
|
||||
layout->setAlignment(alignment);
|
||||
layout->setAlignment(alignment);
|
||||
|
||||
// add an invisible spacer (stretch) to occupy empty space
|
||||
// without this, alignment and resizing within the sublayouts becomes difficult
|
||||
|
||||
+119
-39
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzToolsFramework/ViewportUi/Button.h>
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
|
||||
|
||||
@@ -32,36 +32,64 @@ namespace AzToolsFramework::ViewportUi
|
||||
|
||||
const ClusterId ViewportUiManager::CreateCluster()
|
||||
{
|
||||
auto cluster = AZStd::make_shared<Internal::Cluster>();
|
||||
m_viewportUi->AddCluster(cluster);
|
||||
auto buttonGroup = AZStd::make_shared<Internal::ButtonGroup>();
|
||||
m_viewportUi->AddCluster(buttonGroup);
|
||||
|
||||
return RegisterNewCluster(cluster);
|
||||
return RegisterNewCluster(buttonGroup);
|
||||
}
|
||||
|
||||
const SwitcherId ViewportUiManager::CreateSwitcher()
|
||||
{
|
||||
auto buttonGroup = AZStd::make_shared<Internal::ButtonGroup>();
|
||||
m_viewportUi->AddSwitcher(buttonGroup);
|
||||
|
||||
return RegisterNewSwitcher(buttonGroup);
|
||||
}
|
||||
|
||||
void ViewportUiManager::SetClusterActiveButton(const ClusterId clusterId, const ButtonId buttonId)
|
||||
{
|
||||
if (auto clusterEntry = m_clusters.find(clusterId); clusterEntry != m_clusters.end())
|
||||
if (auto clusterIt = m_clusterButtonGroups.find(clusterId); clusterIt != m_clusterButtonGroups.end())
|
||||
{
|
||||
auto cluster = clusterEntry->second;
|
||||
auto cluster = clusterIt->second;
|
||||
cluster->SetHighlightedButton(buttonId);
|
||||
UpdateClusterUi(cluster.get());
|
||||
UpdateButtonGroupUi(cluster.get());
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::SetSwitcherActiveButton(const SwitcherId switcherId, const ButtonId buttonId)
|
||||
{
|
||||
if (auto switcherIt = m_switcherButtonGroups.find(switcherId); switcherIt != m_switcherButtonGroups.end())
|
||||
{
|
||||
auto switcher = switcherIt->second;
|
||||
switcher->SetHighlightedButton(buttonId);
|
||||
m_viewportUi->SetSwitcherActiveButton(switcher->GetViewportUiElementId(), buttonId);
|
||||
UpdateButtonGroupUi(switcher.get());
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::RegisterClusterEventHandler(const ClusterId clusterId, AZ::Event<ButtonId>::Handler& handler)
|
||||
{
|
||||
if (auto clusterEntry = m_clusters.find(clusterId); clusterEntry != m_clusters.end())
|
||||
if (auto clusterIt = m_clusterButtonGroups.find(clusterId); clusterIt != m_clusterButtonGroups.end())
|
||||
{
|
||||
auto cluster = clusterEntry->second;
|
||||
auto cluster = clusterIt->second;
|
||||
cluster->ConnectEventHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::RegisterSwitcherEventHandler(const SwitcherId switcherId, AZ::Event<ButtonId>::Handler& handler)
|
||||
{
|
||||
if (auto switcherIt = m_switcherButtonGroups.find(switcherId); switcherIt != m_switcherButtonGroups.end())
|
||||
{
|
||||
auto switcher = switcherIt->second;
|
||||
switcher->ConnectEventHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
const ButtonId ViewportUiManager::CreateClusterButton(const ClusterId clusterId, const AZStd::string& icon)
|
||||
{
|
||||
if (auto clusterEntry = m_clusters.find(clusterId); clusterEntry != m_clusters.end())
|
||||
if (auto clusterIt = m_clusterButtonGroups.find(clusterId); clusterIt != m_clusterButtonGroups.end())
|
||||
{
|
||||
auto cluster = clusterEntry->second;
|
||||
auto cluster = clusterIt->second;
|
||||
auto newId = cluster->AddButton(icon);
|
||||
m_viewportUi->AddClusterButton(cluster->GetViewportUiElementId(), cluster->GetButton(newId));
|
||||
|
||||
@@ -71,12 +99,35 @@ namespace AzToolsFramework::ViewportUi
|
||||
return ButtonId(0);
|
||||
}
|
||||
|
||||
const ButtonId ViewportUiManager::CreateSwitcherButton(const SwitcherId switcherId, const AZStd::string& icon, const AZStd::string& name)
|
||||
{
|
||||
if (auto switcherIt = m_switcherButtonGroups.find(switcherId); switcherIt != m_switcherButtonGroups.end())
|
||||
{
|
||||
auto switcher = switcherIt->second;
|
||||
auto newId = switcher->AddButton(icon, name);
|
||||
m_viewportUi->AddSwitcherButton(switcher->GetViewportUiElementId(), switcher->GetButton(newId));
|
||||
|
||||
return newId;
|
||||
}
|
||||
|
||||
return ButtonId(0);
|
||||
}
|
||||
|
||||
void ViewportUiManager::RemoveCluster(const ClusterId clusterId)
|
||||
{
|
||||
if (auto clusterEntry = m_clusters.find(clusterId); clusterEntry != m_clusters.end())
|
||||
if (auto clusterIt = m_clusterButtonGroups.find(clusterId); clusterIt != m_clusterButtonGroups.end())
|
||||
{
|
||||
m_clusters.erase(clusterEntry);
|
||||
m_viewportUi->RemoveViewportUiElement(clusterEntry->second->GetViewportUiElementId());
|
||||
m_clusterButtonGroups.erase(clusterIt);
|
||||
m_viewportUi->RemoveViewportUiElement(clusterIt->second->GetViewportUiElementId());
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::RemoveSwitcher(SwitcherId switcherId)
|
||||
{
|
||||
if (auto switcherIt = m_switcherButtonGroups.find(switcherId); switcherIt != m_switcherButtonGroups.end())
|
||||
{
|
||||
m_switcherButtonGroups.erase(switcherIt);
|
||||
m_viewportUi->RemoveViewportUiElement(switcherIt->second->GetViewportUiElementId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,15 +144,24 @@ namespace AzToolsFramework::ViewportUi
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::SetClusterVisible(ClusterId clusterId, bool visible)
|
||||
void ViewportUiManager::SetClusterVisible(const ClusterId clusterId, bool visible)
|
||||
{
|
||||
if (auto clusterEntry = m_clusters.find(clusterId); clusterEntry != m_clusters.end())
|
||||
if (auto clusterIt = m_clusterButtonGroups.find(clusterId); clusterIt != m_clusterButtonGroups.end())
|
||||
{
|
||||
auto cluster = clusterEntry->second;
|
||||
auto cluster = clusterIt->second;
|
||||
SetViewportUiElementVisible(m_viewportUi.get(), cluster->GetViewportUiElementId(), visible);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::SetSwitcherVisible(const SwitcherId switcherId, bool visible)
|
||||
{
|
||||
if (auto switcherIt = m_switcherButtonGroups.find(switcherId); switcherIt != m_switcherButtonGroups.end())
|
||||
{
|
||||
auto switcher = switcherIt->second;
|
||||
SetViewportUiElementVisible(m_viewportUi.get(), switcher->GetViewportUiElementId(), visible);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::SetClusterGroupVisible(const AZStd::vector<ClusterId>& clusterGroup, bool visible)
|
||||
{
|
||||
for (auto clusterId : clusterGroup)
|
||||
@@ -123,9 +183,9 @@ namespace AzToolsFramework::ViewportUi
|
||||
|
||||
void ViewportUiManager::SetTextFieldText(TextFieldId textFieldId, const AZStd::string& text)
|
||||
{
|
||||
if (auto textFieldEntry = m_textFields.find(textFieldId); textFieldEntry != m_textFields.end())
|
||||
if (auto textFieldIt = m_textFields.find(textFieldId); textFieldIt != m_textFields.end())
|
||||
{
|
||||
auto textField = textFieldEntry->second;
|
||||
auto textField = textFieldIt->second;
|
||||
textField->m_fieldText = text;
|
||||
UpdateTextFieldUi(textField.get());
|
||||
}
|
||||
@@ -134,27 +194,27 @@ namespace AzToolsFramework::ViewportUi
|
||||
void ViewportUiManager::RegisterTextFieldCallback(
|
||||
TextFieldId textFieldId, AZ::Event<AZStd::string>::Handler& handler)
|
||||
{
|
||||
if (auto textFieldEntry = m_textFields.find(textFieldId); textFieldEntry != m_textFields.end())
|
||||
if (auto textFieldIt = m_textFields.find(textFieldId); textFieldIt != m_textFields.end())
|
||||
{
|
||||
auto textField = textFieldEntry->second;
|
||||
auto textField = textFieldIt->second;
|
||||
textField->ConnectEventHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::RemoveTextField(TextFieldId textFieldId)
|
||||
{
|
||||
if (auto textFieldEntry = m_textFields.find(textFieldId); textFieldEntry != m_textFields.end())
|
||||
if (auto textFieldIt = m_textFields.find(textFieldId); textFieldIt != m_textFields.end())
|
||||
{
|
||||
m_textFields.erase(textFieldEntry);
|
||||
m_viewportUi->RemoveViewportUiElement(textFieldEntry->second->m_viewportId);
|
||||
m_textFields.erase(textFieldIt);
|
||||
m_viewportUi->RemoveViewportUiElement(textFieldIt->second->m_viewportId);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::SetTextFieldVisible(TextFieldId textFieldId, bool visible)
|
||||
{
|
||||
if (auto textFieldEntry = m_textFields.find(textFieldId); textFieldEntry != m_textFields.end())
|
||||
if (auto textFieldIt = m_textFields.find(textFieldId); textFieldIt != m_textFields.end())
|
||||
{
|
||||
auto textField = textFieldEntry->second;
|
||||
auto textField = textFieldIt->second;
|
||||
SetViewportUiElementVisible(m_viewportUi.get(), textField->m_viewportId, visible);
|
||||
}
|
||||
}
|
||||
@@ -173,10 +233,19 @@ namespace AzToolsFramework::ViewportUi
|
||||
void ViewportUiManager::PressButton(ClusterId clusterId, ButtonId buttonId)
|
||||
{
|
||||
// Find cluster using ID and cluster map
|
||||
if (auto clusterEntry = m_clusters.find(clusterId);
|
||||
clusterEntry != m_clusters.end())
|
||||
if (auto clusterIt = m_clusterButtonGroups.find(clusterId);
|
||||
clusterIt != m_clusterButtonGroups.end())
|
||||
{
|
||||
clusterEntry->second->PressButton(buttonId);
|
||||
clusterIt->second->PressButton(buttonId);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiManager::PressButton(SwitcherId switcherId, ButtonId buttonId)
|
||||
{
|
||||
// Find cluster using ID and cluster map
|
||||
if (auto switcherIt = m_switcherButtonGroups.find(switcherId); switcherIt != m_switcherButtonGroups.end())
|
||||
{
|
||||
switcherIt->second->PressButton(buttonId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,21 +265,32 @@ namespace AzToolsFramework::ViewportUi
|
||||
{
|
||||
m_viewportUi->Update();
|
||||
|
||||
for (auto clusterEntry : m_clusters)
|
||||
for (auto buttonGroup : m_clusterButtonGroups)
|
||||
{
|
||||
UpdateClusterUi(clusterEntry.second.get());
|
||||
UpdateButtonGroupUi(buttonGroup.second.get());
|
||||
}
|
||||
for (auto textFieldEntry : m_textFields)
|
||||
for (auto buttonGroup : m_switcherButtonGroups)
|
||||
{
|
||||
UpdateTextFieldUi(textFieldEntry.second.get());
|
||||
UpdateButtonGroupUi(buttonGroup.second.get());
|
||||
}
|
||||
for (auto textField : m_textFields)
|
||||
{
|
||||
UpdateTextFieldUi(textField.second.get());
|
||||
}
|
||||
}
|
||||
|
||||
ClusterId ViewportUiManager::RegisterNewCluster(AZStd::shared_ptr<Internal::Cluster>& cluster)
|
||||
ClusterId ViewportUiManager::RegisterNewCluster(AZStd::shared_ptr<Internal::ButtonGroup>& buttonGroup)
|
||||
{
|
||||
ClusterId newId = ClusterId(m_clusters.size() + 1);
|
||||
cluster->SetClusterId(newId);
|
||||
m_clusters.insert({ newId, cluster });
|
||||
ClusterId newId = ClusterId(m_clusterButtonGroups.size() + 1);
|
||||
m_clusterButtonGroups.insert({ newId, buttonGroup });
|
||||
|
||||
return newId;
|
||||
}
|
||||
|
||||
SwitcherId ViewportUiManager::RegisterNewSwitcher(AZStd::shared_ptr<Internal::ButtonGroup>& buttonGroup)
|
||||
{
|
||||
SwitcherId newId = SwitcherId(m_switcherButtonGroups.size() + 1);
|
||||
m_switcherButtonGroups.insert({newId, buttonGroup});
|
||||
|
||||
return newId;
|
||||
}
|
||||
@@ -224,9 +304,9 @@ namespace AzToolsFramework::ViewportUi
|
||||
return newId;
|
||||
}
|
||||
|
||||
void ViewportUiManager::UpdateClusterUi(Internal::Cluster* cluster)
|
||||
void ViewportUiManager::UpdateButtonGroupUi(Internal::ButtonGroup* buttonGroup)
|
||||
{
|
||||
m_viewportUi->UpdateCluster(cluster->GetViewportUiElementId());
|
||||
m_viewportUi->UpdateCluster(buttonGroup->GetViewportUiElementId());
|
||||
}
|
||||
|
||||
void ViewportUiManager::UpdateTextFieldUi(Internal::TextField* textField)
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
/*
|
||||
* 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/ViewportUi/Button.h>
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/TextField.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
|
||||
|
||||
@@ -21,6 +20,7 @@ namespace AzToolsFramework::ViewportUi
|
||||
{
|
||||
namespace Internal
|
||||
{
|
||||
class ButtonGroup;
|
||||
class ViewportUiDisplay;
|
||||
}
|
||||
|
||||
@@ -29,26 +29,32 @@ namespace AzToolsFramework::ViewportUi
|
||||
public:
|
||||
ViewportUiManager() = default;
|
||||
~ViewportUiManager() = default;
|
||||
|
||||
|
||||
// ViewportUiRequestBus ...
|
||||
const ClusterId CreateCluster() override;
|
||||
const SwitcherId CreateSwitcher() override;
|
||||
void SetClusterActiveButton(ClusterId clusterId, ButtonId buttonId) override;
|
||||
void SetSwitcherActiveButton(SwitcherId switcherId, ButtonId buttonId) override;
|
||||
const ButtonId CreateClusterButton(ClusterId clusterId, const AZStd::string& icon) override;
|
||||
const ButtonId CreateSwitcherButton(
|
||||
SwitcherId switcherId, const AZStd::string& icon, const AZStd::string& name = AZStd::string()) override;
|
||||
void RegisterClusterEventHandler(ClusterId clusterId, AZ::Event<ButtonId>::Handler& handler) override;
|
||||
void RegisterSwitcherEventHandler(SwitcherId switcherId, AZ::Event<ButtonId>::Handler& handler) override;
|
||||
void RemoveCluster(ClusterId clusterId) override;
|
||||
void RemoveSwitcher(SwitcherId switcherId) override;
|
||||
void SetClusterVisible(ClusterId clusterId, bool visible);
|
||||
void SetSwitcherVisible(SwitcherId switcherId, bool visible);
|
||||
void SetClusterGroupVisible(const AZStd::vector<ClusterId>& clusterGroup, bool visible) override;
|
||||
const TextFieldId CreateTextField(
|
||||
const AZStd::string& labelText, const AZStd::string& textFieldDefaultText,
|
||||
TextFieldValidationType validationType) override;
|
||||
const AZStd::string& labelText, const AZStd::string& textFieldDefaultText, TextFieldValidationType validationType) override;
|
||||
void SetTextFieldText(TextFieldId textFieldId, const AZStd::string& text) override;
|
||||
void RegisterTextFieldCallback(
|
||||
TextFieldId textFieldId, AZ::Event<AZStd::string>::Handler& handler) override;
|
||||
void RegisterTextFieldCallback(TextFieldId textFieldId, AZ::Event<AZStd::string>::Handler& handler) override;
|
||||
void RemoveTextField(TextFieldId textFieldId) override;
|
||||
void SetTextFieldVisible(TextFieldId textFieldId, bool visible) override;
|
||||
void CreateComponentModeBorder(const AZStd::string& borderTitle) override;
|
||||
void RemoveComponentModeBorder() override;
|
||||
void PressButton(ClusterId clusterId, ButtonId buttonId) override;
|
||||
void PressButton(SwitcherId switcherId, ButtonId buttonId) override;
|
||||
|
||||
//! Connects to the correct viewportId bus address.
|
||||
void ConnectViewportUiBus(const int viewportId);
|
||||
@@ -60,17 +66,23 @@ namespace AzToolsFramework::ViewportUi
|
||||
void Update();
|
||||
|
||||
protected:
|
||||
AZStd::unordered_map<ClusterId, AZStd::shared_ptr<Internal::Cluster>> m_clusters; //!< A map of all registered clusters.
|
||||
AZStd::unordered_map<TextFieldId, AZStd::shared_ptr<Internal::TextField>> m_textFields; //!< A map of all registered textFields.
|
||||
AZStd::unordered_map<ClusterId, AZStd::shared_ptr<Internal::ButtonGroup>>
|
||||
m_clusterButtonGroups; //!< A map of all registered Clusters.
|
||||
AZStd::unordered_map<SwitcherId, AZStd::shared_ptr<Internal::ButtonGroup>>
|
||||
m_switcherButtonGroups; //!< A map of all registered Switchers.
|
||||
AZStd::unordered_map<TextFieldId, AZStd::shared_ptr<Internal::TextField>> m_textFields; //!< A map of all registered TextFields.
|
||||
|
||||
AZStd::unique_ptr<Internal::ViewportUiDisplay> m_viewportUi; //!< The lower level graphical API for Viewport UI.
|
||||
|
||||
private:
|
||||
//! Register a new cluster and return its id.
|
||||
ClusterId RegisterNewCluster(AZStd::shared_ptr<Internal::Cluster>& cluster);
|
||||
//! Register a new Cluster and return its id.
|
||||
ClusterId RegisterNewCluster(AZStd::shared_ptr<Internal::ButtonGroup>& buttonGroup);
|
||||
//! Register a new Switcher and return its id.
|
||||
SwitcherId RegisterNewSwitcher(AZStd::shared_ptr<Internal::ButtonGroup>& buttonGroup);
|
||||
//! Register a new text field and return its id.
|
||||
TextFieldId RegisterNewTextField(AZStd::shared_ptr<Internal::TextField>& textField);
|
||||
//! Update the corresponding ui element for the given cluster.
|
||||
void UpdateClusterUi(Internal::Cluster* cluster);
|
||||
//! Update the corresponding ui element for the given button group.
|
||||
void UpdateButtonGroupUi(Internal::ButtonGroup* buttonGroup);
|
||||
//! Update the corresponding ui element for the given text field.
|
||||
void UpdateTextFieldUi(Internal::TextField* textField);
|
||||
};
|
||||
|
||||
+28
-16
@@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -23,11 +23,13 @@ namespace AzToolsFramework::ViewportUi
|
||||
using ViewportUiElementId = IdType<struct ViewportUiIdType>;
|
||||
using ButtonId = IdType<struct ButtonIdType>;
|
||||
using ClusterId = IdType<struct ClusterIdType>;
|
||||
using SwitcherId = IdType<struct SwitcherIdType>;
|
||||
using TextFieldId = IdType<struct TextFieldIdType>;
|
||||
|
||||
inline const ViewportUiElementId InvalidViewportUiElementId = ViewportUiElementId(0);
|
||||
inline const ButtonId InvalidButtonId = ButtonId(0);
|
||||
inline const ClusterId InvalidClusterId = ClusterId(0);
|
||||
inline const SwitcherId InvalidSwitcherId = SwitcherId(0);
|
||||
|
||||
inline const int DefaultViewportId = 0;
|
||||
|
||||
@@ -46,27 +48,36 @@ namespace AzToolsFramework::ViewportUi
|
||||
public:
|
||||
//! Creates and registers a cluster with the Viewport UI system.
|
||||
virtual const ClusterId CreateCluster() = 0;
|
||||
//! Creates and registers a switcher with the Viewport UI system.
|
||||
virtual const SwitcherId CreateSwitcher() = 0;
|
||||
//! Sets the active button of the cluster. This is the button which will display as highlighted.
|
||||
virtual void SetClusterActiveButton(ClusterId clusterId, ButtonId buttonId) = 0;
|
||||
//! Sets the active button of the switcher. This is the button which has a text label.
|
||||
virtual void SetSwitcherActiveButton(SwitcherId clusterId, ButtonId buttonId) = 0;
|
||||
//! Registers a new button onto a cluster.
|
||||
virtual const ButtonId CreateClusterButton(const ClusterId clusterId, const AZStd::string& icon) = 0;
|
||||
//! Registers a new button onto a switcher.
|
||||
virtual const ButtonId CreateSwitcherButton(
|
||||
SwitcherId switcherId, const AZStd::string& icon, const AZStd::string& name = AZStd::string()) = 0;
|
||||
//! Registers an event handler to handle events from the cluster.
|
||||
virtual void RegisterClusterEventHandler(ClusterId clusterId, AZ::Event<ButtonId>::Handler& handler) = 0;
|
||||
//! Registers an event handler to handle events from the cluster.
|
||||
virtual void RegisterSwitcherEventHandler(SwitcherId switcherId, AZ::Event<ButtonId>::Handler& handler) = 0;
|
||||
//! Removes a cluster from the Viewport UI system.
|
||||
virtual void RemoveCluster(ClusterId clusterId) = 0;
|
||||
//!
|
||||
virtual void RemoveSwitcher(SwitcherId switcherId) = 0;
|
||||
//! Sets the visibility of the cluster.
|
||||
virtual void SetClusterVisible(ClusterId clusterId, bool visible) = 0;
|
||||
//! Sets the visibility of multiple clusters.
|
||||
virtual void SetClusterGroupVisible(const AZStd::vector<ClusterId>& clusterGroup, bool visible) = 0;
|
||||
//! Creates and registers a text field with the Viewport UI system.
|
||||
virtual const TextFieldId CreateTextField(
|
||||
const AZStd::string& labelText, const AZStd::string& textFieldDefaultText,
|
||||
TextFieldValidationType validationType) = 0;
|
||||
const AZStd::string& labelText, const AZStd::string& textFieldDefaultText, TextFieldValidationType validationType) = 0;
|
||||
//! Set the text that will go inside the text field.
|
||||
virtual void SetTextFieldText(TextFieldId textFieldId, const AZStd::string& text) = 0;
|
||||
//! Register an event handler to handle when the text field text changes.
|
||||
virtual void RegisterTextFieldCallback(
|
||||
TextFieldId textFieldId, AZ::Event<AZStd::string>::Handler& handler) = 0;
|
||||
virtual void RegisterTextFieldCallback(TextFieldId textFieldId, AZ::Event<AZStd::string>::Handler& handler) = 0;
|
||||
//! Removes a text field from the Viewport UI system.
|
||||
virtual void RemoveTextField(TextFieldId textFieldId) = 0;
|
||||
//! Sets the visibility of the text field.
|
||||
@@ -77,11 +88,12 @@ namespace AzToolsFramework::ViewportUi
|
||||
virtual void RemoveComponentModeBorder() = 0;
|
||||
//! Invoke a button press in a cluster.
|
||||
virtual void PressButton(ClusterId clusterId, ButtonId buttonId) = 0;
|
||||
//!
|
||||
virtual void PressButton(SwitcherId switcherId, ButtonId buttonId) = 0;
|
||||
};
|
||||
|
||||
/// The EBusTraits for ViewportInteractionRequests.
|
||||
class ViewportUiBusTraits
|
||||
: public AZ::EBusTraits
|
||||
class ViewportUiBusTraits : public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
using BusIdType = int; ///< ViewportId - used to address requests to this EBus.
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* 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 <AzToolsFramework/ViewportUi/ButtonGroup.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiSwitcher.h>
|
||||
|
||||
namespace AzToolsFramework::ViewportUi::Internal
|
||||
{
|
||||
ViewportUiSwitcher::ViewportUiSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup)
|
||||
: m_buttonGroup(buttonGroup)
|
||||
{
|
||||
setOrientation(Qt::Orientation::Horizontal);
|
||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
setStyleSheet(QString("QToolBar {background-color: none; border: none; spacing: 3px;}"
|
||||
"QToolButton {background-color: black; border: outset; border-color: white; border-radius: 7px; "
|
||||
"border-width: 2px; padding: 7px; color: white;}"));
|
||||
|
||||
// Add am empty active button (is set in the call to SetActiveMode)
|
||||
m_activeButton = new QToolButton();
|
||||
// No hover effect for the main button as it's not clickable
|
||||
m_activeButton->setProperty("IconHasHoverEffect", false);
|
||||
m_activeButton->setCheckable(false);
|
||||
m_activeButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
addWidget(m_activeButton);
|
||||
|
||||
const AZStd::vector<Button*> buttons = buttonGroup->GetButtons();
|
||||
|
||||
for (auto button : buttons)
|
||||
{
|
||||
// Add all the buttons as actions
|
||||
if (button->m_buttonId)
|
||||
{
|
||||
AddButton(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ViewportUiSwitcher::~ViewportUiSwitcher()
|
||||
{
|
||||
delete m_activeButton;
|
||||
}
|
||||
|
||||
void ViewportUiSwitcher::AddButton(Button* button)
|
||||
{
|
||||
QAction* action = new QAction();
|
||||
action->setCheckable(true);
|
||||
action->setIcon(QIcon(QString(button->m_icon.c_str())));
|
||||
|
||||
if (!action)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// set hover to true by default
|
||||
action->setProperty("IconHasHoverEffect", true);
|
||||
|
||||
// add the action
|
||||
addAction(action);
|
||||
|
||||
// resize to fit new action with minimum extra space
|
||||
resize(minimumSizeHint());
|
||||
|
||||
const AZStd::function<void()>& callback = [this, button]() { m_buttonGroup->PressButton(button->m_buttonId); };
|
||||
const AZStd::function<void(QAction*)>& updateCallback = [button](QAction* action) {
|
||||
action->setChecked(button->m_state == Button::State::Selected);
|
||||
};
|
||||
|
||||
// connect the callback if provided
|
||||
if (callback)
|
||||
{
|
||||
QObject::connect(action, &QAction::triggered, action, callback);
|
||||
}
|
||||
|
||||
// register the action
|
||||
m_widgetCallbacks.AddWidget(
|
||||
action, [updateCallback](QPointer<QObject> object) { updateCallback(static_cast<QAction*>(object.data())); });
|
||||
|
||||
m_buttonActionMap.insert({button->m_buttonId, action});
|
||||
}
|
||||
|
||||
void ViewportUiSwitcher::RemoveButton(ButtonId buttonId)
|
||||
{
|
||||
if (auto actionEntry = m_buttonActionMap.find(buttonId); actionEntry != m_buttonActionMap.end())
|
||||
{
|
||||
QAction* action = actionEntry->second;
|
||||
|
||||
// remove the action from the toolbar
|
||||
removeAction(action);
|
||||
|
||||
// deregister from the widget manager
|
||||
m_widgetCallbacks.RemoveWidget(action);
|
||||
|
||||
// resize to fit new area with minimum extra space
|
||||
resize(minimumSizeHint());
|
||||
|
||||
m_buttonActionMap.erase(buttonId);
|
||||
|
||||
// reset current active mode if its the button being removed
|
||||
if (buttonId == m_activeButtonId)
|
||||
{
|
||||
if (auto nextEntry = m_buttonActionMap.find(ButtonId(buttonId + 1)); nextEntry != m_buttonActionMap.end())
|
||||
{
|
||||
SetActiveButton(nextEntry->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportUiSwitcher::Update()
|
||||
{
|
||||
m_widgetCallbacks.Update();
|
||||
}
|
||||
|
||||
void ViewportUiSwitcher::SetActiveButton(ButtonId buttonId)
|
||||
{
|
||||
// Check if it is the first active mode to be set
|
||||
bool initialActiveMode = (m_activeButtonId == ButtonId(0));
|
||||
|
||||
// Change the toolbutton's name and icon to that button
|
||||
const AZStd::vector<Button*> buttons = m_buttonGroup->GetButtons();
|
||||
auto found = [buttonId](Button* button) { return (button->m_buttonId == buttonId); };
|
||||
|
||||
if (auto buttonIt = AZStd::find_if(buttons.begin(), buttons.end(), found); buttonIt != buttons.end())
|
||||
{
|
||||
QString buttonName = ((*buttonIt)->m_name).c_str();
|
||||
QIcon buttonIcon = QIcon(QString(((*buttonIt)->m_icon).c_str()));
|
||||
m_activeButton->setIcon(buttonIcon);
|
||||
m_activeButton->setText(buttonName);
|
||||
}
|
||||
|
||||
// Look up button ID in map then remove it from its current position
|
||||
auto itr = m_buttonActionMap.find(buttonId);
|
||||
QAction* action = itr->second;
|
||||
removeAction(action);
|
||||
|
||||
if (!initialActiveMode)
|
||||
{
|
||||
// Add the last action removed
|
||||
if (m_activeButtonId != buttonId)
|
||||
{
|
||||
itr = m_buttonActionMap.find(m_activeButtonId);
|
||||
action = itr->second;
|
||||
addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
m_activeButtonId = buttonId;
|
||||
}
|
||||
} // namespace AzToolsFramework::ViewportUi::Internal
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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/ViewportUi/Button.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiWidgetCallbacks.h>
|
||||
#include <functional>
|
||||
#include <QPointer>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
|
||||
namespace AzToolsFramework::ViewportUi::Internal
|
||||
{
|
||||
class ButtonGroup;
|
||||
|
||||
//! Helper class to make switchers (toolbars) for display in Viewport UI.
|
||||
class ViewportUiSwitcher : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ViewportUiSwitcher(AZStd::shared_ptr<ButtonGroup> buttonGroup);
|
||||
~ViewportUiSwitcher();
|
||||
//! Adds a new button to the switcher.
|
||||
void AddButton(Button* button);
|
||||
//! Removes a button from the switcher.
|
||||
void RemoveButton(ButtonId buttonId);
|
||||
void Update();
|
||||
//! Changes the m_activeButton.
|
||||
void SetActiveButton(ButtonId buttonId);
|
||||
|
||||
private:
|
||||
QToolButton* m_activeButton; //!< The first button in the toolbar. Only button with a label/text.
|
||||
ButtonId m_activeButtonId = ButtonId(0); //!< ButtonId corresponding to the active button in the buttonActionMap.
|
||||
AZStd::shared_ptr<ButtonGroup> m_buttonGroup; //!< Data structure which the cluster will be displaying to the Viewport UI.
|
||||
AZStd::unordered_map<ButtonId, QPointer<QAction>> m_buttonActionMap; //!< Map for buttons to their corresponding actions.
|
||||
ViewportUiWidgetCallbacks m_widgetCallbacks; //!< Registers actions and manages updates.
|
||||
};
|
||||
} // namespace AzToolsFramework::ViewportUi::Internal
|
||||
@@ -70,11 +70,6 @@ set(FILES
|
||||
AssetCatalog/PlatformAddressedAssetCatalog.cpp
|
||||
AssetCatalog/PlatformAddressedAssetCatalogManager.h
|
||||
AssetCatalog/PlatformAddressedAssetCatalogManager.cpp
|
||||
MaterialBrowser/MaterialBrowserBus.h
|
||||
MaterialBrowser/MaterialBrowserComponent.cpp
|
||||
MaterialBrowser/MaterialBrowserComponent.h
|
||||
MaterialBrowser/MaterialThumbnail.cpp
|
||||
MaterialBrowser/MaterialThumbnail.h
|
||||
Thumbnails/ThumbnailerComponent.cpp
|
||||
Thumbnails/ThumbnailerComponent.h
|
||||
Thumbnails/LoadingThumbnail.cpp
|
||||
@@ -487,8 +482,8 @@ set(FILES
|
||||
Viewport/ViewportTypes.cpp
|
||||
ViewportUi/Button.h
|
||||
ViewportUi/Button.cpp
|
||||
ViewportUi/Cluster.h
|
||||
ViewportUi/Cluster.cpp
|
||||
ViewportUi/ButtonGroup.h
|
||||
ViewportUi/ButtonGroup.cpp
|
||||
ViewportUi/TextField.h
|
||||
ViewportUi/TextField.cpp
|
||||
ViewportUi/ViewportUiDisplay.h
|
||||
@@ -500,6 +495,8 @@ set(FILES
|
||||
ViewportUi/ViewportUiTextField.cpp
|
||||
ViewportUi/ViewportUiCluster.h
|
||||
ViewportUi/ViewportUiCluster.cpp
|
||||
ViewportUi/ViewportUiSwitcher.h
|
||||
ViewportUi/ViewportUiSwitcher.cpp
|
||||
ViewportUi/ViewportUiWidgetCallbacks.h
|
||||
ViewportUi/ViewportUiWidgetCallbacks.cpp
|
||||
ViewportUi/ViewportUiDisplayLayout.h
|
||||
@@ -652,6 +649,7 @@ set(FILES
|
||||
Prefab/PrefabPublicHandler.h
|
||||
Prefab/PrefabPublicHandler.cpp
|
||||
Prefab/PrefabPublicInterface.h
|
||||
Prefab/PrefabPublicNotificationBus.h
|
||||
Prefab/PrefabUndo.h
|
||||
Prefab/PrefabUndo.cpp
|
||||
Prefab/PrefabUndoCache.cpp
|
||||
@@ -687,7 +685,6 @@ set(FILES
|
||||
UI/Outliner/EntityOutlinerDisplayOptionsMenu.cpp
|
||||
UI/Outliner/EntityOutlinerTreeView.hxx
|
||||
UI/Outliner/EntityOutlinerTreeView.cpp
|
||||
UI/Outliner/EntityOutlinerWidgetInterface.h
|
||||
UI/Outliner/EntityOutlinerWidget.hxx
|
||||
UI/Outliner/EntityOutlinerWidget.cpp
|
||||
UI/Outliner/EntityOutlinerCacheBus.h
|
||||
@@ -729,7 +726,7 @@ set(FILES
|
||||
# Prevent the following files from being grouped in UNITY builds
|
||||
set(SKIP_UNITY_BUILD_INCLUSION_FILES
|
||||
# The following files are skipped from unity to avoid duplicated symbols related to an ebus
|
||||
AzToolsFrameworkModule.cpp
|
||||
AzToolsFrameworkModule.cpp
|
||||
Application/ToolsApplication.cpp
|
||||
UI/PropertyEditor/PropertyEntityIdCtrl.cpp
|
||||
UI/PropertyEditor/PropertyManagerComponent.cpp
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace AzToolsFramework
|
||||
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Entity Search Test Components")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &EntitySearch_TestComponent1::m_boolValue, "Bool", "")
|
||||
@@ -108,8 +108,8 @@ namespace AzToolsFramework
|
||||
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Entity Search Test Components")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &EntitySearch_TestComponent2::m_floatValue, "Float", "")
|
||||
|
||||
@@ -125,8 +125,8 @@ namespace UnitTest
|
||||
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Inspector Test Components")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &Inspector_TestComponent2::m_data, "Data", "The component's Data");
|
||||
@@ -194,8 +194,8 @@ namespace UnitTest
|
||||
->Attribute(AZ::Edit::Attributes::AddableByUser, true)
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Inspector Test Components")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Tag.png")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://www.amazongames.com/")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &Inspector_TestComponent3::m_data, "Data", "The component's Data");
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ namespace Benchmark
|
||||
}
|
||||
BENCHMARK_REGISTER_F(BM_PrefabUpdateInstances, UpdateInstances_SingeEntityInstances)
|
||||
->RangeMultiplier(10)
|
||||
->Range(100, 10000)
|
||||
->Range(100, 1000)
|
||||
->Unit(benchmark::kMillisecond)
|
||||
->Complexity();
|
||||
|
||||
|
||||
@@ -85,8 +85,6 @@ namespace UnitTest
|
||||
{
|
||||
constexpr const char* contextName1 = "Context1";
|
||||
constexpr const char* contextName2 = "Context2";
|
||||
constexpr int thumbnailSize1 = 128;
|
||||
constexpr int thumbnailSize2 = 256;
|
||||
|
||||
auto checkHasContext = [](const char* contextName)
|
||||
{
|
||||
@@ -98,12 +96,12 @@ namespace UnitTest
|
||||
EXPECT_FALSE(checkHasContext(contextName1));
|
||||
EXPECT_FALSE(checkHasContext(contextName2));
|
||||
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1, thumbnailSize1);
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1);
|
||||
|
||||
EXPECT_TRUE(checkHasContext(contextName1));
|
||||
EXPECT_FALSE(checkHasContext(contextName2));
|
||||
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName2, thumbnailSize2);
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName2);
|
||||
|
||||
EXPECT_TRUE(checkHasContext(contextName1));
|
||||
EXPECT_TRUE(checkHasContext(contextName2));
|
||||
@@ -123,8 +121,6 @@ namespace UnitTest
|
||||
{
|
||||
constexpr const char* contextName1 = "Context1";
|
||||
constexpr const char* contextName2 = "Context2";
|
||||
constexpr int thumbnailSize1 = 128;
|
||||
constexpr int thumbnailSize2 = 256;
|
||||
|
||||
auto checkHasContext = [](const char* contextName)
|
||||
{
|
||||
@@ -133,8 +129,8 @@ namespace UnitTest
|
||||
return hasContext;
|
||||
};
|
||||
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1, thumbnailSize1);
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName2, thumbnailSize2);
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1);
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName2);
|
||||
|
||||
EXPECT_TRUE(checkHasContext(contextName1));
|
||||
EXPECT_TRUE(checkHasContext(contextName2));
|
||||
@@ -149,12 +145,11 @@ namespace UnitTest
|
||||
TEST_F(ThumbnailerTests, ThumbnailerComponent_RegisterContextTwice_Assert)
|
||||
{
|
||||
constexpr const char* contextName1 = "Context1";
|
||||
constexpr int thumbnailSize1 = 128;
|
||||
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1, thumbnailSize1);
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1);
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1, thumbnailSize1);
|
||||
AzToolsFramework::Thumbnailer::ThumbnailerRequestBus::Broadcast(&AzToolsFramework::Thumbnailer::ThumbnailerRequests::RegisterContext, contextName1);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,35 +20,35 @@
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
using Cluster = AzToolsFramework::ViewportUi::Internal::Cluster;
|
||||
using ButtonGroup = AzToolsFramework::ViewportUi::Internal::ButtonGroup;
|
||||
using ButtonId = AzToolsFramework::ViewportUi::ButtonId;
|
||||
|
||||
TEST(ClusterTest, AddButtonAddsButtonToClusterAndReturnsId)
|
||||
{
|
||||
auto cluster = AZStd::make_unique<Cluster>();
|
||||
auto buttonId = cluster->AddButton("");
|
||||
auto buttonGroup = AZStd::make_unique<ButtonGroup>();
|
||||
auto buttonId = buttonGroup->AddButton("");
|
||||
|
||||
auto button = cluster->GetButton(buttonId);
|
||||
auto button = buttonGroup->GetButton(buttonId);
|
||||
EXPECT_TRUE(button != nullptr);
|
||||
}
|
||||
|
||||
TEST(ClusterTest, SetHighlightedButtonChangesButtonStateToSelected)
|
||||
{
|
||||
auto cluster = AZStd::make_unique<Cluster>();
|
||||
auto buttonId = cluster->AddButton("");
|
||||
auto buttonGroup = AZStd::make_unique<ButtonGroup>();
|
||||
auto buttonId = buttonGroup->AddButton("");
|
||||
|
||||
// check button is not highlighted by default
|
||||
auto button = cluster->GetButton(buttonId);
|
||||
auto button = buttonGroup->GetButton(buttonId);
|
||||
EXPECT_FALSE(button->m_state == AzToolsFramework::ViewportUi::Internal::Button::State::Selected);
|
||||
|
||||
cluster->SetHighlightedButton(buttonId);
|
||||
buttonGroup->SetHighlightedButton(buttonId);
|
||||
EXPECT_TRUE(button->m_state == AzToolsFramework::ViewportUi::Internal::Button::State::Selected);
|
||||
}
|
||||
|
||||
TEST(ClusterTest, ConnectEventHandlerConnectsHandlerToButtonTriggeredEvent)
|
||||
{
|
||||
auto cluster = AZStd::make_unique<Cluster>();
|
||||
auto buttonId = cluster->AddButton("");
|
||||
auto buttonGroup = AZStd::make_unique<ButtonGroup>();
|
||||
auto buttonId = buttonGroup->AddButton("");
|
||||
|
||||
// create a handler which will be triggered by the cluster
|
||||
bool handlerTriggered = false;
|
||||
@@ -62,8 +62,8 @@ namespace UnitTest
|
||||
}
|
||||
});
|
||||
|
||||
cluster->ConnectEventHandler(handler);
|
||||
cluster->PressButton(buttonId);
|
||||
buttonGroup->ConnectEventHandler(handler);
|
||||
buttonGroup->PressButton(buttonId);
|
||||
|
||||
EXPECT_TRUE(handlerTriggered);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzFramework/Viewport/ViewportScreen.h>
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzToolsFramework/ViewportUi/Cluster.h>
|
||||
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiCluster.h>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
@@ -23,14 +23,14 @@
|
||||
namespace UnitTest
|
||||
{
|
||||
using ViewportUiCluster = AzToolsFramework::ViewportUi::Internal::ViewportUiCluster;
|
||||
using Cluster = AzToolsFramework::ViewportUi::Internal::Cluster;
|
||||
using ButtonGroup = AzToolsFramework::ViewportUi::Internal::ButtonGroup;
|
||||
using Button = AzToolsFramework::ViewportUi::Internal::Button;
|
||||
using ButtonId = AzToolsFramework::ViewportUi::ButtonId;
|
||||
|
||||
TEST(ViewportUiCluster, RegisterButtonIncreasesClusterHeight)
|
||||
{
|
||||
auto clusterInfo = AZStd::make_shared<Cluster>();
|
||||
ViewportUiCluster viewportUiCluster(clusterInfo);
|
||||
auto buttonGroup = AZStd::make_shared<ButtonGroup>();
|
||||
ViewportUiCluster viewportUiCluster(buttonGroup);
|
||||
viewportUiCluster.resize(viewportUiCluster.minimumSizeHint());
|
||||
|
||||
// need to initialize cluster with a single button or size will be invalid
|
||||
@@ -48,8 +48,8 @@ namespace UnitTest
|
||||
|
||||
TEST(ViewportUiCluster, RemoveClusterButtonDecreasesClusterHeight)
|
||||
{
|
||||
auto clusterInfo = AZStd::make_shared<Cluster>();
|
||||
ViewportUiCluster viewportUiCluster(clusterInfo);
|
||||
auto buttonGroup = AZStd::make_shared<ButtonGroup>();
|
||||
ViewportUiCluster viewportUiCluster(buttonGroup);
|
||||
viewportUiCluster.resize(viewportUiCluster.minimumSizeHint());
|
||||
|
||||
// need to initialize cluster with a single button or size will be invalid
|
||||
@@ -70,8 +70,8 @@ namespace UnitTest
|
||||
|
||||
TEST(ViewportUiCluster, UpdateChangesActiveButton)
|
||||
{
|
||||
auto clusterInfo = AZStd::make_shared<Cluster>();
|
||||
ViewportUiCluster viewportUiCluster(clusterInfo);
|
||||
auto buttonGroup = AZStd::make_shared<ButtonGroup>();
|
||||
ViewportUiCluster viewportUiCluster(buttonGroup);
|
||||
|
||||
// register a button to the cluster
|
||||
auto button = AZStd::make_unique<Button>("", ButtonId(1));
|
||||
@@ -93,8 +93,8 @@ namespace UnitTest
|
||||
|
||||
TEST(ViewportUiCluster, TriggeringActionTriggersClusterEventForButton)
|
||||
{
|
||||
auto clusterInfo = AZStd::make_shared<Cluster>();
|
||||
ViewportUiCluster viewportUiCluster(clusterInfo);
|
||||
auto buttonGroup = AZStd::make_shared<ButtonGroup>();
|
||||
ViewportUiCluster viewportUiCluster(buttonGroup);
|
||||
|
||||
// create a handler which will be triggered by the button
|
||||
bool handlerTriggered = false;
|
||||
@@ -107,7 +107,7 @@ namespace UnitTest
|
||||
handlerTriggered = true;
|
||||
}
|
||||
});
|
||||
clusterInfo->ConnectEventHandler(handler);
|
||||
buttonGroup->ConnectEventHandler(handler);
|
||||
|
||||
// register the button
|
||||
auto button = AZStd::make_unique<Button>("", testButtonId);
|
||||
|
||||
@@ -23,10 +23,10 @@ namespace UnitTest
|
||||
{
|
||||
using ViewportUiDisplay = AzToolsFramework::ViewportUi::Internal::ViewportUiDisplay;
|
||||
using ViewportUiElementId = AzToolsFramework::ViewportUi::ViewportUiElementId;
|
||||
using Cluster = AzToolsFramework::ViewportUi::Internal::Cluster;
|
||||
using ButtonGroup = AzToolsFramework::ViewportUi::Internal::ButtonGroup;
|
||||
|
||||
// sets up a parent widget and render overlay to attach the Viewport UI to
|
||||
// as well as a cluster with one button
|
||||
// as well as a button group with one button
|
||||
class ViewportUiDisplayTestFixture : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
@@ -34,22 +34,22 @@ namespace UnitTest
|
||||
|
||||
void SetUp()
|
||||
{
|
||||
m_cluster = AZStd::make_shared<Cluster>();
|
||||
m_cluster->AddButton("");
|
||||
m_buttonGroup = AZStd::make_shared<ButtonGroup>();
|
||||
m_buttonGroup->AddButton("");
|
||||
m_parentWidget = new QWidget();
|
||||
m_mockRenderOverlay = new QWidget();
|
||||
}
|
||||
|
||||
void TearDown()
|
||||
{
|
||||
m_cluster.reset();
|
||||
m_buttonGroup.reset();
|
||||
delete m_parentWidget;
|
||||
delete m_mockRenderOverlay;
|
||||
}
|
||||
|
||||
QWidget* m_parentWidget = nullptr;
|
||||
QWidget* m_mockRenderOverlay = nullptr;
|
||||
AZStd::shared_ptr<Cluster> m_cluster = nullptr;
|
||||
AZStd::shared_ptr<ButtonGroup> m_buttonGroup = nullptr;
|
||||
};
|
||||
|
||||
TEST_F(ViewportUiDisplayTestFixture, ViewportUiInitializationReturnsProperlyParentedWidgets)
|
||||
@@ -72,13 +72,13 @@ namespace UnitTest
|
||||
TEST_F(ViewportUiDisplayTestFixture, RemoveViewportUiElementRemovesElementFromViewportUi)
|
||||
{
|
||||
ViewportUiDisplay viewportUi(m_parentWidget, m_mockRenderOverlay);
|
||||
viewportUi.AddCluster(m_cluster);
|
||||
auto widget = viewportUi.GetViewportUiElement(m_cluster->GetViewportUiElementId());
|
||||
viewportUi.AddCluster(m_buttonGroup);
|
||||
auto widget = viewportUi.GetViewportUiElement(m_buttonGroup->GetViewportUiElementId());
|
||||
|
||||
EXPECT_TRUE(widget.get() != nullptr);
|
||||
|
||||
viewportUi.RemoveViewportUiElement(m_cluster->GetViewportUiElementId());
|
||||
widget = viewportUi.GetViewportUiElement(m_cluster->GetViewportUiElementId());
|
||||
viewportUi.RemoveViewportUiElement(m_buttonGroup->GetViewportUiElementId());
|
||||
widget = viewportUi.GetViewportUiElement(m_buttonGroup->GetViewportUiElementId());
|
||||
|
||||
EXPECT_TRUE(widget.get() == nullptr);
|
||||
}
|
||||
@@ -89,11 +89,11 @@ namespace UnitTest
|
||||
|
||||
ViewportUiDisplay viewportUi(m_parentWidget, m_mockRenderOverlay);
|
||||
viewportUi.InitializeUiOverlay();
|
||||
viewportUi.AddCluster(m_cluster);
|
||||
viewportUi.AddCluster(m_buttonGroup);
|
||||
viewportUi.Update();
|
||||
viewportUi.ShowViewportUiElement(m_cluster->GetViewportUiElementId());
|
||||
viewportUi.ShowViewportUiElement(m_buttonGroup->GetViewportUiElementId());
|
||||
|
||||
EXPECT_TRUE(viewportUi.IsViewportUiElementVisible(m_cluster->GetViewportUiElementId()));
|
||||
EXPECT_TRUE(viewportUi.IsViewportUiElementVisible(m_buttonGroup->GetViewportUiElementId()));
|
||||
}
|
||||
|
||||
TEST_F(ViewportUiDisplayTestFixture, HideViewportUiElementSetsWidgetVisibilityToFalse)
|
||||
@@ -102,20 +102,20 @@ namespace UnitTest
|
||||
|
||||
ViewportUiDisplay viewportUi(m_parentWidget, m_mockRenderOverlay);
|
||||
viewportUi.InitializeUiOverlay();
|
||||
viewportUi.AddCluster(m_cluster);
|
||||
viewportUi.HideViewportUiElement(m_cluster->GetViewportUiElementId());
|
||||
viewportUi.AddCluster(m_buttonGroup);
|
||||
viewportUi.HideViewportUiElement(m_buttonGroup->GetViewportUiElementId());
|
||||
|
||||
EXPECT_FALSE(viewportUi.IsViewportUiElementVisible(m_cluster->GetViewportUiElementId()));
|
||||
EXPECT_FALSE(viewportUi.IsViewportUiElementVisible(m_buttonGroup->GetViewportUiElementId()));
|
||||
}
|
||||
|
||||
TEST_F(ViewportUiDisplayTestFixture, UpdateUiOverlayGeometryChangesGeometryToMatchViewportUiElements)
|
||||
{
|
||||
ViewportUiDisplay viewportUi(m_parentWidget, m_mockRenderOverlay);
|
||||
viewportUi.InitializeUiOverlay();
|
||||
viewportUi.AddCluster(m_cluster);
|
||||
viewportUi.AddCluster(m_buttonGroup);
|
||||
|
||||
viewportUi.Update();
|
||||
auto widget = viewportUi.GetViewportUiElement(m_cluster->GetViewportUiElementId());
|
||||
auto widget = viewportUi.GetViewportUiElement(m_buttonGroup->GetViewportUiElementId());
|
||||
|
||||
EXPECT_EQ(viewportUi.GetUiMainWindow()->mask(), widget->geometry());
|
||||
}
|
||||
@@ -127,14 +127,14 @@ namespace UnitTest
|
||||
ViewportUiDisplay viewportUi(m_parentWidget, m_mockRenderOverlay);
|
||||
viewportUi.InitializeUiOverlay();
|
||||
|
||||
auto cluster = AZStd::make_shared<Cluster>();
|
||||
cluster->AddButton("");
|
||||
viewportUi.AddCluster(cluster);
|
||||
auto buttonGroup = AZStd::make_shared<ButtonGroup>();
|
||||
buttonGroup->AddButton("");
|
||||
viewportUi.AddCluster(buttonGroup);
|
||||
viewportUi.Update();
|
||||
|
||||
EXPECT_TRUE(viewportUi.GetUiMainWindow()->isVisible());
|
||||
|
||||
viewportUi.RemoveViewportUiElement(cluster->GetViewportUiElementId());
|
||||
viewportUi.RemoveViewportUiElement(buttonGroup->GetViewportUiElementId());
|
||||
viewportUi.Update();
|
||||
EXPECT_FALSE(viewportUi.GetUiMainWindow()->isVisible());
|
||||
}
|
||||
|
||||
@@ -22,19 +22,19 @@ namespace UnitTest
|
||||
{
|
||||
using ViewportUiDisplay = AzToolsFramework::ViewportUi::Internal::ViewportUiDisplay;
|
||||
using ViewportUiElementId = AzToolsFramework::ViewportUi::ViewportUiElementId;
|
||||
using Cluster = AzToolsFramework::ViewportUi::Internal::Cluster;
|
||||
using ButtonGroup = AzToolsFramework::ViewportUi::Internal::ButtonGroup;
|
||||
using ButtonId = AzToolsFramework::ViewportUi::ButtonId;
|
||||
|
||||
// child class of ViewportUiManager which exposes the protected cluster and viewport display
|
||||
// child class of ViewportUiManager which exposes the protected button group and viewport display
|
||||
class ViewportUiManagerTestable : public AzToolsFramework::ViewportUi::ViewportUiManager
|
||||
{
|
||||
public:
|
||||
ViewportUiManagerTestable() = default;
|
||||
~ViewportUiManagerTestable() = default;
|
||||
|
||||
const AZStd::unordered_map<AzToolsFramework::ViewportUi::ClusterId, AZStd::shared_ptr<Cluster>>& GetClusterMap()
|
||||
const AZStd::unordered_map<AzToolsFramework::ViewportUi::ClusterId, AZStd::shared_ptr<ButtonGroup>>& GetClusterMap()
|
||||
{
|
||||
return m_clusters;
|
||||
return m_clusterButtonGroups;
|
||||
}
|
||||
|
||||
ViewportUiDisplay* GetViewportUiDisplay()
|
||||
|
||||
Reference in New Issue
Block a user