Merge branch 'main' into Helios_DataDrivenAssetImporter
This commit is contained in:
@@ -297,20 +297,28 @@ namespace AssetProcessor
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectRegistry(registry, platform, specialization, &scratchBuffer);
|
||||
|
||||
// Merge the Project User and User home settings registry only in non-release builds
|
||||
constexpr bool executeRegDumpCommands = false;
|
||||
AZ::CommandLine* commandLine{};
|
||||
AZ::ComponentApplicationBus::Broadcast([®istry, &commandLine](AZ::ComponentApplicationRequests* appRequests)
|
||||
{
|
||||
commandLine = appRequests->GetAzCommandLine();
|
||||
});
|
||||
|
||||
if (!specialization.Contains("release"))
|
||||
{
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(registry, platform, specialization, &scratchBuffer);
|
||||
if (commandLine)
|
||||
{
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(registry, *commandLine, executeRegDumpCommands);
|
||||
}
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectUserRegistry(registry, platform, specialization, &scratchBuffer);
|
||||
}
|
||||
|
||||
AZ::ComponentApplicationBus::Broadcast([®istry](AZ::ComponentApplicationRequests* appRequests)
|
||||
if (commandLine)
|
||||
{
|
||||
if (AZ::CommandLine* commandLine = appRequests->GetAzCommandLine(); commandLine != nullptr)
|
||||
{
|
||||
constexpr bool executeRegDumpCommands = false;
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(registry, *commandLine, executeRegDumpCommands);
|
||||
}
|
||||
});
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(registry, *commandLine, executeRegDumpCommands);
|
||||
}
|
||||
|
||||
|
||||
if (registry.Visit(exporter, ""))
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ add_subdirectory(AssetProcessor)
|
||||
add_subdirectory(AWSNativeSDKInit)
|
||||
add_subdirectory(AzTestRunner)
|
||||
add_subdirectory(CrashHandler)
|
||||
add_subdirectory(CryCommonTools)
|
||||
add_subdirectory(News)
|
||||
add_subdirectory(PythonBindingsExample)
|
||||
add_subdirectory(RemoteConsole)
|
||||
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
if (NOT PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
ly_add_target(
|
||||
NAME CryCommonTools STATIC
|
||||
NAMESPACE Legacy
|
||||
FILES_CMAKE
|
||||
crycommontools_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
.
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzCore
|
||||
PUBLIC
|
||||
Legacy::CryCommon
|
||||
AZ::AzFramework
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,224 +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.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMONTOOLS_STRINGHELPERS_H
|
||||
#define CRYINCLUDE_CRYCOMMONTOOLS_STRINGHELPERS_H
|
||||
#pragma once
|
||||
|
||||
#include <CryString.h>
|
||||
|
||||
namespace StringHelpers
|
||||
{
|
||||
// compares two strings to see if they are the same or different, case sensitive
|
||||
// returns 0 if the strings are the same, a -1 if the first string is bigger, or a 1 if the second string is bigger
|
||||
int Compare(const string& str0, const string& str1);
|
||||
int Compare(const wstring& str0, const wstring& str1);
|
||||
|
||||
// compares two strings to see if they are the same or different, case is ignored
|
||||
// returns 0 if the strings are the same, a -1 if the first string is bigger, or a 1 if the second string is bigger
|
||||
int CompareIgnoreCase(const string& str0, const string& str1);
|
||||
int CompareIgnoreCase(const wstring& str0, const wstring& str1);
|
||||
|
||||
// compares two strings to see if they are the same, case senstive
|
||||
// returns true if they are the same or false if they are different
|
||||
bool Equals(const string& str0, const string& str1);
|
||||
bool Equals(const wstring& str0, const wstring& str1);
|
||||
|
||||
// compares two strings to see if they are the same, case is ignored
|
||||
// returns true if they are the same or false if they are different
|
||||
bool EqualsIgnoreCase(const string& str0, const string& str1);
|
||||
bool EqualsIgnoreCase(const wstring& str0, const wstring& str1);
|
||||
|
||||
// checks to see if a string starts with a specified string, case sensitive
|
||||
// returns true if the string does start with a specified string or false if it does not
|
||||
bool StartsWith(const string& str, const string& pattern);
|
||||
bool StartsWith(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string starts with a specified string, case is ignored
|
||||
// returns true if the string does start with a specified string or false if it does not
|
||||
bool StartsWithIgnoreCase(const string& str, const string& pattern);
|
||||
bool StartsWithIgnoreCase(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string ends with a specified string, case sensitive
|
||||
// returns true if the string does end with a specified string or false if it does not
|
||||
bool EndsWith(const string& str, const string& pattern);
|
||||
bool EndsWith(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string ends with a specified string, case is ignored
|
||||
// returns true if the string does end with a specified string or false if it does not
|
||||
bool EndsWithIgnoreCase(const string& str, const string& pattern);
|
||||
bool EndsWithIgnoreCase(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string contains a specified string, case sensitive
|
||||
// returns true if the string does contain the specified string or false if it does not
|
||||
bool Contains(const string& str, const string& pattern);
|
||||
bool Contains(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string contains a specified string, case is ignored
|
||||
// returns true if the string does contain the specified string or false if it does not
|
||||
bool ContainsIgnoreCase(const string& str, const string& pattern);
|
||||
bool ContainsIgnoreCase(const wstring& str, const wstring& pattern);
|
||||
|
||||
// checks to see if a string contains a wildcard string pattern, case sensitive
|
||||
// returns true if the string does match the wildcard string pattern or false if it does not
|
||||
bool MatchesWildcards(const string& str, const string& wildcards);
|
||||
bool MatchesWildcards(const wstring& str, const wstring& wildcards);
|
||||
|
||||
// checks to see if a string contains a wildcard string pattern, case is ignored
|
||||
// returns true if the string does match the wildcard string pattern or false if it does not
|
||||
bool MatchesWildcardsIgnoreCase(const string& str, const string& wildcards);
|
||||
bool MatchesWildcardsIgnoreCase(const wstring& str, const wstring& wildcards);
|
||||
|
||||
bool MatchesWildcardsIgnoreCaseExt(const string& str, const string& wildcards, std::vector<string>& wildcardMatches);
|
||||
bool MatchesWildcardsIgnoreCaseExt(const wstring& str, const wstring& wildcards, std::vector<wstring>& wildcardMatches);
|
||||
|
||||
string TrimLeft(const string& s);
|
||||
wstring TrimLeft(const wstring& s);
|
||||
|
||||
string TrimRight(const string& s);
|
||||
wstring TrimRight(const wstring& s);
|
||||
|
||||
string Trim(const string& s);
|
||||
wstring Trim(const wstring& s);
|
||||
|
||||
string RemoveDuplicateSpaces(const string& s);
|
||||
wstring RemoveDuplicateSpaces(const wstring& s);
|
||||
|
||||
// converts a string with upper case characters to be all lower case
|
||||
// returns the string in all lower case
|
||||
string MakeLowerCase(const string& s);
|
||||
wstring MakeLowerCase(const wstring& s);
|
||||
|
||||
// converts a string with lower case characters to be all upper case
|
||||
// returns the string in all upper case
|
||||
string MakeUpperCase(const string& s);
|
||||
wstring MakeUpperCase(const wstring& s);
|
||||
|
||||
// replace a specified character in a string with a specified replacement character
|
||||
// returns string with specified character replaced
|
||||
string Replace(const string& s, char oldChar, char newChar);
|
||||
wstring Replace(const wstring& s, wchar_t oldChar, wchar_t newChar);
|
||||
|
||||
void ConvertStringByRef(string& out, const string& in);
|
||||
void ConvertStringByRef(wstring& out, const string& in);
|
||||
void ConvertStringByRef(string& out, const wstring& in);
|
||||
void ConvertStringByRef(wstring& out, const wstring& in);
|
||||
|
||||
template <typename O, typename I>
|
||||
O ConvertString(const I& in)
|
||||
{
|
||||
O out;
|
||||
ConvertStringByRef(out, in);
|
||||
return out;
|
||||
}
|
||||
|
||||
void Split(const string& str, const string& separator, bool bReturnEmptyPartsToo, std::vector<string>& outParts);
|
||||
void Split(const wstring& str, const wstring& separator, bool bReturnEmptyPartsToo, std::vector<wstring>& outParts);
|
||||
|
||||
void SplitByAnyOf(const string& str, const string& separators, bool bReturnEmptyPartsToo, std::vector<string>& outParts);
|
||||
void SplitByAnyOf(const wstring& str, const wstring& separators, bool bReturnEmptyPartsToo, std::vector<wstring>& outParts);
|
||||
|
||||
string FormatVA(const char* const format, va_list parg);
|
||||
wstring FormatVA(const wchar_t* const format, va_list parg);
|
||||
|
||||
inline string Format(const char* const format, ...)
|
||||
{
|
||||
if ((format == 0) || (format[0] == 0))
|
||||
{
|
||||
return string();
|
||||
}
|
||||
va_list parg;
|
||||
va_start(parg, format);
|
||||
const string result = FormatVA(format, parg);
|
||||
va_end(parg);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline wstring Format(const wchar_t* const format, ...)
|
||||
{
|
||||
if ((format == 0) || (format[0] == 0))
|
||||
{
|
||||
return wstring();
|
||||
}
|
||||
va_list parg;
|
||||
va_start(parg, format);
|
||||
const wstring result = FormatVA(format, parg);
|
||||
va_end(parg);
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SafeCopy(char* const pDstBuffer, const size_t dstBufferSizeInBytes, const char* const pSrc);
|
||||
void SafeCopy(wchar_t* const pDstBuffer, const size_t dstBufferSizeInBytes, const wchar_t* const pSrc);
|
||||
|
||||
void SafeCopyPadZeros(char* const pDstBuffer, const size_t dstBufferSizeInBytes, const char* const pSrc);
|
||||
void SafeCopyPadZeros(wchar_t* const pDstBuffer, const size_t dstBufferSizeInBytes, const wchar_t* const pSrc);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ASCII
|
||||
// ANSI (system default Windows ANSI code page)
|
||||
// UTF-8
|
||||
// UTF-16
|
||||
|
||||
// ASCII -> UTF-16
|
||||
|
||||
bool Utf16ContainsAsciiOnly(const wchar_t* wstr);
|
||||
string ConvertAsciiUtf16ToAscii(const wchar_t* wstr);
|
||||
wstring ConvertAsciiToUtf16(const char* str);
|
||||
|
||||
// UTF-8 <-> UTF-16
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
wstring ConvertUtf8ToUtf16(const char* str);
|
||||
string ConvertUtf16ToUtf8(const wchar_t* wstr);
|
||||
|
||||
inline string ConvertUtfToUtf8(const char* str)
|
||||
{
|
||||
return string(str);
|
||||
}
|
||||
|
||||
inline string ConvertUtfToUtf8(const wchar_t* wstr)
|
||||
{
|
||||
return ConvertUtf16ToUtf8(wstr);
|
||||
}
|
||||
|
||||
inline wstring ConvertUtfToUtf16(const char* str)
|
||||
{
|
||||
return ConvertUtf8ToUtf16(str);
|
||||
}
|
||||
|
||||
inline wstring ConvertUtfToUtf16(const wchar_t* wstr)
|
||||
{
|
||||
return wstring(wstr);
|
||||
}
|
||||
|
||||
// ANSI <-> UTF-8, UTF-16
|
||||
|
||||
wstring ConvertAnsiToUtf16(const char* str);
|
||||
string ConvertUtf16ToAnsi(const wchar_t* wstr, char badChar);
|
||||
|
||||
inline string ConvertAnsiToUtf8(const char* str)
|
||||
{
|
||||
return ConvertUtf16ToUtf8(ConvertAnsiToUtf16(str).c_str());
|
||||
}
|
||||
inline string ConvertUtf8ToAnsi(const char* str, char badChar)
|
||||
{
|
||||
return ConvertUtf16ToAnsi(ConvertUtf8ToUtf16(str).c_str(), badChar);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ANSI -> ASCII
|
||||
string ConvertAnsiToAscii(const char* str, char badChar);
|
||||
}
|
||||
#endif // CRYINCLUDE_CRYCOMMONTOOLS_STRINGHELPERS_H
|
||||
@@ -1,202 +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.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMONTOOLS_UTIL_H
|
||||
#define CRYINCLUDE_CRYCOMMONTOOLS_UTIL_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <cstring> // memset()
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(x) (1 << (x))
|
||||
#endif
|
||||
|
||||
|
||||
union IntOrPtr
|
||||
{
|
||||
int m_int;
|
||||
unsigned int m_uint;
|
||||
void* m_pVoid;
|
||||
char* m_pChar;
|
||||
|
||||
void setZero()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
}
|
||||
|
||||
bool operator==(const IntOrPtr& a) const
|
||||
{
|
||||
return memcmp(this, &a, sizeof(*this)) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const IntOrPtr& a) const
|
||||
{
|
||||
return memcmp(this, &a, sizeof(*this)) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace Util
|
||||
{
|
||||
// note: names 'getMin' and 'getMax' (instead of usual 'min' and 'max') are
|
||||
// used to avoid conflicts with global and/or user's #define of 'min' and 'max'
|
||||
|
||||
template<class T>
|
||||
inline const T& getMin(const T& a, const T& b)
|
||||
{
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline const T& getMax(const T& a, const T& b)
|
||||
{
|
||||
return (a < b) ? b : a;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline const T& getMin(const T& a, const T& b, const T& c)
|
||||
{
|
||||
return (a < b)
|
||||
? ((a < c) ? a : c)
|
||||
: ((b < c) ? b : c);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline const T& getMax(const T& a, const T& b, const T& c)
|
||||
{
|
||||
return (a < b)
|
||||
? ((b < c) ? c : b)
|
||||
: ((a < c) ? c : a);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& getClamped(const T& a, const T& a_min, const T& a_max)
|
||||
{
|
||||
if (a < a_min)
|
||||
{
|
||||
return a_min;
|
||||
}
|
||||
if (a_max < a)
|
||||
{
|
||||
return a_max;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
// note: name 'clampMinMax' (instead of usual 'clamp') is used
|
||||
// to avoid conflicts with global and/or user's #define of 'clamp'
|
||||
template<class T>
|
||||
inline void clampMinMax(T& a, const T& a_min, const T& a_max)
|
||||
{
|
||||
if (a < a_min)
|
||||
{
|
||||
a = a_min;
|
||||
}
|
||||
else if (a_max < a)
|
||||
{
|
||||
a = a_max;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void clampMin(T& a, const T& a_min)
|
||||
{
|
||||
if (a < a_min)
|
||||
{
|
||||
a = a_min;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void clampMax(T& a, const T& a_max)
|
||||
{
|
||||
if (a_max < a)
|
||||
{
|
||||
a = a_max;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class TInteger>
|
||||
inline bool isPowerOfTwo(TInteger x)
|
||||
{
|
||||
return (x & (x - 1)) == 0;
|
||||
}
|
||||
|
||||
|
||||
template <class TInteger>
|
||||
inline TInteger getCeiledPowerOfTwo(TInteger x)
|
||||
{
|
||||
x = x - 1;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4293)
|
||||
if (sizeof(TInteger) > 0)
|
||||
{
|
||||
x |= x >> 1;
|
||||
}
|
||||
if (sizeof(TInteger) > 0)
|
||||
{
|
||||
x |= x >> 2;
|
||||
}
|
||||
if (sizeof(TInteger) > 0)
|
||||
{
|
||||
x |= x >> 4;
|
||||
}
|
||||
if (sizeof(TInteger) > 1)
|
||||
{
|
||||
x |= x >> 8;
|
||||
}
|
||||
if (sizeof(TInteger) > 2)
|
||||
{
|
||||
x |= x >> 16;
|
||||
}
|
||||
if (sizeof(TInteger) > 4)
|
||||
{
|
||||
x |= x >> 32;
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
|
||||
template <class TInteger>
|
||||
inline TInteger getFlooredPowerOfTwo(TInteger x)
|
||||
{
|
||||
if (!isPowerOfTwo(x))
|
||||
{
|
||||
x = getCeiledPowerOfTwo(x) >> 1;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline T square(T x)
|
||||
{
|
||||
return x * x;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline T cube(T x)
|
||||
{
|
||||
return x * x * x;
|
||||
}
|
||||
} // namespace Util
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMONTOOLS_UTIL_H
|
||||
@@ -1,15 +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.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
StringHelpers.cpp
|
||||
StringHelpers.h
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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 "EngineInfo.h"
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
EngineInfo::EngineInfo(const QString& path)
|
||||
: m_path(path)
|
||||
{
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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 <QString>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class EngineInfo
|
||||
{
|
||||
public:
|
||||
EngineInfo() = default;
|
||||
EngineInfo(const QString& path);
|
||||
|
||||
QString m_path;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
+6
-11
@@ -10,26 +10,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <EngineSettings.h>
|
||||
#include <EngineSettingsScreen.h>
|
||||
|
||||
#include <Source/ui_EngineSettings.h>
|
||||
#include <Source/ui_EngineSettingsScreen.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
EngineSettings::EngineSettings(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
EngineSettingsScreen::EngineSettingsScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
, m_ui(new Ui::EngineSettingsClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
EngineSettings::~EngineSettings()
|
||||
ProjectManagerScreen EngineSettingsScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::EngineSettings;
|
||||
}
|
||||
|
||||
void EngineSettings::ConnectSlotsAndSignals()
|
||||
{
|
||||
// Do nothing for now
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
+4
-6
@@ -22,15 +22,13 @@ namespace Ui
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class EngineSettings
|
||||
class EngineSettingsScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
public:
|
||||
explicit EngineSettings(ProjectManagerWindow* window);
|
||||
~EngineSettings();
|
||||
|
||||
protected:
|
||||
void ConnectSlotsAndSignals() override;
|
||||
explicit EngineSettingsScreen(QWidget* parent = nullptr);
|
||||
~EngineSettingsScreen() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::EngineSettingsClass> m_ui;
|
||||
@@ -1,47 +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 <FirstTimeUse.h>
|
||||
|
||||
#include <Source/ui_FirstTimeUse.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
FirstTimeUse::FirstTimeUse(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
, m_ui(new Ui::FirstTimeUseClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
ConnectSlotsAndSignals();
|
||||
}
|
||||
|
||||
FirstTimeUse::~FirstTimeUse()
|
||||
{
|
||||
}
|
||||
|
||||
void FirstTimeUse::ConnectSlotsAndSignals()
|
||||
{
|
||||
QObject::connect(m_ui->createProjectButton, &QPushButton::pressed, this, &FirstTimeUse::HandleNewProjectButton);
|
||||
QObject::connect(m_ui->openProjectButton, &QPushButton::pressed, this, &FirstTimeUse::HandleOpenProjectButton);
|
||||
}
|
||||
|
||||
void FirstTimeUse::HandleNewProjectButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
|
||||
}
|
||||
void FirstTimeUse::HandleOpenProjectButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <FirstTimeUseScreen.h>
|
||||
|
||||
#include <Source/ui_FirstTimeUseScreen.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
FirstTimeUseScreen::FirstTimeUseScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
, m_ui(new Ui::FirstTimeUseClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->createProjectButton, &QPushButton::pressed, this, &FirstTimeUseScreen::HandleNewProjectButton);
|
||||
connect(m_ui->openProjectButton, &QPushButton::pressed, this, &FirstTimeUseScreen::HandleOpenProjectButton);
|
||||
}
|
||||
|
||||
ProjectManagerScreen FirstTimeUseScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::FirstTimeUse;
|
||||
}
|
||||
|
||||
void FirstTimeUseScreen::HandleNewProjectButton()
|
||||
{
|
||||
emit ResetScreenRequest(ProjectManagerScreen::NewProjectSettingsCore);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::NewProjectSettingsCore);
|
||||
}
|
||||
void FirstTimeUseScreen::HandleOpenProjectButton()
|
||||
{
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
+4
-6
@@ -22,15 +22,13 @@ namespace Ui
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class FirstTimeUse
|
||||
class FirstTimeUseScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
public:
|
||||
explicit FirstTimeUse(ProjectManagerWindow* window);
|
||||
~FirstTimeUse();
|
||||
|
||||
protected:
|
||||
void ConnectSlotsAndSignals() override;
|
||||
explicit FirstTimeUseScreen(QWidget* parent = nullptr);
|
||||
~FirstTimeUseScreen() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
|
||||
protected slots:
|
||||
void HandleNewProjectButton();
|
||||
@@ -1,101 +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 <GemCatalog/GemCatalog.h>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemCatalog::GemCatalog(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
{
|
||||
m_gemModel = new GemModel(this);
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
setLayout(vLayout);
|
||||
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
vLayout->addLayout(hLayout);
|
||||
|
||||
QWidget* filterPlaceholderWidget = new QWidget();
|
||||
filterPlaceholderWidget->setFixedWidth(250);
|
||||
hLayout->addWidget(filterPlaceholderWidget);
|
||||
|
||||
m_gemListView = new GemListView(m_gemModel, this);
|
||||
hLayout->addWidget(m_gemListView);
|
||||
|
||||
QWidget* inspectorPlaceholderWidget = new QWidget();
|
||||
inspectorPlaceholderWidget->setFixedWidth(250);
|
||||
hLayout->addWidget(inspectorPlaceholderWidget);
|
||||
|
||||
// Temporary back and next buttons until they are centralized and shared.
|
||||
QDialogButtonBox* backNextButtons = new QDialogButtonBox();
|
||||
vLayout->addWidget(backNextButtons);
|
||||
|
||||
QPushButton* tempBackButton = backNextButtons->addButton("Back", QDialogButtonBox::RejectRole);
|
||||
QPushButton* tempNextButton = backNextButtons->addButton("Next", QDialogButtonBox::AcceptRole);
|
||||
connect(tempBackButton, &QPushButton::pressed, this, &GemCatalog::HandleBackButton);
|
||||
connect(tempNextButton, &QPushButton::pressed, this, &GemCatalog::HandleConfirmButton);
|
||||
|
||||
// Start: Temporary gem test data
|
||||
{
|
||||
m_gemModel->AddGem(GemInfo("EMotion FX",
|
||||
"O3DE Foundation",
|
||||
"EMFX is a real-time character animation system. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
(GemInfo::Android | GemInfo::iOS | GemInfo::macOS | GemInfo::Windows | GemInfo::Linux),
|
||||
true));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Atom",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux | GemInfo::macOS,
|
||||
true));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("PhysX",
|
||||
"O3DE London",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Android | GemInfo::Linux | GemInfo::macOS,
|
||||
false));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Certificate Manager",
|
||||
"O3DE Irvine",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Windows,
|
||||
false));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Cloud Gem Framework",
|
||||
"O3DE Seattle",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::iOS | GemInfo::Linux,
|
||||
false));
|
||||
|
||||
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Achievements",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
|
||||
false));
|
||||
}
|
||||
// End: Temporary gem test data
|
||||
}
|
||||
|
||||
void GemCatalog::HandleBackButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
|
||||
}
|
||||
void GemCatalog::HandleConfirmButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* 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 <GemCatalog/GemCatalogScreen.h>
|
||||
#include <PythonBindingsInterface.h>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
//#define USE_TESTGEMDATA
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemCatalogScreen::GemCatalogScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
m_gemModel = new GemModel(this);
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->setMargin(0);
|
||||
setLayout(vLayout);
|
||||
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
vLayout->addLayout(hLayout);
|
||||
|
||||
m_gemListView = new GemListView(m_gemModel, this);
|
||||
m_gemInspector = new GemInspector(m_gemModel, this);
|
||||
m_gemInspector->setFixedWidth(320);
|
||||
|
||||
// Start: Temporary gem test data
|
||||
#ifdef USE_TESTGEMDATA
|
||||
QVector<GemInfo> testGemData = GenerateTestData();
|
||||
for (const GemInfo& gemInfo : testGemData)
|
||||
{
|
||||
m_gemModel->AddGem(gemInfo);
|
||||
}
|
||||
#else
|
||||
// End: Temporary gem test data
|
||||
auto result = PythonBindingsInterface::Get()->GetGems();
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
for (auto gemInfo : result.GetValue())
|
||||
{
|
||||
m_gemModel->AddGem(gemInfo);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
hLayout->addWidget(m_gemListView);
|
||||
hLayout->addWidget(m_gemInspector);
|
||||
|
||||
|
||||
// Select the first entry after everything got correctly sized
|
||||
QTimer::singleShot(100, [=]{
|
||||
QModelIndex firstModelIndex = m_gemListView->model()->index(0,0);
|
||||
m_gemListView->selectionModel()->select(firstModelIndex, QItemSelectionModel::ClearAndSelect);
|
||||
});
|
||||
}
|
||||
|
||||
QVector<GemInfo> GemCatalogScreen::GenerateTestData()
|
||||
{
|
||||
QVector<GemInfo> result;
|
||||
|
||||
GemInfo gem("EMotion FX",
|
||||
"O3DE Foundation",
|
||||
"EMFX is a real-time character animation system. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
(GemInfo::Android | GemInfo::iOS | GemInfo::macOS | GemInfo::Windows | GemInfo::Linux),
|
||||
true);
|
||||
gem.m_directoryLink = "C:/";
|
||||
gem.m_documentationLink = "http://www.amazon.com";
|
||||
gem.m_dependingGemUuids = QStringList({"EMotionFX", "Atom"});
|
||||
gem.m_conflictingGemUuids = QStringList({"Vegetation", "Camera", "ScriptCanvas", "CloudCanvas", "Networking"});
|
||||
gem.m_version = "v1.01";
|
||||
gem.m_lastUpdatedDate = "24th April 2021";
|
||||
gem.m_binarySizeInKB = 40;
|
||||
gem.m_features = QStringList({"Animation", "Assets", "Physics"});
|
||||
result.push_back(gem);
|
||||
|
||||
gem.m_name = "Atom";
|
||||
gem.m_creator = "O3DE Seattle";
|
||||
gem.m_summary = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
|
||||
gem.m_platforms = (GemInfo::Android | GemInfo::Windows | GemInfo::Linux | GemInfo::macOS);
|
||||
gem.m_isAdded = true;
|
||||
gem.m_directoryLink = "C:/";
|
||||
gem.m_documentationLink = "https://aws.amazon.com/gametech/";
|
||||
gem.m_dependingGemUuids = QStringList({"EMotionFX", "Core", "AudioSystem", "Camera", "Particles"});
|
||||
gem.m_conflictingGemUuids = QStringList({"CloudCanvas", "NovaNet"});
|
||||
gem.m_version = "v2.31";
|
||||
gem.m_lastUpdatedDate = "24th November 2020";
|
||||
gem.m_features = QStringList({"Assets", "Rendering", "UI", "VR", "Debug", "Environment"});
|
||||
gem.m_binarySizeInKB = 2087;
|
||||
result.push_back(gem);
|
||||
|
||||
gem.m_name = "Physics";
|
||||
gem.m_creator = "O3DE London";
|
||||
gem.m_summary = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
|
||||
gem.m_platforms = (GemInfo::Android | GemInfo::Linux | GemInfo::macOS);
|
||||
gem.m_isAdded = true;
|
||||
gem.m_directoryLink = "C:/";
|
||||
gem.m_documentationLink = "https://aws.amazon.com/gametech/";
|
||||
gem.m_dependingGemUuids = QStringList({"GraphCanvas", "ExpressionEvaluation", "UI Lib", "Multiplayer", "GameStateSamples"});
|
||||
gem.m_conflictingGemUuids = QStringList({"Cloud Canvas", "EMotion FX", "Streaming", "MessagePopup", "Cloth", "Graph Canvas", "Twitch Integration"});
|
||||
gem.m_version = "v1.5.102145";
|
||||
gem.m_lastUpdatedDate = "1st January 2021";
|
||||
gem.m_binarySizeInKB = 2000000;
|
||||
gem.m_features = QStringList({"Physics", "Gameplay", "Debug", "Assets"});
|
||||
result.push_back(gem);
|
||||
|
||||
result.push_back(O3DE::ProjectManager::GemInfo("Certificate Manager",
|
||||
"O3DE Irvine",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::Windows,
|
||||
false));
|
||||
|
||||
result.push_back(O3DE::ProjectManager::GemInfo("Cloud Gem Framework",
|
||||
"O3DE Seattle",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
GemInfo::iOS | GemInfo::Linux,
|
||||
false));
|
||||
|
||||
result.push_back(O3DE::ProjectManager::GemInfo("Cloud Gem Core",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
|
||||
true));
|
||||
|
||||
result.push_back(O3DE::ProjectManager::GemInfo("Gestures",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
|
||||
false));
|
||||
|
||||
result.push_back(O3DE::ProjectManager::GemInfo("Effects System",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
|
||||
true));
|
||||
|
||||
result.push_back(O3DE::ProjectManager::GemInfo("Microphone",
|
||||
"O3DE Foundation",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus euismod ligula vitae dui dictum, a sodales dolor luctus. Sed id elit dapibus, finibus neque sed, efficitur mi. Nam facilisis ligula at eleifend pellentesque. Praesent non ex consectetur, blandit tellus in, venenatis lacus. Duis nec neque in urna ullamcorper euismod id eu leo. Nam efficitur dolor sed odio vehicula venenatis. Suspendisse nec est non velit commodo cursus in sit amet dui. Ut bibendum nisl et libero hendrerit dapibus. Vestibulum ultrices ullamcorper urna, placerat porttitor est lobortis in. Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer a magna ac tellus sollicitudin porttitor. Phasellus lobortis viverra justo id bibendum. Etiam ac pharetra risus. Nulla vitae justo nibh. Nulla viverra leo et molestie interdum. Duis sit amet bibendum nulla, sit amet vehicula augue.",
|
||||
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
|
||||
false));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ProjectManagerScreen GemCatalogScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::GemCatalog;
|
||||
}
|
||||
|
||||
QString GemCatalogScreen::GetNextButtonText()
|
||||
{
|
||||
return "Create Project";
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
+9
-7
@@ -14,24 +14,26 @@
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <ScreenWidget.h>
|
||||
#include <GemCatalog/GemListView.h>
|
||||
#include <GemCatalog/GemInspector.h>
|
||||
#include <GemCatalog/GemModel.h>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemCatalog
|
||||
class GemCatalogScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
public:
|
||||
explicit GemCatalog(ProjectManagerWindow* window);
|
||||
~GemCatalog() = default;
|
||||
|
||||
protected slots:
|
||||
void HandleBackButton();
|
||||
void HandleConfirmButton();
|
||||
explicit GemCatalogScreen(QWidget* parent = nullptr);
|
||||
~GemCatalogScreen() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
QString GetNextButtonText() override;
|
||||
|
||||
private:
|
||||
QVector<GemInfo> GenerateTestData();
|
||||
|
||||
GemListView* m_gemListView = nullptr;
|
||||
GemInspector* m_gemInspector = nullptr;
|
||||
GemModel* m_gemModel = nullptr;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -22,4 +22,33 @@ namespace O3DE::ProjectManager
|
||||
, m_isAdded(isAdded)
|
||||
{
|
||||
}
|
||||
|
||||
bool GemInfo::IsValid() const
|
||||
{
|
||||
return !m_path.isEmpty() && !m_uuid.IsNull();
|
||||
}
|
||||
|
||||
QString GemInfo::GetPlatformString(Platform platform)
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case O3DE::ProjectManager::GemInfo::Android:
|
||||
return "Android";
|
||||
case O3DE::ProjectManager::GemInfo::iOS:
|
||||
return "iOS";
|
||||
case O3DE::ProjectManager::GemInfo::Linux:
|
||||
return "Linux";
|
||||
case O3DE::ProjectManager::GemInfo::macOS:
|
||||
return "macOS";
|
||||
case O3DE::ProjectManager::GemInfo::Windows:
|
||||
return "Windows";
|
||||
default:
|
||||
return "<Unknown Platform>";
|
||||
}
|
||||
}
|
||||
|
||||
bool GemInfo::IsPlatformSupported(Platform platform) const
|
||||
{
|
||||
return (m_platforms & platform);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -34,8 +34,13 @@ namespace O3DE::ProjectManager
|
||||
NumPlatforms = 5
|
||||
};
|
||||
Q_DECLARE_FLAGS(Platforms, Platform)
|
||||
static QString GetPlatformString(Platform platform);
|
||||
|
||||
GemInfo() = default;
|
||||
GemInfo(const QString& name, const QString& creator, const QString& summary, Platforms platforms, bool isAdded);
|
||||
bool IsPlatformSupported(Platform platform) const;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
QString m_path;
|
||||
QString m_name;
|
||||
@@ -46,11 +51,13 @@ namespace O3DE::ProjectManager
|
||||
QString m_summary;
|
||||
Platforms m_platforms;
|
||||
QStringList m_features;
|
||||
QString m_directoryLink;
|
||||
QString m_documentationLink;
|
||||
QString m_version;
|
||||
QString m_lastUpdatedDate;
|
||||
QString m_documentationUrl;
|
||||
QVector<AZ::Uuid> m_dependingGemUuids;
|
||||
QVector<AZ::Uuid> m_conflictingGemUuids;
|
||||
int m_binarySizeInKB = 0;
|
||||
QStringList m_dependingGemUuids;
|
||||
QStringList m_conflictingGemUuids;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* 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 <GemCatalog/GemInspector.h>
|
||||
#include <GemCatalog/GemItemDelegate.h>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QSpacerItem>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemInspector::GemInspector(GemModel* model, QWidget* parent)
|
||||
: QScrollArea(parent)
|
||||
, m_model(model)
|
||||
{
|
||||
setWidgetResizable(true);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
||||
m_mainWidget = new QWidget();
|
||||
setWidget(m_mainWidget);
|
||||
|
||||
m_mainLayout = new QVBoxLayout();
|
||||
m_mainLayout->setMargin(15);
|
||||
m_mainLayout->setAlignment(Qt::AlignTop);
|
||||
m_mainWidget->setLayout(m_mainLayout);
|
||||
|
||||
InitMainWidget();
|
||||
|
||||
connect(m_model->GetSelectionModel(), &QItemSelectionModel::selectionChanged, this, &GemInspector::OnSelectionChanged);
|
||||
Update({});
|
||||
}
|
||||
|
||||
void GemInspector::OnSelectionChanged(const QItemSelection& selected, [[maybe_unused]] const QItemSelection& deselected)
|
||||
{
|
||||
const QModelIndexList selectedIndices = selected.indexes();
|
||||
if (selectedIndices.empty())
|
||||
{
|
||||
Update({});
|
||||
return;
|
||||
}
|
||||
|
||||
Update(selectedIndices[0]);
|
||||
}
|
||||
|
||||
void GemInspector::Update(const QModelIndex& modelIndex)
|
||||
{
|
||||
if (!modelIndex.isValid())
|
||||
{
|
||||
m_mainWidget->hide();
|
||||
}
|
||||
|
||||
m_nameLabel->setText(m_model->GetName(modelIndex));
|
||||
m_creatorLabel->setText(m_model->GetCreator(modelIndex));
|
||||
|
||||
m_summaryLabel->setText(m_model->GetSummary(modelIndex));
|
||||
m_summaryLabel->adjustSize();
|
||||
|
||||
m_directoryLinkLabel->SetUrl(m_model->GetDirectoryLink(modelIndex));
|
||||
m_documentationLinkLabel->SetUrl(m_model->GetDocLink(modelIndex));
|
||||
|
||||
// Depending and conflicting gems
|
||||
m_dependingGems->Update("Depending Gems", "The following Gems will be automatically enabled with this Gem.", m_model->GetDependingGems(modelIndex));
|
||||
m_conflictingGems->Update("Conflicting Gems", "The following Gems will be automatically disabled with this Gem.", m_model->GetConflictingGems(modelIndex));
|
||||
|
||||
// Additional information
|
||||
m_versionLabel->setText(QString("Gem Version: %1").arg(m_model->GetVersion(modelIndex)));
|
||||
m_lastUpdatedLabel->setText(QString("Last Updated: %1").arg(m_model->GetLastUpdated(modelIndex)));
|
||||
m_binarySizeLabel->setText(QString("Binary Size: %1 KB").arg(QString::number(m_model->GetBinarySizeInKB(modelIndex))));
|
||||
|
||||
m_mainWidget->adjustSize();
|
||||
m_mainWidget->show();
|
||||
}
|
||||
|
||||
QLabel* GemInspector::CreateStyledLabel(QLayout* layout, int fontSize, const QString& colorCodeString)
|
||||
{
|
||||
QLabel* result = new QLabel();
|
||||
result->setStyleSheet(QString("font-size: %1pt; color: %2;").arg(QString::number(fontSize), colorCodeString));
|
||||
layout->addWidget(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void GemInspector::InitMainWidget()
|
||||
{
|
||||
// Gem name, creator and summary
|
||||
m_nameLabel = CreateStyledLabel(m_mainLayout, 17, s_headerColor);
|
||||
m_creatorLabel = CreateStyledLabel(m_mainLayout, 12, s_creatorColor);
|
||||
m_mainLayout->addSpacing(5);
|
||||
|
||||
// TODO: QLabel seems to have issues determining the right sizeHint() for our font with the given font size.
|
||||
// This results into squeezed elements in the layout in case the text is a little longer than a sentence.
|
||||
m_summaryLabel = new QLabel();//CreateLabel(m_mainLayout, 12, s_textColor);
|
||||
m_mainLayout->addWidget(m_summaryLabel);
|
||||
m_summaryLabel->setWordWrap(true);
|
||||
m_mainLayout->addSpacing(5);
|
||||
|
||||
// Directory and documentation links
|
||||
{
|
||||
QHBoxLayout* linksHLayout = new QHBoxLayout();
|
||||
linksHLayout->setMargin(0);
|
||||
m_mainLayout->addLayout(linksHLayout);
|
||||
|
||||
QSpacerItem* spacerLeft = new QSpacerItem(0, 0, QSizePolicy::Expanding);
|
||||
linksHLayout->addSpacerItem(spacerLeft);
|
||||
|
||||
m_directoryLinkLabel = new LinkLabel("View in Directory");
|
||||
linksHLayout->addWidget(m_directoryLinkLabel);
|
||||
linksHLayout->addWidget(new QLabel("|"));
|
||||
m_documentationLinkLabel = new LinkLabel("Read Documentation");
|
||||
linksHLayout->addWidget(m_documentationLinkLabel);
|
||||
|
||||
QSpacerItem* spacerRight = new QSpacerItem(0, 0, QSizePolicy::Expanding);
|
||||
linksHLayout->addSpacerItem(spacerRight);
|
||||
|
||||
m_mainLayout->addSpacing(8);
|
||||
}
|
||||
|
||||
// Separating line
|
||||
QFrame* hLine = new QFrame();
|
||||
hLine->setFrameShape(QFrame::HLine);
|
||||
hLine->setStyleSheet("color: #666666;");
|
||||
m_mainLayout->addWidget(hLine);
|
||||
|
||||
m_mainLayout->addSpacing(10);
|
||||
|
||||
// Depending and conflicting gems
|
||||
m_dependingGems = new GemsSubWidget();
|
||||
m_mainLayout->addWidget(m_dependingGems);
|
||||
m_mainLayout->addSpacing(20);
|
||||
|
||||
m_conflictingGems = new GemsSubWidget();
|
||||
m_mainLayout->addWidget(m_conflictingGems);
|
||||
m_mainLayout->addSpacing(20);
|
||||
|
||||
// Additional information
|
||||
QLabel* additionalInfoLabel = CreateStyledLabel(m_mainLayout, 14, s_headerColor);
|
||||
additionalInfoLabel->setText("Additional Information");
|
||||
|
||||
m_versionLabel = CreateStyledLabel(m_mainLayout, 11, s_textColor);
|
||||
m_lastUpdatedLabel = CreateStyledLabel(m_mainLayout, 11, s_textColor);
|
||||
m_binarySizeLabel = CreateStyledLabel(m_mainLayout, 11, s_textColor);
|
||||
}
|
||||
|
||||
GemInspector::GemsSubWidget::GemsSubWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_layout = new QVBoxLayout();
|
||||
m_layout->setAlignment(Qt::AlignTop);
|
||||
m_layout->setMargin(0);
|
||||
setLayout(m_layout);
|
||||
|
||||
m_titleLabel = GemInspector::CreateStyledLabel(m_layout, 15, s_headerColor);
|
||||
m_textLabel = GemInspector::CreateStyledLabel(m_layout, 9, s_textColor);
|
||||
m_textLabel->setWordWrap(true);
|
||||
|
||||
m_tagWidget = new TagContainerWidget();
|
||||
m_layout->addWidget(m_tagWidget);
|
||||
}
|
||||
|
||||
void GemInspector::GemsSubWidget::Update(const QString& title, const QString& text, const QStringList& gemNames)
|
||||
{
|
||||
m_titleLabel->setText(title);
|
||||
m_textLabel->setText(text);
|
||||
m_tagWidget->Update(gemNames);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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 <LinkWidget.h>
|
||||
#include <TagWidget.h>
|
||||
#include <GemCatalog/GemInfo.h>
|
||||
#include <GemCatalog/GemModel.h>
|
||||
#include <QItemSelection>
|
||||
#include <QScrollArea>
|
||||
#include <QWidget>
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemInspector
|
||||
: public QScrollArea
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
|
||||
public:
|
||||
explicit GemInspector(GemModel* model, QWidget* parent = nullptr);
|
||||
~GemInspector() = default;
|
||||
|
||||
void Update(const QModelIndex& modelIndex);
|
||||
static QLabel* CreateStyledLabel(QLayout* layout, int fontSize, const QString& colorCodeString);
|
||||
|
||||
// Colors
|
||||
inline constexpr static const char* s_headerColor = "#FFFFFF";
|
||||
inline constexpr static const char* s_textColor = "#DDDDDD";
|
||||
inline constexpr static const char* s_creatorColor = "#94D2FF";
|
||||
|
||||
private slots:
|
||||
void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
|
||||
private:
|
||||
// Title, description and tag widget container used for the depending and conflicting gems
|
||||
class GemsSubWidget
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
GemsSubWidget(QWidget* parent = nullptr);
|
||||
void Update(const QString& title, const QString& text, const QStringList& gemNames);
|
||||
|
||||
private:
|
||||
QLabel* m_titleLabel = nullptr;
|
||||
QLabel* m_textLabel = nullptr;
|
||||
QVBoxLayout* m_layout = nullptr;
|
||||
TagContainerWidget* m_tagWidget = nullptr;
|
||||
};
|
||||
|
||||
void InitMainWidget();
|
||||
|
||||
GemModel* m_model = nullptr;
|
||||
QWidget* m_mainWidget = nullptr;
|
||||
QVBoxLayout* m_mainLayout = nullptr;
|
||||
|
||||
// General info (top) section
|
||||
QLabel* m_nameLabel = nullptr;
|
||||
QLabel* m_creatorLabel = nullptr;
|
||||
QLabel* m_summaryLabel = nullptr;
|
||||
LinkLabel* m_directoryLinkLabel = nullptr;
|
||||
LinkLabel* m_documentationLinkLabel = nullptr;
|
||||
|
||||
// Depending and conflicting gems
|
||||
GemsSubWidget* m_dependingGems = nullptr;
|
||||
GemsSubWidget* m_conflictingGems = nullptr;
|
||||
|
||||
// Additional information
|
||||
QLabel* m_versionLabel = nullptr;
|
||||
QLabel* m_lastUpdatedLabel = nullptr;
|
||||
QLabel* m_binarySizeLabel = nullptr;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -37,6 +37,16 @@ namespace O3DE::ProjectManager
|
||||
item->setData(gemInfo.m_summary, RoleSummary);
|
||||
item->setData(gemInfo.m_isAdded, RoleIsAdded);
|
||||
|
||||
item->setData(gemInfo.m_directoryLink, RoleDirectoryLink);
|
||||
item->setData(gemInfo.m_documentationLink, RoleDocLink);
|
||||
item->setData(gemInfo.m_dependingGemUuids, RoleDependingGems);
|
||||
item->setData(gemInfo.m_conflictingGemUuids, RoleConflictingGems);
|
||||
item->setData(gemInfo.m_version, RoleVersion);
|
||||
item->setData(gemInfo.m_lastUpdatedDate, RoleLastUpdated);
|
||||
item->setData(gemInfo.m_binarySizeInKB, RoleBinarySize);
|
||||
|
||||
item->setData(gemInfo.m_features, RoleFeatures);
|
||||
|
||||
appendRow(item);
|
||||
}
|
||||
|
||||
@@ -45,28 +55,68 @@ namespace O3DE::ProjectManager
|
||||
clear();
|
||||
}
|
||||
|
||||
QString GemModel::GetName(const QModelIndex& modelIndex) const
|
||||
QString GemModel::GetName(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleName).toString();
|
||||
}
|
||||
|
||||
QString GemModel::GetCreator(const QModelIndex& modelIndex) const
|
||||
QString GemModel::GetCreator(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleCreator).toString();
|
||||
}
|
||||
|
||||
GemInfo::Platforms GemModel::GetPlatforms(const QModelIndex& modelIndex) const
|
||||
GemInfo::Platforms GemModel::GetPlatforms(const QModelIndex& modelIndex)
|
||||
{
|
||||
return static_cast<GemInfo::Platforms>(modelIndex.data(RolePlatforms).toInt());
|
||||
}
|
||||
|
||||
QString GemModel::GetSummary(const QModelIndex& modelIndex) const
|
||||
QString GemModel::GetSummary(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleSummary).toString();
|
||||
}
|
||||
|
||||
bool GemModel::IsAdded(const QModelIndex& modelIndex) const
|
||||
bool GemModel::IsAdded(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleIsAdded).toBool();
|
||||
}
|
||||
|
||||
QString GemModel::GetDirectoryLink(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleDirectoryLink).toString();
|
||||
}
|
||||
|
||||
QString GemModel::GetDocLink(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleDocLink).toString();
|
||||
}
|
||||
|
||||
QStringList GemModel::GetDependingGems(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleDependingGems).toStringList();
|
||||
}
|
||||
|
||||
QStringList GemModel::GetConflictingGems(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleConflictingGems).toStringList();
|
||||
}
|
||||
|
||||
QString GemModel::GetVersion(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleVersion).toString();
|
||||
}
|
||||
|
||||
QString GemModel::GetLastUpdated(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleLastUpdated).toString();
|
||||
}
|
||||
|
||||
int GemModel::GetBinarySizeInKB(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleBinarySize).toInt();
|
||||
}
|
||||
|
||||
QStringList GemModel::GetFeatures(const QModelIndex& modelIndex)
|
||||
{
|
||||
return modelIndex.data(RoleFeatures).toStringList();
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "GemInfo.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QItemSelectionModel>
|
||||
#endif
|
||||
@@ -32,11 +33,19 @@ namespace O3DE::ProjectManager
|
||||
void AddGem(const GemInfo& gemInfo);
|
||||
void Clear();
|
||||
|
||||
QString GetName(const QModelIndex& modelIndex) const;
|
||||
QString GetCreator(const QModelIndex& modelIndex) const;
|
||||
GemInfo::Platforms GetPlatforms(const QModelIndex& modelIndex) const;
|
||||
QString GetSummary(const QModelIndex& modelIndex) const;
|
||||
bool IsAdded(const QModelIndex& modelIndex) const;
|
||||
static QString GetName(const QModelIndex& modelIndex);
|
||||
static QString GetCreator(const QModelIndex& modelIndex);
|
||||
static GemInfo::Platforms GetPlatforms(const QModelIndex& modelIndex);
|
||||
static QString GetSummary(const QModelIndex& modelIndex);
|
||||
static bool IsAdded(const QModelIndex& modelIndex);
|
||||
static QString GetDirectoryLink(const QModelIndex& modelIndex);
|
||||
static QString GetDocLink(const QModelIndex& modelIndex);
|
||||
static QStringList GetDependingGems(const QModelIndex& modelIndex);
|
||||
static QStringList GetConflictingGems(const QModelIndex& modelIndex);
|
||||
static QString GetVersion(const QModelIndex& modelIndex);
|
||||
static QString GetLastUpdated(const QModelIndex& modelIndex);
|
||||
static int GetBinarySizeInKB(const QModelIndex& modelIndex);
|
||||
static QStringList GetFeatures(const QModelIndex& modelIndex);
|
||||
|
||||
private:
|
||||
enum UserRole
|
||||
@@ -45,7 +54,15 @@ namespace O3DE::ProjectManager
|
||||
RoleCreator,
|
||||
RolePlatforms,
|
||||
RoleSummary,
|
||||
RoleIsAdded
|
||||
RoleIsAdded,
|
||||
RoleDirectoryLink,
|
||||
RoleDocLink,
|
||||
RoleDependingGems,
|
||||
RoleConflictingGems,
|
||||
RoleVersion,
|
||||
RoleLastUpdated,
|
||||
RoleBinarySize,
|
||||
RoleFeatures,
|
||||
};
|
||||
|
||||
QItemSelectionModel* m_selectionModel = nullptr;
|
||||
|
||||
@@ -1,47 +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 <NewProjectSettings.h>
|
||||
|
||||
#include <Source/ui_NewProjectSettings.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
NewProjectSettings::NewProjectSettings(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
, m_ui(new Ui::NewProjectSettingsClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
ConnectSlotsAndSignals();
|
||||
}
|
||||
|
||||
NewProjectSettings::~NewProjectSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void NewProjectSettings::ConnectSlotsAndSignals()
|
||||
{
|
||||
QObject::connect(m_ui->backButton, &QPushButton::pressed, this, &NewProjectSettings::HandleBackButton);
|
||||
QObject::connect(m_ui->nextButton, &QPushButton::pressed, this, &NewProjectSettings::HandleNextButton);
|
||||
}
|
||||
|
||||
void NewProjectSettings::HandleBackButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::FirstTimeUse);
|
||||
}
|
||||
void NewProjectSettings::HandleNextButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::GemCatalog);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NewProjectSettingsClass</class>
|
||||
<widget class="QWidget" name="NewProjectSettingsClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>880</width>
|
||||
<height>546</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="projectNameLabel">
|
||||
<property name="text">
|
||||
<string>Project Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="projectNameLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="projectPathLabel">
|
||||
<property name="text">
|
||||
<string>Project Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="projectPathLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="projectTemplateLabel">
|
||||
<property name="text">
|
||||
<string>Project Template</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="projectTemplateStandardRadioButton">
|
||||
<property name="text">
|
||||
<string>Standard (Recommened)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="projectTemplateStandardEmptyButton">
|
||||
<property name="text">
|
||||
<string>Empty</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="backButton">
|
||||
<property name="text">
|
||||
<string>Back</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="nextButton">
|
||||
<property name="text">
|
||||
<string>Next</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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 <NewProjectSettingsScreen.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QRadioButton>
|
||||
#include <QSpacerItem>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
NewProjectSettingsScreen::NewProjectSettingsScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
this->setLayout(hLayout);
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout(this);
|
||||
|
||||
QLabel* projectNameLabel = new QLabel(this);
|
||||
projectNameLabel->setText("Project Name");
|
||||
vLayout->addWidget(projectNameLabel);
|
||||
|
||||
QLineEdit* projectNameLineEdit = new QLineEdit(this);
|
||||
vLayout->addWidget(projectNameLineEdit);
|
||||
|
||||
QLabel* projectPathLabel = new QLabel(this);
|
||||
projectPathLabel->setText("Project Location");
|
||||
vLayout->addWidget(projectPathLabel);
|
||||
|
||||
QLineEdit* projectPathLineEdit = new QLineEdit(this);
|
||||
vLayout->addWidget(projectPathLineEdit);
|
||||
|
||||
QLabel* projectTemplateLabel = new QLabel(this);
|
||||
projectTemplateLabel->setText("Project Template");
|
||||
vLayout->addWidget(projectTemplateLabel);
|
||||
|
||||
QHBoxLayout* templateLayout = new QHBoxLayout(this);
|
||||
vLayout->addItem(templateLayout);
|
||||
|
||||
QRadioButton* projectTemplateStandardRadioButton = new QRadioButton(this);
|
||||
projectTemplateStandardRadioButton->setText("Standard (Recommened)");
|
||||
projectTemplateStandardRadioButton->setChecked(true);
|
||||
templateLayout->addWidget(projectTemplateStandardRadioButton);
|
||||
|
||||
QRadioButton* projectTemplateEmptyRadioButton = new QRadioButton(this);
|
||||
projectTemplateEmptyRadioButton->setText("Empty");
|
||||
templateLayout->addWidget(projectTemplateEmptyRadioButton);
|
||||
|
||||
QSpacerItem* verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
vLayout->addItem(verticalSpacer);
|
||||
|
||||
hLayout->addItem(vLayout);
|
||||
|
||||
QWidget* gemsListPlaceholder = new QWidget(this);
|
||||
gemsListPlaceholder->setFixedWidth(250);
|
||||
hLayout->addWidget(gemsListPlaceholder);
|
||||
}
|
||||
|
||||
ProjectManagerScreen NewProjectSettingsScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::NewProjectSettings;
|
||||
}
|
||||
|
||||
QString NewProjectSettingsScreen::GetNextButtonText()
|
||||
{
|
||||
return "Create Project";
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <ScreenWidget.h>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class NewProjectSettingsScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
public:
|
||||
explicit NewProjectSettingsScreen(QWidget* parent = nullptr);
|
||||
~NewProjectSettingsScreen() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
QString GetNextButtonText() override;
|
||||
};
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -14,11 +14,20 @@
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectInfo::ProjectInfo(const QString& path, const QString& projectName, const QString& productName, const AZ::Uuid projectId)
|
||||
ProjectInfo::ProjectInfo(const QString& path, const QString& projectName, const QString& productName, const AZ::Uuid projectId,
|
||||
const QString& imagePath, const QString& backgroundImagePath, bool isNew)
|
||||
: m_path(path)
|
||||
, m_projectName(projectName)
|
||||
, m_productName(productName)
|
||||
, m_projectId(projectId)
|
||||
, m_imagePath(imagePath)
|
||||
, m_backgroundImagePath(backgroundImagePath)
|
||||
, m_isNew(isNew)
|
||||
{
|
||||
}
|
||||
|
||||
bool ProjectInfo::IsValid() const
|
||||
{
|
||||
return !m_path.isEmpty() && !m_projectId.IsNull();
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -23,14 +23,24 @@ namespace O3DE::ProjectManager
|
||||
{
|
||||
public:
|
||||
ProjectInfo() = default;
|
||||
ProjectInfo(const QString& path, const QString& projectName, const QString& productName, const AZ::Uuid projectId);
|
||||
ProjectInfo(const QString& path, const QString& projectName, const QString& productName, const AZ::Uuid projectId,
|
||||
const QString& imagePath, const QString& backgroundImagePath, bool isNew);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
// from o3de_manifest.json and o3de_projects.json
|
||||
QString m_path;
|
||||
|
||||
// from project.json
|
||||
// From project.json
|
||||
QString m_projectName;
|
||||
QString m_productName;
|
||||
AZ::Uuid m_projectId;
|
||||
|
||||
// Used on projects home screen
|
||||
QString m_imagePath;
|
||||
QString m_backgroundImagePath;
|
||||
|
||||
// Used in project creation
|
||||
bool m_isNew = false; //! Is this a new project or existing
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -30,7 +30,11 @@ namespace O3DE::ProjectManager
|
||||
|
||||
m_pythonBindings = AZStd::make_unique<PythonBindings>(engineRootPath);
|
||||
|
||||
ConnectSlotsAndSignals();
|
||||
m_screensCtrl = new ScreensCtrl();
|
||||
m_ui->verticalLayout->addWidget(m_screensCtrl);
|
||||
|
||||
connect(m_ui->projectsMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleProjectsMenu);
|
||||
connect(m_ui->engineMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleEngineMenu);
|
||||
|
||||
QDir rootDir = QString::fromUtf8(engineRootPath.Native().data(), aznumeric_cast<int>(engineRootPath.Native().size()));
|
||||
const auto pathOnDisk = rootDir.absoluteFilePath("Code/Tools/ProjectManager/Resources");
|
||||
@@ -39,9 +43,16 @@ namespace O3DE::ProjectManager
|
||||
|
||||
AzQtComponents::StyleManager::setStyleSheet(this, QStringLiteral("projectlauncherwindow:ProjectManagerWindow.qss"));
|
||||
|
||||
BuildScreens();
|
||||
|
||||
ChangeToScreen(ProjectManagerScreen::FirstTimeUse);
|
||||
QVector<ProjectManagerScreen> screenEnums =
|
||||
{
|
||||
ProjectManagerScreen::FirstTimeUse,
|
||||
ProjectManagerScreen::NewProjectSettingsCore,
|
||||
ProjectManagerScreen::ProjectsHome,
|
||||
ProjectManagerScreen::ProjectSettings,
|
||||
ProjectManagerScreen::EngineSettings
|
||||
};
|
||||
m_screensCtrl->BuildScreens(screenEnums);
|
||||
m_screensCtrl->ForceChangeToScreen(ProjectManagerScreen::FirstTimeUse, false);
|
||||
}
|
||||
|
||||
ProjectManagerWindow::~ProjectManagerWindow()
|
||||
@@ -49,61 +60,13 @@ namespace O3DE::ProjectManager
|
||||
m_pythonBindings.reset();
|
||||
}
|
||||
|
||||
void ProjectManagerWindow::BuildScreens()
|
||||
{
|
||||
// Basically just iterate over the ProjectManagerScreen enum creating each screen
|
||||
// Could add some fancy to do this but there are few screens right now
|
||||
|
||||
ResetScreen(ProjectManagerScreen::FirstTimeUse);
|
||||
ResetScreen(ProjectManagerScreen::NewProjectSettings);
|
||||
ResetScreen(ProjectManagerScreen::GemCatalog);
|
||||
ResetScreen(ProjectManagerScreen::ProjectsHome);
|
||||
ResetScreen(ProjectManagerScreen::ProjectSettings);
|
||||
ResetScreen(ProjectManagerScreen::EngineSettings);
|
||||
}
|
||||
|
||||
QStackedWidget* ProjectManagerWindow::GetScreenStack()
|
||||
{
|
||||
return m_ui->stackedScreens;
|
||||
}
|
||||
|
||||
void ProjectManagerWindow::ChangeToScreen(ProjectManagerScreen screen)
|
||||
{
|
||||
int index = aznumeric_cast<int, ProjectManagerScreen>(screen);
|
||||
m_ui->stackedScreens->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void ProjectManagerWindow::ResetScreen(ProjectManagerScreen screen)
|
||||
{
|
||||
int index = aznumeric_cast<int, ProjectManagerScreen>(screen);
|
||||
|
||||
// Fine the old screen if it exists and get rid of it so we can start fresh
|
||||
QWidget* oldScreen = m_ui->stackedScreens->widget(index);
|
||||
|
||||
if (oldScreen)
|
||||
{
|
||||
m_ui->stackedScreens->removeWidget(oldScreen);
|
||||
oldScreen->deleteLater();
|
||||
}
|
||||
|
||||
// Add new screen
|
||||
QWidget* newScreen = BuildScreen(this, screen);
|
||||
m_ui->stackedScreens->insertWidget(index, newScreen);
|
||||
}
|
||||
|
||||
void ProjectManagerWindow::ConnectSlotsAndSignals()
|
||||
{
|
||||
QObject::connect(m_ui->projectsMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleProjectsMenu);
|
||||
QObject::connect(m_ui->engineMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleEngineMenu);
|
||||
}
|
||||
|
||||
void ProjectManagerWindow::HandleProjectsMenu()
|
||||
{
|
||||
ChangeToScreen(ProjectManagerScreen::ProjectsHome);
|
||||
m_screensCtrl->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
void ProjectManagerWindow::HandleEngineMenu()
|
||||
{
|
||||
ChangeToScreen(ProjectManagerScreen::EngineSettings);
|
||||
m_screensCtrl->ChangeToScreen(ProjectManagerScreen::EngineSettings);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <ScreenDefs.h>
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QStackedWidget>
|
||||
|
||||
#include <ScreensCtrl.h>
|
||||
|
||||
#include <PythonBindings.h>
|
||||
#endif
|
||||
@@ -36,22 +35,13 @@ namespace O3DE::ProjectManager
|
||||
explicit ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath);
|
||||
~ProjectManagerWindow();
|
||||
|
||||
void BuildScreens();
|
||||
QStackedWidget* GetScreenStack();
|
||||
|
||||
public slots:
|
||||
void ChangeToScreen(ProjectManagerScreen screen);
|
||||
void ResetScreen(ProjectManagerScreen screen);
|
||||
|
||||
protected:
|
||||
void ConnectSlotsAndSignals();
|
||||
|
||||
protected slots:
|
||||
void HandleProjectsMenu();
|
||||
void HandleEngineMenu();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::ProjectManagerWindowClass> m_ui;
|
||||
ScreensCtrl* m_screensCtrl;
|
||||
AZStd::unique_ptr<PythonBindings> m_pythonBindings;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
<string>O3DE Project Manager</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedScreens"/>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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 <ProjectSettingsCtrl.h>
|
||||
#include <ScreensCtrl.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectSettingsCtrl::ProjectSettingsCtrl(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
setLayout(vLayout);
|
||||
|
||||
m_screensCtrl = new ScreensCtrl();
|
||||
vLayout->addWidget(m_screensCtrl);
|
||||
|
||||
QDialogButtonBox* backNextButtons = new QDialogButtonBox();
|
||||
vLayout->addWidget(backNextButtons);
|
||||
|
||||
m_backButton = backNextButtons->addButton("Back", QDialogButtonBox::RejectRole);
|
||||
m_nextButton = backNextButtons->addButton("Next", QDialogButtonBox::ApplyRole);
|
||||
|
||||
connect(m_backButton, &QPushButton::pressed, this, &ProjectSettingsCtrl::HandleBackButton);
|
||||
connect(m_nextButton, &QPushButton::pressed, this, &ProjectSettingsCtrl::HandleNextButton);
|
||||
|
||||
m_screensOrder =
|
||||
{
|
||||
ProjectManagerScreen::NewProjectSettings,
|
||||
ProjectManagerScreen::GemCatalog
|
||||
};
|
||||
m_screensCtrl->BuildScreens(m_screensOrder);
|
||||
m_screensCtrl->ForceChangeToScreen(ProjectManagerScreen::NewProjectSettings, false);
|
||||
UpdateNextButtonText();
|
||||
}
|
||||
|
||||
ProjectManagerScreen ProjectSettingsCtrl::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::NewProjectSettingsCore;
|
||||
}
|
||||
|
||||
void ProjectSettingsCtrl::HandleBackButton()
|
||||
{
|
||||
if (!m_screensCtrl->GotoPreviousScreen())
|
||||
{
|
||||
emit GotoPreviousScreenRequest();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateNextButtonText();
|
||||
}
|
||||
}
|
||||
void ProjectSettingsCtrl::HandleNextButton()
|
||||
{
|
||||
ProjectManagerScreen screenEnum = m_screensCtrl->GetCurrentScreen()->GetScreenEnum();
|
||||
auto screenOrderIter = m_screensOrder.begin();
|
||||
for (; screenOrderIter != m_screensOrder.end(); ++screenOrderIter)
|
||||
{
|
||||
if (*screenOrderIter == screenEnum)
|
||||
{
|
||||
++screenOrderIter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (screenOrderIter != m_screensOrder.end())
|
||||
{
|
||||
m_screensCtrl->ChangeToScreen(*screenOrderIter);
|
||||
UpdateNextButtonText();
|
||||
}
|
||||
else
|
||||
{
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::ProjectsHome);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSettingsCtrl::UpdateNextButtonText()
|
||||
{
|
||||
m_nextButton->setText(m_screensCtrl->GetCurrentScreen()->GetNextButtonText());
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
+14
-12
@@ -13,31 +13,33 @@
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <ScreenWidget.h>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class NewProjectSettingsClass;
|
||||
}
|
||||
#include <ScreensCtrl.h>
|
||||
|
||||
#include <QPushButton>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class NewProjectSettings
|
||||
class ProjectSettingsCtrl
|
||||
: public ScreenWidget
|
||||
{
|
||||
public:
|
||||
explicit NewProjectSettings(ProjectManagerWindow* window);
|
||||
~NewProjectSettings();
|
||||
|
||||
protected:
|
||||
void ConnectSlotsAndSignals() override;
|
||||
explicit ProjectSettingsCtrl(QWidget* parent = nullptr);
|
||||
~ProjectSettingsCtrl() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
|
||||
protected slots:
|
||||
void HandleBackButton();
|
||||
void HandleNextButton();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::NewProjectSettingsClass> m_ui;
|
||||
void UpdateNextButtonText();
|
||||
|
||||
ScreensCtrl* m_screensCtrl;
|
||||
QPushButton* m_backButton;
|
||||
QPushButton* m_nextButton;
|
||||
QVector<ProjectManagerScreen> m_screensOrder;
|
||||
};
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
+9
-13
@@ -10,33 +10,29 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ProjectSettings.h>
|
||||
#include <ProjectSettingsScreen.h>
|
||||
|
||||
#include <Source/ui_ProjectSettings.h>
|
||||
#include <Source/ui_ProjectSettingsScreen.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectSettings::ProjectSettings(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
ProjectSettingsScreen::ProjectSettingsScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
, m_ui(new Ui::ProjectSettingsClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
ConnectSlotsAndSignals();
|
||||
connect(m_ui->gemsButton, &QPushButton::pressed, this, &ProjectSettingsScreen::HandleGemsButton);
|
||||
}
|
||||
|
||||
ProjectSettings::~ProjectSettings()
|
||||
ProjectManagerScreen ProjectSettingsScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::ProjectSettings;
|
||||
}
|
||||
|
||||
void ProjectSettings::ConnectSlotsAndSignals()
|
||||
void ProjectSettingsScreen::HandleGemsButton()
|
||||
{
|
||||
QObject::connect(m_ui->gemsButton, &QPushButton::pressed, this, &ProjectSettings::HandleGemsButton);
|
||||
}
|
||||
|
||||
void ProjectSettings::HandleGemsButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::GemCatalog);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::GemCatalog);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
+4
-6
@@ -22,15 +22,13 @@ namespace Ui
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class ProjectSettings
|
||||
class ProjectSettingsScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
public:
|
||||
explicit ProjectSettings(ProjectManagerWindow* window);
|
||||
~ProjectSettings();
|
||||
|
||||
protected:
|
||||
void ConnectSlotsAndSignals() override;
|
||||
explicit ProjectSettingsScreen(QWidget* parent = nullptr);
|
||||
~ProjectSettingsScreen() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
|
||||
protected slots:
|
||||
void HandleGemsButton();
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 "ProjectTemplateInfo.h"
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectTemplateInfo::ProjectTemplateInfo(const QString& path)
|
||||
: m_path(path)
|
||||
{
|
||||
}
|
||||
|
||||
bool ProjectTemplateInfo::IsValid() const
|
||||
{
|
||||
return !m_path.isEmpty() && !m_name.isEmpty();
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 <QString>
|
||||
#include <QStringList>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class ProjectTemplateInfo
|
||||
{
|
||||
public:
|
||||
ProjectTemplateInfo() = default;
|
||||
ProjectTemplateInfo(const QString& path);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
QString m_displayName;
|
||||
QString m_name;
|
||||
QString m_path;
|
||||
QString m_summary;
|
||||
QStringList m_canonicalTags;
|
||||
QStringList m_userTags;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -1,57 +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 <ProjectsHome.h>
|
||||
|
||||
#include <Source/ui_ProjectsHome.h>
|
||||
|
||||
#include <PythonBindingsInterface.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectsHome::ProjectsHome(ProjectManagerWindow* window)
|
||||
: ScreenWidget(window)
|
||||
, m_ui(new Ui::ProjectsHomeClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
ConnectSlotsAndSignals();
|
||||
|
||||
// example of how to get the current project name
|
||||
ProjectInfo currentProject = PythonBindingsInterface::Get()->GetCurrentProject();
|
||||
}
|
||||
|
||||
ProjectsHome::~ProjectsHome()
|
||||
{
|
||||
}
|
||||
|
||||
void ProjectsHome::ConnectSlotsAndSignals()
|
||||
{
|
||||
QObject::connect(m_ui->newProjectButton, &QPushButton::pressed, this, &ProjectsHome::HandleNewProjectButton);
|
||||
QObject::connect(m_ui->addProjectButton, &QPushButton::pressed, this, &ProjectsHome::HandleAddProjectButton);
|
||||
QObject::connect(m_ui->editProjectButton, &QPushButton::pressed, this, &ProjectsHome::HandleEditProjectButton);
|
||||
}
|
||||
|
||||
void ProjectsHome::HandleNewProjectButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
|
||||
}
|
||||
void ProjectsHome::HandleAddProjectButton()
|
||||
{
|
||||
//Do nothing for now
|
||||
}
|
||||
void ProjectsHome::HandleEditProjectButton()
|
||||
{
|
||||
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectSettings);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ProjectsHomeScreen.h>
|
||||
|
||||
#include <Source/ui_ProjectsHomeScreen.h>
|
||||
|
||||
#include <PythonBindingsInterface.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ProjectsHomeScreen::ProjectsHomeScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
, m_ui(new Ui::ProjectsHomeClass())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->newProjectButton, &QPushButton::pressed, this, &ProjectsHomeScreen::HandleNewProjectButton);
|
||||
connect(m_ui->addProjectButton, &QPushButton::pressed, this, &ProjectsHomeScreen::HandleAddProjectButton);
|
||||
connect(m_ui->editProjectButton, &QPushButton::pressed, this, &ProjectsHomeScreen::HandleEditProjectButton);
|
||||
}
|
||||
|
||||
ProjectManagerScreen ProjectsHomeScreen::GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::ProjectsHome;
|
||||
}
|
||||
|
||||
void ProjectsHomeScreen::HandleNewProjectButton()
|
||||
{
|
||||
emit ResetScreenRequest(ProjectManagerScreen::NewProjectSettingsCore);
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::NewProjectSettingsCore);
|
||||
}
|
||||
void ProjectsHomeScreen::HandleAddProjectButton()
|
||||
{
|
||||
// Do nothing for now
|
||||
}
|
||||
void ProjectsHomeScreen::HandleEditProjectButton()
|
||||
{
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::ProjectSettings);
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
+4
-6
@@ -22,16 +22,14 @@ namespace Ui
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class ProjectsHome
|
||||
class ProjectsHomeScreen
|
||||
: public ScreenWidget
|
||||
{
|
||||
|
||||
public:
|
||||
explicit ProjectsHome(ProjectManagerWindow* window);
|
||||
~ProjectsHome();
|
||||
|
||||
protected:
|
||||
void ConnectSlotsAndSignals() override;
|
||||
explicit ProjectsHomeScreen(QWidget* parent = nullptr);
|
||||
~ProjectsHomeScreen() = default;
|
||||
ProjectManagerScreen GetScreenEnum() override;
|
||||
|
||||
protected slots:
|
||||
void HandleNewProjectButton();
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
#include <PythonBindings.h>
|
||||
|
||||
|
||||
// Qt defines slots, which interferes with the use here.
|
||||
#pragma push_macro("slots")
|
||||
#undef slots
|
||||
#include <Python.h>
|
||||
#include <pybind11/functional.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/embed.h>
|
||||
#include <pybind11/eval.h>
|
||||
#pragma pop_macro("slots")
|
||||
@@ -51,6 +50,9 @@ namespace Platform
|
||||
|
||||
} // namespace Platform
|
||||
|
||||
#define Py_To_String(obj) obj.cast<std::string>().c_str()
|
||||
#define Py_To_String_Optional(dict, key, default_string) dict.contains(key) ? Py_To_String(dict[key]) : default_string
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
PythonBindings::PythonBindings(const AZ::IO::PathView& enginePath)
|
||||
@@ -109,10 +111,13 @@ namespace O3DE::ProjectManager
|
||||
result = PyRun_SimpleString(AZStd::string::format("sys.path.append('%s')", m_enginePath.c_str()).c_str());
|
||||
AZ_Warning("ProjectManagerWindow", result != -1, "Append to sys path failed");
|
||||
|
||||
// import required modules
|
||||
m_registration = pybind11::module::import("cmake.Tools.registration");
|
||||
|
||||
return result == 0 && !PyErr_Occurred();
|
||||
} catch ([[maybe_unused]] const std::exception& e)
|
||||
{
|
||||
AZ_Warning("python", false, "Py_Initialize() failed with %s", e.what());
|
||||
AZ_Warning("ProjectManagerWindow", false, "Py_Initialize() failed with %s", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -125,31 +130,256 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning("python", false, "Did not finalize since Py_IsInitialized() was false");
|
||||
AZ_Warning("ProjectManagerWindow", false, "Did not finalize since Py_IsInitialized() was false");
|
||||
}
|
||||
return !PyErr_Occurred();
|
||||
}
|
||||
|
||||
void PythonBindings::ExecuteWithLock(AZStd::function<void()> executionCallback)
|
||||
bool PythonBindings::ExecuteWithLock(AZStd::function<void()> executionCallback)
|
||||
{
|
||||
AZStd::lock_guard<decltype(m_lock)> lock(m_lock);
|
||||
pybind11::gil_scoped_release release;
|
||||
pybind11::gil_scoped_acquire acquire;
|
||||
executionCallback();
|
||||
|
||||
try
|
||||
{
|
||||
executionCallback();
|
||||
return true;
|
||||
}
|
||||
catch ([[maybe_unused]] const std::exception& e)
|
||||
{
|
||||
AZ_Warning("PythonBindings", false, "Python exception %s", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ProjectInfo PythonBindings::GetCurrentProject()
|
||||
AZ::Outcome<EngineInfo> PythonBindings::GetEngineInfo()
|
||||
{
|
||||
ProjectInfo project;
|
||||
return AZ::Failure();
|
||||
}
|
||||
|
||||
ExecuteWithLock([&] {
|
||||
auto currentProjectTool = pybind11::module::import("cmake.Tools.current_project");
|
||||
auto getCurrentProject = currentProjectTool.attr("get_current_project");
|
||||
auto currentProject = getCurrentProject(m_enginePath.c_str());
|
||||
bool PythonBindings::SetEngineInfo([[maybe_unused]] const EngineInfo& engineInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
project.m_path = currentProject.cast<std::string>().c_str();
|
||||
AZ::Outcome<GemInfo> PythonBindings::GetGem(const QString& path)
|
||||
{
|
||||
GemInfo gemInfo = GemInfoFromPath(pybind11::str(path.toStdString()));
|
||||
if (gemInfo.IsValid())
|
||||
{
|
||||
return AZ::Success(AZStd::move(gemInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
return AZ::Failure();
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Outcome<QVector<GemInfo>> PythonBindings::GetGems()
|
||||
{
|
||||
QVector<GemInfo> gems;
|
||||
|
||||
bool result = ExecuteWithLock([&] {
|
||||
// external gems
|
||||
for (auto path : m_registration.attr("get_gems")())
|
||||
{
|
||||
gems.push_back(GemInfoFromPath(path));
|
||||
}
|
||||
|
||||
// gems from the engine
|
||||
for (auto path : m_registration.attr("get_engine_gems")())
|
||||
{
|
||||
gems.push_back(GemInfoFromPath(path));
|
||||
}
|
||||
});
|
||||
|
||||
return project;
|
||||
if (!result)
|
||||
{
|
||||
return AZ::Failure();
|
||||
}
|
||||
else
|
||||
{
|
||||
return AZ::Success(AZStd::move(gems));
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Outcome<ProjectInfo> PythonBindings::CreateProject([[maybe_unused]] const ProjectTemplateInfo& projectTemplate,[[maybe_unused]] const ProjectInfo& projectInfo)
|
||||
{
|
||||
return AZ::Failure();
|
||||
}
|
||||
|
||||
AZ::Outcome<ProjectInfo> PythonBindings::GetProject(const QString& path)
|
||||
{
|
||||
ProjectInfo projectInfo = ProjectInfoFromPath(pybind11::str(path.toStdString()));
|
||||
if (projectInfo.IsValid())
|
||||
{
|
||||
return AZ::Success(AZStd::move(projectInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
return AZ::Failure();
|
||||
}
|
||||
}
|
||||
|
||||
GemInfo PythonBindings::GemInfoFromPath(pybind11::handle path)
|
||||
{
|
||||
GemInfo gemInfo;
|
||||
gemInfo.m_path = Py_To_String(path);
|
||||
|
||||
auto data = m_registration.attr("get_gem_data")(pybind11::none(), path);
|
||||
if (pybind11::isinstance<pybind11::dict>(data))
|
||||
{
|
||||
try
|
||||
{
|
||||
// required
|
||||
gemInfo.m_name = Py_To_String(data["Name"]);
|
||||
gemInfo.m_uuid = AZ::Uuid(Py_To_String(data["Uuid"]));
|
||||
|
||||
// optional
|
||||
gemInfo.m_displayName = Py_To_String_Optional(data, "DisplayName", gemInfo.m_name);
|
||||
gemInfo.m_summary = Py_To_String_Optional(data, "Summary", "");
|
||||
gemInfo.m_version = Py_To_String_Optional(data, "Version", "");
|
||||
|
||||
if (data.contains("Dependencies"))
|
||||
{
|
||||
for (auto dependency : data["Dependencies"])
|
||||
{
|
||||
gemInfo.m_dependingGemUuids.push_back(Py_To_String(dependency["Uuid"]));
|
||||
}
|
||||
}
|
||||
if (data.contains("Tags"))
|
||||
{
|
||||
for (auto tag : data["Tags"])
|
||||
{
|
||||
gemInfo.m_features.push_back(Py_To_String(tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ([[maybe_unused]] const std::exception& e)
|
||||
{
|
||||
AZ_Warning("PythonBindings", false, "Failed to get GemInfo for gem %s", Py_To_String(path));
|
||||
}
|
||||
}
|
||||
|
||||
return gemInfo;
|
||||
}
|
||||
|
||||
ProjectInfo PythonBindings::ProjectInfoFromPath(pybind11::handle path)
|
||||
{
|
||||
ProjectInfo projectInfo;
|
||||
projectInfo.m_path = Py_To_String(path);
|
||||
|
||||
auto projectData = m_registration.attr("get_project_data")(pybind11::none(), path);
|
||||
if (pybind11::isinstance<pybind11::dict>(projectData))
|
||||
{
|
||||
try
|
||||
{
|
||||
// required fields
|
||||
projectInfo.m_productName = Py_To_String(projectData["product_name"]);
|
||||
projectInfo.m_projectName = Py_To_String(projectData["project_name"]);
|
||||
projectInfo.m_projectId = AZ::Uuid(Py_To_String(projectData["project_id"]));
|
||||
}
|
||||
catch ([[maybe_unused]] const std::exception& e)
|
||||
{
|
||||
AZ_Warning("PythonBindings", false, "Failed to get ProjectInfo for project %s", Py_To_String(path));
|
||||
}
|
||||
}
|
||||
|
||||
return projectInfo;
|
||||
}
|
||||
|
||||
AZ::Outcome<QVector<ProjectInfo>> PythonBindings::GetProjects()
|
||||
{
|
||||
QVector<ProjectInfo> projects;
|
||||
|
||||
bool result = ExecuteWithLock([&] {
|
||||
// external projects
|
||||
for (auto path : m_registration.attr("get_projects")())
|
||||
{
|
||||
projects.push_back(ProjectInfoFromPath(path));
|
||||
}
|
||||
|
||||
// projects from the engine
|
||||
for (auto path : m_registration.attr("get_engine_projects")())
|
||||
{
|
||||
projects.push_back(ProjectInfoFromPath(path));
|
||||
}
|
||||
});
|
||||
|
||||
if (!result)
|
||||
{
|
||||
return AZ::Failure();
|
||||
}
|
||||
else
|
||||
{
|
||||
return AZ::Success(AZStd::move(projects));
|
||||
}
|
||||
}
|
||||
|
||||
bool PythonBindings::UpdateProject([[maybe_unused]] const ProjectInfo& projectInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectTemplateInfo PythonBindings::ProjectTemplateInfoFromPath(pybind11::handle path)
|
||||
{
|
||||
ProjectTemplateInfo templateInfo;
|
||||
templateInfo.m_path = Py_To_String(path);
|
||||
|
||||
auto data = m_registration.attr("get_template_data")(pybind11::none(), path);
|
||||
if (pybind11::isinstance<pybind11::dict>(data))
|
||||
{
|
||||
try
|
||||
{
|
||||
// required
|
||||
templateInfo.m_displayName = Py_To_String(data["display_name"]);
|
||||
templateInfo.m_name = Py_To_String(data["template_name"]);
|
||||
templateInfo.m_summary = Py_To_String(data["summary"]);
|
||||
|
||||
// optional
|
||||
if (data.contains("canonical_tags"))
|
||||
{
|
||||
for (auto tag : data["canonical_tags"])
|
||||
{
|
||||
templateInfo.m_canonicalTags.push_back(Py_To_String(tag));
|
||||
}
|
||||
}
|
||||
if (data.contains("user_tags"))
|
||||
{
|
||||
for (auto tag : data["user_tags"])
|
||||
{
|
||||
templateInfo.m_canonicalTags.push_back(Py_To_String(tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ([[maybe_unused]] const std::exception& e)
|
||||
{
|
||||
AZ_Warning("PythonBindings", false, "Failed to get ProjectTemplateInfo for %s", Py_To_String(path));
|
||||
}
|
||||
}
|
||||
|
||||
return templateInfo;
|
||||
}
|
||||
|
||||
AZ::Outcome<QVector<ProjectTemplateInfo>> PythonBindings::GetProjectTemplates()
|
||||
{
|
||||
QVector<ProjectTemplateInfo> templates;
|
||||
|
||||
bool result = ExecuteWithLock([&] {
|
||||
for (auto path : m_registration.attr("get_project_templates")())
|
||||
{
|
||||
templates.push_back(ProjectTemplateInfoFromPath(path));
|
||||
}
|
||||
});
|
||||
|
||||
if (!result)
|
||||
{
|
||||
return AZ::Failure();
|
||||
}
|
||||
else
|
||||
{
|
||||
return AZ::Success(AZStd::move(templates));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,14 @@
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/std/parallel/semaphore.h>
|
||||
|
||||
// Qt defines slots, which interferes with the use here.
|
||||
#pragma push_macro("slots")
|
||||
#undef slots
|
||||
#include <Python.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#pragma pop_macro("slots")
|
||||
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class PythonBindings
|
||||
@@ -26,16 +34,35 @@ namespace O3DE::ProjectManager
|
||||
~PythonBindings() override;
|
||||
|
||||
// PythonBindings overrides
|
||||
ProjectInfo GetCurrentProject() override;
|
||||
// Engine
|
||||
AZ::Outcome<EngineInfo> GetEngineInfo() override;
|
||||
bool SetEngineInfo(const EngineInfo& engineInfo) override;
|
||||
|
||||
// Gem
|
||||
AZ::Outcome<GemInfo> GetGem(const QString& path) override;
|
||||
AZ::Outcome<QVector<GemInfo>> GetGems() override;
|
||||
|
||||
// Project
|
||||
AZ::Outcome<ProjectInfo> CreateProject(const ProjectTemplateInfo& projectTemplate, const ProjectInfo& projectInfo) override;
|
||||
AZ::Outcome<ProjectInfo> GetProject(const QString& path) override;
|
||||
AZ::Outcome<QVector<ProjectInfo>> GetProjects() override;
|
||||
bool UpdateProject(const ProjectInfo& projectInfo) override;
|
||||
|
||||
// ProjectTemplate
|
||||
AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates() override;
|
||||
|
||||
private:
|
||||
AZ_DISABLE_COPY_MOVE(PythonBindings);
|
||||
|
||||
void ExecuteWithLock(AZStd::function<void()> executionCallback);
|
||||
bool ExecuteWithLock(AZStd::function<void()> executionCallback);
|
||||
GemInfo GemInfoFromPath(pybind11::handle path);
|
||||
ProjectInfo ProjectInfoFromPath(pybind11::handle path);
|
||||
ProjectTemplateInfo ProjectTemplateInfoFromPath(pybind11::handle path);
|
||||
bool StartPython();
|
||||
bool StopPython();
|
||||
|
||||
AZ::IO::FixedMaxPath m_enginePath;
|
||||
AZStd::recursive_mutex m_lock;
|
||||
pybind11::handle m_registration;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
|
||||
#include <EngineInfo.h>
|
||||
#include <GemCatalog/GemInfo.h>
|
||||
#include <ProjectInfo.h>
|
||||
#include <ProjectTemplateInfo.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
@@ -31,8 +34,76 @@ namespace O3DE::ProjectManager
|
||||
IPythonBindings() = default;
|
||||
virtual ~IPythonBindings() = default;
|
||||
|
||||
//! Get the current project
|
||||
virtual ProjectInfo GetCurrentProject() = 0;
|
||||
|
||||
// Engine
|
||||
|
||||
/**
|
||||
* Get info about the engine
|
||||
* @return an outcome with EngineInfo on success
|
||||
*/
|
||||
virtual AZ::Outcome<EngineInfo> GetEngineInfo() = 0;
|
||||
|
||||
/**
|
||||
* Set info about the engine
|
||||
* @param engineInfo an EngineInfo object
|
||||
*/
|
||||
virtual bool SetEngineInfo(const EngineInfo& engineInfo) = 0;
|
||||
|
||||
|
||||
// Gems
|
||||
|
||||
/**
|
||||
* Get info about a Gem
|
||||
* @param path the absolute path to the Gem
|
||||
* @return an outcome with GemInfo on success
|
||||
*/
|
||||
virtual AZ::Outcome<GemInfo> GetGem(const QString& path) = 0;
|
||||
|
||||
/**
|
||||
* Get info about all known Gems
|
||||
* @return an outcome with GemInfos on success
|
||||
*/
|
||||
virtual AZ::Outcome<QVector<GemInfo>> GetGems() = 0;
|
||||
|
||||
|
||||
// Projects
|
||||
|
||||
/**
|
||||
* Create a project
|
||||
* @param projectTemplate the project template to use
|
||||
* @param projectInfo the project info to use
|
||||
* @return an outcome with ProjectInfo on success
|
||||
*/
|
||||
virtual AZ::Outcome<ProjectInfo> CreateProject(const ProjectTemplateInfo& projectTemplate, const ProjectInfo& projectInfo) = 0;
|
||||
|
||||
/**
|
||||
* Get info about a project
|
||||
* @param path the absolute path to the project
|
||||
* @return an outcome with ProjectInfo on success
|
||||
*/
|
||||
virtual AZ::Outcome<ProjectInfo> GetProject(const QString& path) = 0;
|
||||
|
||||
/**
|
||||
* Get info about all known projects
|
||||
* @return an outcome with ProjectInfos on success
|
||||
*/
|
||||
virtual AZ::Outcome<QVector<ProjectInfo>> GetProjects() = 0;
|
||||
|
||||
/**
|
||||
* Update a project
|
||||
* @param projectInfo the info to use to update the project
|
||||
* @return true on success, false on failure
|
||||
*/
|
||||
virtual bool UpdateProject(const ProjectInfo& projectInfo) = 0;
|
||||
|
||||
|
||||
// Project Templates
|
||||
|
||||
/**
|
||||
* Get info about all known project templates
|
||||
* @return an outcome with ProjectTemplateInfos on success
|
||||
*/
|
||||
virtual AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates() = 0;
|
||||
};
|
||||
|
||||
using PythonBindingsInterface = AZ::Interface<IPythonBindings>;
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
enum class ProjectManagerScreen
|
||||
enum ProjectManagerScreen
|
||||
{
|
||||
Invalid = -1,
|
||||
Empty,
|
||||
FirstTimeUse,
|
||||
NewProjectSettingsCore,
|
||||
NewProjectSettings,
|
||||
GemCatalog,
|
||||
ProjectsHome,
|
||||
|
||||
@@ -11,33 +11,48 @@
|
||||
*/
|
||||
#include <ScreenFactory.h>
|
||||
|
||||
#include <FirstTimeUse.h>
|
||||
#include <NewProjectSettings.h>
|
||||
#include <GemCatalog/GemCatalog.h>
|
||||
#include <ProjectsHome.h>
|
||||
#include <ProjectSettings.h>
|
||||
#include <EngineSettings.h>
|
||||
#include <FirstTimeUseScreen.h>
|
||||
#include <ProjectSettingsCtrl.h>
|
||||
#include <NewProjectSettingsScreen.h>
|
||||
#include <GemCatalog/GemCatalogScreen.h>
|
||||
#include <ProjectsHomeScreen.h>
|
||||
#include <ProjectSettingsScreen.h>
|
||||
#include <EngineSettingsScreen.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
QWidget* BuildScreen(ProjectManagerWindow* window, ProjectManagerScreen screen)
|
||||
ScreenWidget* BuildScreen(QWidget* parent, ProjectManagerScreen screen)
|
||||
{
|
||||
ScreenWidget* newScreen;
|
||||
|
||||
switch(screen)
|
||||
{
|
||||
case (ProjectManagerScreen::FirstTimeUse):
|
||||
return new FirstTimeUse(window);
|
||||
newScreen = new FirstTimeUseScreen(parent);
|
||||
break;
|
||||
case (ProjectManagerScreen::NewProjectSettingsCore):
|
||||
newScreen = new ProjectSettingsCtrl(parent);
|
||||
break;
|
||||
case (ProjectManagerScreen::NewProjectSettings):
|
||||
return new NewProjectSettings(window);
|
||||
newScreen = new NewProjectSettingsScreen(parent);
|
||||
break;
|
||||
case (ProjectManagerScreen::GemCatalog):
|
||||
return new GemCatalog(window);
|
||||
newScreen = new GemCatalogScreen(parent);
|
||||
break;
|
||||
case (ProjectManagerScreen::ProjectsHome):
|
||||
return new ProjectsHome(window);
|
||||
newScreen = new ProjectsHomeScreen(parent);
|
||||
break;
|
||||
case (ProjectManagerScreen::ProjectSettings):
|
||||
return new ProjectSettings(window);
|
||||
newScreen = new ProjectSettingsScreen(parent);
|
||||
break;
|
||||
case (ProjectManagerScreen::EngineSettings):
|
||||
return new EngineSettings(window);
|
||||
newScreen = new EngineSettingsScreen(parent);
|
||||
break;
|
||||
case (ProjectManagerScreen::Empty):
|
||||
default:
|
||||
return new QWidget(window->GetScreenStack());
|
||||
newScreen = new ScreenWidget(parent);
|
||||
}
|
||||
|
||||
return newScreen;
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -13,12 +13,11 @@
|
||||
|
||||
#include <ScreenDefs.h>
|
||||
|
||||
#include <ProjectManagerWindow.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
QWidget* BuildScreen(ProjectManagerWindow* window, ProjectManagerScreen screen);
|
||||
class ScreenWidget;
|
||||
|
||||
ScreenWidget* BuildScreen(QWidget* parent = nullptr, ProjectManagerScreen screen = ProjectManagerScreen::Empty);
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <ProjectManagerWindow.h>
|
||||
#include <ScreenDefs.h>
|
||||
|
||||
#include <QWidget>
|
||||
#endif
|
||||
@@ -22,17 +22,32 @@ namespace O3DE::ProjectManager
|
||||
class ScreenWidget
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScreenWidget(ProjectManagerWindow* window)
|
||||
: QWidget(window->GetScreenStack())
|
||||
, m_projectManagerWindow(window)
|
||||
explicit ScreenWidget(QWidget* parent = nullptr)
|
||||
: QWidget(parent)
|
||||
{
|
||||
}
|
||||
~ScreenWidget() = default;
|
||||
|
||||
protected:
|
||||
virtual void ConnectSlotsAndSignals() {}
|
||||
virtual ProjectManagerScreen GetScreenEnum()
|
||||
{
|
||||
return ProjectManagerScreen::Empty;
|
||||
}
|
||||
virtual bool IsReadyForNextScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual QString GetNextButtonText()
|
||||
{
|
||||
return "Next";
|
||||
}
|
||||
|
||||
ProjectManagerWindow* m_projectManagerWindow;
|
||||
signals:
|
||||
void ChangeScreenRequest(ProjectManagerScreen screen);
|
||||
void GotoPreviousScreenRequest();
|
||||
void ResetScreenRequest(ProjectManagerScreen screen);
|
||||
};
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* 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 <ScreensCtrl.h>
|
||||
#include <ScreenFactory.h>
|
||||
#include <ScreenWidget.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
ScreensCtrl::ScreensCtrl(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
setLayout(vLayout);
|
||||
|
||||
m_screenStack = new QStackedWidget();
|
||||
vLayout->addWidget(m_screenStack);
|
||||
|
||||
//Track the bottom of the stack
|
||||
m_screenVisitOrder.push(ProjectManagerScreen::Invalid);
|
||||
}
|
||||
|
||||
void ScreensCtrl::BuildScreens(QVector<ProjectManagerScreen> screens)
|
||||
{
|
||||
for (ProjectManagerScreen screen : screens)
|
||||
{
|
||||
ResetScreen(screen);
|
||||
}
|
||||
}
|
||||
|
||||
ScreenWidget* ScreensCtrl::FindScreen(ProjectManagerScreen screen)
|
||||
{
|
||||
const auto iterator = m_screenMap.find(screen);
|
||||
if (iterator != m_screenMap.end())
|
||||
{
|
||||
return iterator.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ScreenWidget* ScreensCtrl::GetCurrentScreen()
|
||||
{
|
||||
return reinterpret_cast<ScreenWidget*>(m_screenStack->currentWidget());
|
||||
}
|
||||
|
||||
bool ScreensCtrl::ChangeToScreen(ProjectManagerScreen screen)
|
||||
{
|
||||
if (m_screenStack->currentWidget())
|
||||
{
|
||||
ScreenWidget* currentScreenWidget = GetCurrentScreen();
|
||||
if (currentScreenWidget->IsReadyForNextScreen())
|
||||
{
|
||||
return ForceChangeToScreen(screen);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScreensCtrl::ForceChangeToScreen(ProjectManagerScreen screen, bool addVisit)
|
||||
{
|
||||
const auto iterator = m_screenMap.find(screen);
|
||||
if (iterator != m_screenMap.end())
|
||||
{
|
||||
ScreenWidget* currentScreen = GetCurrentScreen();
|
||||
if (currentScreen != iterator.value())
|
||||
{
|
||||
if (addVisit)
|
||||
{
|
||||
m_screenVisitOrder.push(currentScreen->GetScreenEnum());
|
||||
}
|
||||
m_screenStack->setCurrentWidget(iterator.value());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScreensCtrl::GotoPreviousScreen()
|
||||
{
|
||||
// Don't go back if we are on the first set screen
|
||||
if (m_screenVisitOrder.top() != ProjectManagerScreen::Invalid)
|
||||
{
|
||||
// We do not check with screen if we can go back, we should always be able to go back
|
||||
return ForceChangeToScreen(m_screenVisitOrder.pop(), false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScreensCtrl::ResetScreen(ProjectManagerScreen screen)
|
||||
{
|
||||
// Delete old screen if it exists to start fresh
|
||||
DeleteScreen(screen);
|
||||
|
||||
// Add new screen
|
||||
ScreenWidget* newScreen = BuildScreen(this, screen);
|
||||
m_screenStack->addWidget(newScreen);
|
||||
m_screenMap.insert(screen, newScreen);
|
||||
|
||||
connect(newScreen, &ScreenWidget::ChangeScreenRequest, this, &ScreensCtrl::ChangeToScreen);
|
||||
connect(newScreen, &ScreenWidget::GotoPreviousScreenRequest, this, &ScreensCtrl::GotoPreviousScreen);
|
||||
connect(newScreen, &ScreenWidget::ResetScreenRequest, this, &ScreensCtrl::ResetScreen);
|
||||
}
|
||||
|
||||
void ScreensCtrl::ResetAllScreens()
|
||||
{
|
||||
for (auto iter = m_screenMap.begin(); iter != m_screenMap.end(); ++iter)
|
||||
{
|
||||
ResetScreen(iter.key());
|
||||
}
|
||||
}
|
||||
|
||||
void ScreensCtrl::DeleteScreen(ProjectManagerScreen screen)
|
||||
{
|
||||
// Find the old screen if it exists and get rid of it
|
||||
const auto iter = m_screenMap.find(screen);
|
||||
if (iter != m_screenMap.end())
|
||||
{
|
||||
m_screenStack->removeWidget(iter.value());
|
||||
iter.value()->deleteLater();
|
||||
|
||||
// Erase does not cause a rehash so interators remain valid
|
||||
m_screenMap.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void ScreensCtrl::DeleteAllScreens()
|
||||
{
|
||||
for (auto iter = m_screenMap.begin(); iter != m_screenMap.end(); ++iter)
|
||||
{
|
||||
DeleteScreen(iter.key());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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 <ScreenDefs.h>
|
||||
|
||||
#include <QStackedWidget>
|
||||
#include <QStack>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class ScreenWidget;
|
||||
|
||||
class ScreensCtrl
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScreensCtrl(QWidget* parent = nullptr);
|
||||
~ScreensCtrl() = default;
|
||||
|
||||
void BuildScreens(QVector<ProjectManagerScreen> screens);
|
||||
ScreenWidget* FindScreen(ProjectManagerScreen screen);
|
||||
ScreenWidget* GetCurrentScreen();
|
||||
|
||||
public slots:
|
||||
bool ChangeToScreen(ProjectManagerScreen screen);
|
||||
bool ForceChangeToScreen(ProjectManagerScreen screen, bool addVisit = true);
|
||||
bool GotoPreviousScreen();
|
||||
void ResetScreen(ProjectManagerScreen screen);
|
||||
void ResetAllScreens();
|
||||
void DeleteScreen(ProjectManagerScreen screen);
|
||||
void DeleteAllScreens();
|
||||
|
||||
private:
|
||||
QStackedWidget* m_screenStack;
|
||||
QHash<ProjectManagerScreen, ScreenWidget*> m_screenMap;
|
||||
QStack<ProjectManagerScreen> m_screenVisitOrder;
|
||||
};
|
||||
|
||||
} // namespace O3DE::ProjectManager
|
||||
@@ -15,38 +15,47 @@ set(FILES
|
||||
Source/ScreenDefs.h
|
||||
Source/ScreenFactory.h
|
||||
Source/ScreenFactory.cpp
|
||||
Source/ScreensCtrl.h
|
||||
Source/ScreensCtrl.cpp
|
||||
Source/ScreenWidget.h
|
||||
Source/FirstTimeUse.h
|
||||
Source/FirstTimeUse.cpp
|
||||
Source/FirstTimeUse.ui
|
||||
Source/ProjectInfo.h
|
||||
Source/ProjectInfo.cpp
|
||||
Source/EngineInfo.h
|
||||
Source/EngineInfo.cpp
|
||||
Source/FirstTimeUseScreen.h
|
||||
Source/FirstTimeUseScreen.cpp
|
||||
Source/FirstTimeUseScreen.ui
|
||||
Source/ProjectManagerWindow.h
|
||||
Source/ProjectManagerWindow.cpp
|
||||
Source/ProjectTemplateInfo.h
|
||||
Source/ProjectTemplateInfo.cpp
|
||||
Source/ProjectManagerWindow.ui
|
||||
Source/PythonBindings.h
|
||||
Source/PythonBindings.cpp
|
||||
Source/PythonBindingsInterface.h
|
||||
Source/NewProjectSettings.h
|
||||
Source/NewProjectSettings.cpp
|
||||
Source/NewProjectSettings.ui
|
||||
Source/ProjectsHome.h
|
||||
Source/ProjectsHome.cpp
|
||||
Source/ProjectsHome.ui
|
||||
Source/ProjectSettings.h
|
||||
Source/ProjectSettings.cpp
|
||||
Source/ProjectSettings.ui
|
||||
Source/EngineSettings.h
|
||||
Source/EngineSettings.cpp
|
||||
Source/EngineSettings.ui
|
||||
Source/ProjectInfo.h
|
||||
Source/ProjectInfo.cpp
|
||||
Source/NewProjectSettingsScreen.h
|
||||
Source/NewProjectSettingsScreen.cpp
|
||||
Source/ProjectSettingsCtrl.h
|
||||
Source/ProjectSettingsCtrl.cpp
|
||||
Source/ProjectsHomeScreen.h
|
||||
Source/ProjectsHomeScreen.cpp
|
||||
Source/ProjectsHomeScreen.ui
|
||||
Source/ProjectSettingsScreen.h
|
||||
Source/ProjectSettingsScreen.cpp
|
||||
Source/ProjectSettingsScreen.ui
|
||||
Source/EngineSettingsScreen.h
|
||||
Source/EngineSettingsScreen.cpp
|
||||
Source/EngineSettingsScreen.ui
|
||||
Source/LinkWidget.h
|
||||
Source/LinkWidget.cpp
|
||||
Source/TagWidget.h
|
||||
Source/TagWidget.cpp
|
||||
Source/GemCatalog/GemCatalog.h
|
||||
Source/GemCatalog/GemCatalog.cpp
|
||||
Source/GemCatalog/GemCatalogScreen.h
|
||||
Source/GemCatalog/GemCatalogScreen.cpp
|
||||
Source/GemCatalog/GemInfo.h
|
||||
Source/GemCatalog/GemInfo.cpp
|
||||
Source/GemCatalog/GemInspector.h
|
||||
Source/GemCatalog/GemInspector.cpp
|
||||
Source/GemCatalog/GemItemDelegate.h
|
||||
Source/GemCatalog/GemItemDelegate.cpp
|
||||
Source/GemCatalog/GemListView.h
|
||||
|
||||
@@ -139,6 +139,8 @@ namespace AZ
|
||||
if (!nodeNameMap.RegisterNode(node.m_node, scene.GetGraph(), node.m_parent))
|
||||
{
|
||||
AZ_TracePrintf(Utilities::ErrorWindow, "Failed to register asset importer node in name table.");
|
||||
// Skip this node since it could not be registered
|
||||
nodes.pop();
|
||||
continue;
|
||||
}
|
||||
AZStd::string nodeName = nodeNameMap.GetNodeName(node.m_node);
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace AZ
|
||||
}
|
||||
return true;
|
||||
};
|
||||
if (!Utilities::InspectSerializedFile(filePath, convertSettings.m_serializeContext, callback))
|
||||
if (!Utilities::InspectSerializedFile(filePath.c_str(), convertSettings.m_serializeContext, callback))
|
||||
{
|
||||
AZ_Warning("Convert", false, "Failed to load '%s'. File may not contain an object stream.", filePath.c_str());
|
||||
result = false;
|
||||
@@ -287,7 +287,7 @@ namespace AZ
|
||||
}
|
||||
return true;
|
||||
};
|
||||
if (!Utilities::InspectSerializedFile(filePath, convertSettings.m_serializeContext, callback))
|
||||
if (!Utilities::InspectSerializedFile(filePath.c_str(), convertSettings.m_serializeContext, callback))
|
||||
{
|
||||
AZ_Warning("Convert", false, "Failed to load '%s'. File may not contain an object stream.", filePath.c_str());
|
||||
result = false;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace AZ
|
||||
//! Can be used to convert *.ini and *.cfg files
|
||||
static bool ConvertConfigFile(Application& application);
|
||||
|
||||
private:
|
||||
protected:
|
||||
using PathDocumentPair = AZStd::pair<AZStd::string, rapidjson::Document>;
|
||||
using PathDocumentContainer = AZStd::vector<PathDocumentPair>;
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace AZ::SerializeContextTools
|
||||
result = false;
|
||||
}
|
||||
};
|
||||
if (!Utilities::InspectSerializedFile(filePath, sc, callback))
|
||||
if (!Utilities::InspectSerializedFile(filePath.c_str(), sc, callback))
|
||||
{
|
||||
result = false;
|
||||
continue;
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* 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/Asset/AssetManager.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Component/EntityUtils.h>
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
#include <AzCore/JSON/prettywriter.h>
|
||||
#include <AzCore/Module/Module.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/Utils.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/Settings/SettingsRegistryImpl.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/std/containers/unordered_set.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/Archive/IArchive.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
|
||||
#include <AzToolsFramework/Prefab/EditorPrefabComponent.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
#include <Application.h>
|
||||
#include <SliceConverter.h>
|
||||
#include <Utilities.h>
|
||||
|
||||
// SliceConverter reads in a slice file (saved in an ObjectStream format), instantiates it, creates a prefab out of the data,
|
||||
// and saves the prefab in a JSON format. This can be used for one-time migrations of slices or slice-based levels to prefabs.
|
||||
// This converter is still in an early state. It can convert trivial slices, but it cannot handle nested slices yet.
|
||||
//
|
||||
// If the slice contains legacy data, it will print out warnings / errors about the data that couldn't be serialized.
|
||||
// The prefab will be generated without that data.
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace SerializeContextTools
|
||||
{
|
||||
bool SliceConverter::ConvertSliceFiles(Application& application)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
const AZ::CommandLine* commandLine = application.GetAzCommandLine();
|
||||
if (!commandLine)
|
||||
{
|
||||
AZ_Error("SerializeContextTools", false, "Command line not available.");
|
||||
return false;
|
||||
}
|
||||
|
||||
JsonSerializerSettings convertSettings;
|
||||
convertSettings.m_keepDefaults = commandLine->HasSwitch("keepdefaults");
|
||||
convertSettings.m_registrationContext = application.GetJsonRegistrationContext();
|
||||
convertSettings.m_serializeContext = application.GetSerializeContext();
|
||||
if (!convertSettings.m_serializeContext)
|
||||
{
|
||||
AZ_Error("Convert-Slice", false, "No serialize context found.");
|
||||
return false;
|
||||
}
|
||||
if (!convertSettings.m_registrationContext)
|
||||
{
|
||||
AZ_Error("Convert-Slice", false, "No json registration context found.");
|
||||
return false;
|
||||
}
|
||||
AZStd::string logggingScratchBuffer;
|
||||
SetupLogging(logggingScratchBuffer, convertSettings.m_reporting, *commandLine);
|
||||
|
||||
bool isDryRun = commandLine->HasSwitch("dryrun");
|
||||
|
||||
JsonDeserializerSettings verifySettings;
|
||||
verifySettings.m_registrationContext = application.GetJsonRegistrationContext();
|
||||
verifySettings.m_serializeContext = application.GetSerializeContext();
|
||||
SetupLogging(logggingScratchBuffer, verifySettings.m_reporting, *commandLine);
|
||||
|
||||
auto archiveInterface = AZ::Interface<AZ::IO::IArchive>::Get();
|
||||
|
||||
// Find the Prefab System Component for use in creating and saving the prefab
|
||||
AZ::Entity* systemEntity = application.FindEntity(AZ::SystemEntityId);
|
||||
AZ_Assert(systemEntity != nullptr, "System entity doesn't exist.");
|
||||
auto prefabSystemComponent = systemEntity->FindComponent<AzToolsFramework::Prefab::PrefabSystemComponent>();
|
||||
AZ_Assert(prefabSystemComponent != nullptr, "Prefab System component doesn't exist");
|
||||
|
||||
bool result = true;
|
||||
rapidjson::StringBuffer scratchBuffer;
|
||||
|
||||
AZStd::vector<AZStd::string> fileList = Utilities::ReadFileListFromCommandLine(application, "files");
|
||||
for (AZStd::string& filePath : fileList)
|
||||
{
|
||||
bool packOpened = false;
|
||||
|
||||
AZ::IO::Path outputPath = filePath;
|
||||
outputPath.ReplaceExtension("prefab");
|
||||
|
||||
AZ_Printf("Convert-Slice", "------------------------------------------------------------------------------------------\n");
|
||||
AZ_Printf("Convert-Slice", "Converting '%s' to '%s'\n", filePath.c_str(), outputPath.c_str());
|
||||
|
||||
AZ::IO::Path inputPath = filePath;
|
||||
auto fileExtension = inputPath.Extension();
|
||||
if (fileExtension == ".ly")
|
||||
{
|
||||
// Special case: for level files, we need to open the .ly zip file and convert the levelentities.editor_xml file
|
||||
// inside of it. All the other files can be ignored as they are deprecated legacy system files that are no longer
|
||||
// loaded with prefab-based levels.
|
||||
packOpened = archiveInterface->OpenPack(filePath);
|
||||
inputPath.ReplaceFilename("levelentities.editor_xml");
|
||||
AZ_Warning("Convert-Slice", packOpened, " '%s' could not be opened as a pack file.\n", filePath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning(
|
||||
"Convert-Slice", (fileExtension == ".slice"),
|
||||
" Warning: Only .ly and .slice files are supported, conversion of '%.*s' may not work.\n",
|
||||
AZ_STRING_ARG(fileExtension.Native()));
|
||||
}
|
||||
|
||||
auto callback = [prefabSystemComponent, &outputPath, isDryRun]
|
||||
(void* classPtr, const Uuid& classId, [[maybe_unused]] SerializeContext* context)
|
||||
{
|
||||
if (classId != azrtti_typeid<AZ::Entity>())
|
||||
{
|
||||
AZ_Printf("Convert-Slice", " File not converted: Slice root is not an entity.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ::Entity* rootEntity = reinterpret_cast<AZ::Entity*>(classPtr);
|
||||
return ConvertSliceFile(prefabSystemComponent, outputPath, isDryRun, rootEntity);
|
||||
};
|
||||
|
||||
if (!Utilities::InspectSerializedFile(inputPath.c_str(), convertSettings.m_serializeContext, callback))
|
||||
{
|
||||
AZ_Warning("Convert-Slice", false, "Failed to load '%s'. File may not contain an object stream.", inputPath.c_str());
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (packOpened)
|
||||
{
|
||||
[[maybe_unused]] bool closeResult = archiveInterface->ClosePack(filePath);
|
||||
AZ_Warning("Convert-Slice", !closeResult, "Failed to close '%s'.", filePath.c_str());
|
||||
}
|
||||
|
||||
AZ_Printf("Convert-Slice", "Finished converting '%s' to '%s'\n", filePath.c_str(), outputPath.c_str());
|
||||
AZ_Printf("Convert-Slice", "------------------------------------------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool SliceConverter::ConvertSliceFile(
|
||||
AzToolsFramework::Prefab::PrefabSystemComponent* prefabSystemComponent, AZ::IO::PathView outputPath, bool isDryRun,
|
||||
AZ::Entity* rootEntity)
|
||||
{
|
||||
// Find the slice from the root entity.
|
||||
SliceComponent* sliceComponent = AZ::EntityUtils::FindFirstDerivedComponent<SliceComponent>(rootEntity);
|
||||
if (sliceComponent == nullptr)
|
||||
{
|
||||
AZ_Printf("Convert-Slice", " File not converted: Root entity did not contain a slice component.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get all of the entities from the slice.
|
||||
SliceComponent::EntityList sliceEntities;
|
||||
bool getEntitiesResult = sliceComponent->GetEntities(sliceEntities);
|
||||
if ((!getEntitiesResult) || (sliceEntities.empty()))
|
||||
{
|
||||
AZ_Printf("Convert-Slice", " File not converted: Slice entities could not be retrieved.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the Prefab with the entities from the slice
|
||||
AZStd::unique_ptr<AzToolsFramework::Prefab::Instance> sourceInstance(
|
||||
prefabSystemComponent->CreatePrefab(sliceEntities, {}, outputPath));
|
||||
|
||||
// Dispatch events here, because prefab creation might trigger asset loads in rare circumstances.
|
||||
AZ::Data::AssetManager::Instance().DispatchEvents();
|
||||
|
||||
// Set up the Prefab container entity to be a proper Editor entity. (This logic is normally triggered
|
||||
// via an EditorRequests EBus in CreatePrefab, but the subsystem that listens for it isn't present in this tool.)
|
||||
AzToolsFramework::Prefab::EntityOptionalReference container = sourceInstance->GetContainerEntity();
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorEntityContextRequestBus::Events::AddRequiredComponents, container->get());
|
||||
container->get().AddComponent(aznew AzToolsFramework::Prefab::EditorPrefabComponent());
|
||||
|
||||
// Reparent any root-level slice entities to the container entity.
|
||||
for (auto entity : sliceEntities)
|
||||
{
|
||||
AzToolsFramework::Components::TransformComponent* transformComponent =
|
||||
entity->FindComponent<AzToolsFramework::Components::TransformComponent>();
|
||||
if (transformComponent)
|
||||
{
|
||||
if (!transformComponent->GetParentId().IsValid())
|
||||
{
|
||||
transformComponent->SetParent(container->get().GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto templateId = sourceInstance->GetTemplateId();
|
||||
|
||||
if (templateId == AzToolsFramework::Prefab::InvalidTemplateId)
|
||||
{
|
||||
AZ_Printf("Convert-Slice", " Path error. Path could be invalid, or the prefab may not be loaded in this level.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update the prefab template with the fixed-up data in our prefab instance.
|
||||
AzToolsFramework::Prefab::PrefabDom prefabDom;
|
||||
bool storeResult = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*sourceInstance, prefabDom);
|
||||
if (storeResult == false)
|
||||
{
|
||||
AZ_Printf("Convert-Slice", " Failed to convert prefab instance data to a PrefabDom.\n");
|
||||
return false;
|
||||
}
|
||||
prefabSystemComponent->UpdatePrefabTemplate(templateId, prefabDom);
|
||||
|
||||
// Dispatch events here, because prefab serialization might trigger asset loads in rare circumstances.
|
||||
AZ::Data::AssetManager::Instance().DispatchEvents();
|
||||
|
||||
if (isDryRun)
|
||||
{
|
||||
PrintPrefab(prefabDom, sourceInstance->GetTemplateSourcePath());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SavePrefab(templateId);
|
||||
}
|
||||
}
|
||||
|
||||
void SliceConverter::PrintPrefab(const AzToolsFramework::Prefab::PrefabDom& prefabDom, const AZ::IO::Path& templatePath)
|
||||
{
|
||||
rapidjson::StringBuffer prefabBuffer;
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(prefabBuffer);
|
||||
prefabDom.Accept(writer);
|
||||
AZ_Printf("Convert-Slice", "JSON for %s:\n", templatePath.c_str());
|
||||
|
||||
// We use Output() to print out the JSON because AZ_Printf has a 4096-character limit.
|
||||
AZ::Debug::Trace::Instance().Output("", prefabBuffer.GetString());
|
||||
AZ::Debug::Trace::Instance().Output("", "\n");
|
||||
}
|
||||
|
||||
bool SliceConverter::SavePrefab(AzToolsFramework::Prefab::TemplateId templateId)
|
||||
{
|
||||
auto prefabLoaderInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
|
||||
|
||||
if (!prefabLoaderInterface->SaveTemplate(templateId))
|
||||
{
|
||||
AZ_Printf("Convert-Slice", " Could not save prefab - internal error (Json write operation failure).\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace SerializeContextTools
|
||||
} // namespace AZ
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/IO/Path/Path_fwd.h>
|
||||
#include <AzCore/JSON/document.h>
|
||||
#include <AzCore/JSON/stringbuffer.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabSystemComponent.h>
|
||||
|
||||
#include <Converter.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class CommandLine;
|
||||
class Entity;
|
||||
class ModuleEntity;
|
||||
class SerializeContext;
|
||||
struct Uuid;
|
||||
|
||||
namespace SerializeContextTools
|
||||
{
|
||||
class Application;
|
||||
|
||||
class SliceConverter : public Converter
|
||||
{
|
||||
public:
|
||||
static bool ConvertSliceFiles(Application& application);
|
||||
|
||||
private:
|
||||
|
||||
static bool ConvertSliceFile(AzToolsFramework::Prefab::PrefabSystemComponent* prefabSystemComponent,
|
||||
AZ::IO::PathView outputPath, bool isDryRun, AZ::Entity* rootEntity);
|
||||
|
||||
static void PrintPrefab(const AzToolsFramework::Prefab::PrefabDom& prefabDom, const AZ::IO::Path& templatePath);
|
||||
static bool SavePrefab(AzToolsFramework::Prefab::TemplateId templateId);
|
||||
};
|
||||
} // namespace SerializeContextTools
|
||||
} // namespace AZ
|
||||
@@ -209,30 +209,42 @@ namespace AZ::SerializeContextTools
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Utilities::InspectSerializedFile(const AZStd::string& filePath, SerializeContext* sc, const ObjectStream::ClassReadyCB& classCallback)
|
||||
bool Utilities::InspectSerializedFile(const char* filePath, SerializeContext* sc, const ObjectStream::ClassReadyCB& classCallback)
|
||||
{
|
||||
if (!AZ::IO::SystemFile::Exists(filePath.c_str()))
|
||||
if (!AZ::IO::FileIOBase::GetInstance()->Exists(filePath))
|
||||
{
|
||||
AZ_Error("Verify", false, "Unable to open file '%s' as it doesn't exist.", filePath.c_str());
|
||||
AZ_Error("Verify", false, "Unable to open file '%s' as it doesn't exist.", filePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
u64 fileLength = AZ::IO::SystemFile::Length(filePath.c_str());
|
||||
if (fileLength == 0)
|
||||
AZ::IO::HandleType fileHandle;
|
||||
auto openResult = AZ::IO::FileIOBase::GetInstance()->Open(filePath, AZ::IO::OpenMode::ModeRead, fileHandle);
|
||||
if (!openResult)
|
||||
{
|
||||
AZ_Error("Verify", false, "File '%s' doesn't have content.", filePath.c_str());
|
||||
AZ_Error("Verify", false, "File '%s' could not be opened.", filePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
u64 fileLength = 0;
|
||||
auto sizeResult = AZ::IO::FileIOBase::GetInstance()->Size(fileHandle, fileLength);
|
||||
if (!sizeResult || (fileLength == 0))
|
||||
{
|
||||
AZ_Error("Verify", false, "File '%s' doesn't have content.", filePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
AZStd::vector<u8> data;
|
||||
data.resize_no_construct(fileLength);
|
||||
u64 bytesRead = AZ::IO::SystemFile::Read(filePath.c_str(), data.data());
|
||||
if (bytesRead != fileLength)
|
||||
u64 bytesRead = 0;
|
||||
auto readResult = AZ::IO::FileIOBase::GetInstance()->Read(fileHandle, data.data(), fileLength, true, &bytesRead);
|
||||
if (!readResult || (bytesRead != fileLength))
|
||||
{
|
||||
AZ_Error("Verify", false, "Unable to read file '%s'.", filePath.c_str());
|
||||
AZ_Error("Verify", false, "Unable to read file '%s'.", filePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ::IO::FileIOBase::GetInstance()->Close(fileHandle);
|
||||
|
||||
AZ::IO::MemoryStream stream(data.data(), fileLength);
|
||||
|
||||
ObjectStream::FilterDescriptor filter;
|
||||
@@ -241,7 +253,7 @@ namespace AZ::SerializeContextTools
|
||||
filter.m_assetCB = AZ::Data::AssetFilterNoAssetLoading;
|
||||
if (!ObjectStream::LoadBlocking(&stream, *sc, classCallback, filter))
|
||||
{
|
||||
AZ_Printf("Verify", "Failed to deserialize '%s'\n", filePath.c_str());
|
||||
AZ_Printf("Verify", "Failed to deserialize '%s'\n", filePath);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace AZ
|
||||
|
||||
static AZStd::vector<AZ::Uuid> GetSystemComponents(const Application& application);
|
||||
|
||||
static bool InspectSerializedFile(const AZStd::string& filePath, SerializeContext* sc, const ObjectStream::ClassReadyCB& classCallback);
|
||||
static bool InspectSerializedFile(const char* filePath, SerializeContext* sc, const ObjectStream::ClassReadyCB& classCallback);
|
||||
|
||||
private:
|
||||
Utilities() = delete;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <Application.h>
|
||||
#include <Converter.h>
|
||||
#include <Dumper.h>
|
||||
#include <SliceConverter.h>
|
||||
|
||||
|
||||
void PrintHelp()
|
||||
@@ -74,6 +75,14 @@ void PrintHelp()
|
||||
AZ_Printf("Help", R"( On Windows the <prefix> should be in quotes, as \"/\" is treated as command option prefix)" "\n");
|
||||
AZ_Printf("Help", R"( [opt] -verbose: Report additional details during the conversion process.)" "\n");
|
||||
AZ_Printf("Help", R"( example: 'convert-ini --files=AssetProcessorPlatformConfig.ini;bootstrap.cfg --ext=setreg)" "\n");
|
||||
AZ_Printf("Help", " 'convert-slice': Converts ObjectStream-based slice files or legacy levels to a JSON-based prefab.\n");
|
||||
AZ_Printf("Help", " [arg] -files=<path>: <comma or semicolon>-separated list of files to convert. Supports wildcards.\n");
|
||||
AZ_Printf("Help", " [opt] -dryrun: Processes as normal, but doesn't write files.\n");
|
||||
AZ_Printf("Help", " [opt] -keepdefaults: Fields are written if a default value was found.\n");
|
||||
AZ_Printf("Help", " [opt] -verbose: Report additional details during the conversion process.\n");
|
||||
AZ_Printf("Help", " example: 'convert-slice -files=*.slice -specializations=editor\n");
|
||||
AZ_Printf("Help", " example: 'convert-slice -files=Levels/TestLevel/TestLevel.ly -specializations=editor\n");
|
||||
AZ_Printf("Help", "\n");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
@@ -114,6 +123,10 @@ int main(int argc, char** argv)
|
||||
{
|
||||
result = Converter::ConvertConfigFile(application);
|
||||
}
|
||||
else if (AZ::StringFunc::Equal("convert-slice", action.c_str()))
|
||||
{
|
||||
result = SliceConverter::ConvertSliceFiles(application);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintHelp();
|
||||
|
||||
@@ -17,6 +17,8 @@ set(FILES
|
||||
Dumper.h
|
||||
Dumper.cpp
|
||||
main.cpp
|
||||
SliceConverter.h
|
||||
SliceConverter.cpp
|
||||
Utilities.h
|
||||
Utilities.cpp
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user