Merge branch 'stabilization/2106' into gitflow_210609
This commit is contained in:
@@ -161,7 +161,56 @@ namespace AZ
|
||||
return "A pair is an fixed size collection of two elements.";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
void GetTypeNamesFold(AZStd::vector<AZStd::string>& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
result.push_back(OnDemandPrettyName<T>::Get(context));
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
void GetTypeNames(AZStd::vector<AZStd::string>& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
(GetTypeNamesFold<T>(result, context), ...);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void GetTypeNamesFold(AZStd::string& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
if (!result.empty())
|
||||
{
|
||||
result += ", ";
|
||||
}
|
||||
|
||||
result += OnDemandPrettyName<T>::Get(context);
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
void GetTypeNames(AZStd::string& result, AZ::BehaviorContext& context)
|
||||
{
|
||||
(GetTypeNamesFold<T>(result, context), ...);
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
struct OnDemandPrettyName<AZStd::tuple<T...>>
|
||||
{
|
||||
static AZStd::string Get(AZ::BehaviorContext& context)
|
||||
{
|
||||
AZStd::string typeNames;
|
||||
GetTypeNames<T...>(typeNames, context);
|
||||
return AZStd::string::format("Tuple<%s>", typeNames.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... T>
|
||||
struct OnDemandToolTip<AZStd::tuple<T...>>
|
||||
{
|
||||
static AZStd::string Get(AZ::BehaviorContext&)
|
||||
{
|
||||
return "A tuple is an fixed size collection of any number of any type of element.";
|
||||
}
|
||||
};
|
||||
|
||||
template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
|
||||
struct OnDemandPrettyName< AZStd::unordered_map<Key, MappedType, Hasher, EqualKey, Allocator> >
|
||||
{
|
||||
|
||||
@@ -813,20 +813,27 @@ namespace AZ
|
||||
{
|
||||
using ContainerType = AZStd::tuple<T...>;
|
||||
|
||||
template<size_t Index>
|
||||
static void ReflectUnpackMethodFold(BehaviorContext::ClassBuilder<ContainerType>& builder)
|
||||
template<typename Targ, size_t Index>
|
||||
static void ReflectUnpackMethodFold(BehaviorContext::ClassBuilder<ContainerType>& builder, const AZStd::vector<AZStd::string>& typeNames)
|
||||
{
|
||||
const AZStd::string methodName = AZStd::string::format("Get%zu", Index);
|
||||
builder->Method(methodName.data(), [](ContainerType& value) { return AZStd::get<Index>(value); })
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
builder->Method(methodName.data(), [](ContainerType& thisPointer) { return AZStd::get<Index>(thisPointer); })
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
|
||||
->Attribute(AZ::ScriptCanvasAttributes::TupleGetFunctionIndex, Index)
|
||||
;
|
||||
|
||||
builder->Property
|
||||
( AZStd::string::format("element_%zu_%s", Index, typeNames[Index].c_str()).c_str()
|
||||
, [](ContainerType& thisPointer) { return AZStd::get<Index>(thisPointer); }
|
||||
, [](ContainerType& thisPointer, const Targ& element) { AZStd::get<Index>(thisPointer) = element; });
|
||||
}
|
||||
|
||||
template<size_t... Indices>
|
||||
template<typename... Targ, size_t... Indices>
|
||||
static void ReflectUnpackMethods(BehaviorContext::ClassBuilder<ContainerType>& builder, AZStd::index_sequence<Indices...>)
|
||||
{
|
||||
(ReflectUnpackMethodFold<Indices>(builder), ...);
|
||||
AZStd::vector<AZStd::string> typeNames;
|
||||
ScriptCanvasOnDemandReflection::GetTypeNames<T...>(typeNames, *builder.m_context);
|
||||
(ReflectUnpackMethodFold<Targ, Indices>(builder, typeNames), ...);
|
||||
}
|
||||
|
||||
static void Reflect(ReflectContext* context)
|
||||
@@ -851,9 +858,10 @@ namespace AZ
|
||||
->Attribute(AZ::ScriptCanvasAttributes::TupleConstructorFunction, constructorHolder)
|
||||
;
|
||||
|
||||
ReflectUnpackMethods(builder, AZStd::make_index_sequence<sizeof...(T)>{});
|
||||
ReflectUnpackMethods<T...>(builder, AZStd::make_index_sequence<sizeof...(T)>{});
|
||||
|
||||
builder->Method("GetSize", []() { return AZStd::tuple_size<ContainerType>::value; })
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,8 @@ namespace AZ
|
||||
//! Save a string to a file. Otherwise returns a failure with error message.
|
||||
AZ::Outcome<void, AZStd::string> WriteFile(AZStd::string_view content, AZStd::string_view filePath);
|
||||
|
||||
//! Read a file into a string. Returns a failure with error message if the content could not be loaded.
|
||||
//! Read a file into a string. Returns a failure with error message if the content could not be loaded or if
|
||||
//! the file size is larger than the max file size provided.
|
||||
template<typename Container = AZStd::string>
|
||||
AZ::Outcome<Container, AZStd::string> ReadFile(AZStd::string_view filePath, size_t maxFileSize = DefaultMaxFileSize);
|
||||
}
|
||||
|
||||
@@ -8,29 +8,25 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/AzTest/Platform/${PAL_PLATFORM_NAME})
|
||||
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/AzTest/Platform/${PAL_PLATFORM_NAME})
|
||||
|
||||
ly_add_target(
|
||||
NAME AzTest STATIC
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
AzTest/aztest_files.cmake
|
||||
${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
.
|
||||
${pal_dir}
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
3rdParty::googletest::GMock
|
||||
3rdParty::googletest::GTest
|
||||
3rdParty::GoogleBenchmark
|
||||
AZ::AzCore
|
||||
PLATFORM_INCLUDE_FILES
|
||||
${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
|
||||
)
|
||||
|
||||
endif()
|
||||
ly_add_target(
|
||||
NAME AzTest STATIC
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
AzTest/aztest_files.cmake
|
||||
${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
.
|
||||
${pal_dir}
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
3rdParty::googletest::GMock
|
||||
3rdParty::googletest::GTest
|
||||
3rdParty::GoogleBenchmark
|
||||
AZ::AzCore
|
||||
PLATFORM_INCLUDE_FILES
|
||||
${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
|
||||
)
|
||||
|
||||
+1
-7
@@ -185,13 +185,7 @@ namespace AzToolsFramework
|
||||
bool PrefabEditorEntityOwnershipService::LoadFromStream(AZ::IO::GenericStream& stream, AZStd::string_view filename)
|
||||
{
|
||||
Reset();
|
||||
// Make loading from stream to behave the same in terms of filesize as regular loading of prefabs
|
||||
// This may need to be revisited in the future for supporting higher sizes along with prefab loading
|
||||
if (stream.GetLength() > Prefab::MaxPrefabFileSize)
|
||||
{
|
||||
AZ_Error("Prefab", false, "'%.*s' prefab content is bigger than the max supported size (%f MB)", AZ_STRING_ARG(filename), Prefab::MaxPrefabFileSize / (1024.f * 1024.f));
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t bufSize = stream.GetLength();
|
||||
AZStd::unique_ptr<char[]> buf(new char[bufSize]);
|
||||
AZ::IO::SizeType bytes = stream.Read(bufSize, buf.get());
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace AzToolsFramework
|
||||
return InvalidTemplateId;
|
||||
}
|
||||
|
||||
auto readResult = AZ::Utils::ReadFile(GetFullPath(filePath).Native(), MaxPrefabFileSize);
|
||||
auto readResult = AZ::Utils::ReadFile(GetFullPath(filePath).Native(), AZStd::numeric_limits<size_t>::max());
|
||||
if (!readResult.IsSuccess())
|
||||
{
|
||||
AZ_Error(
|
||||
|
||||
@@ -21,8 +21,6 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
constexpr size_t MaxPrefabFileSize = 1024 * 1024;
|
||||
|
||||
/*!
|
||||
* PrefabLoaderInterface
|
||||
* Interface for saving/loading Prefab files.
|
||||
|
||||
@@ -901,7 +901,13 @@ namespace AzToolsFramework
|
||||
return AZ::Failure(AZStd::string("No entities to duplicate."));
|
||||
}
|
||||
|
||||
if (!EntitiesBelongToSameInstance(entityIds))
|
||||
const EntityIdList entityIdsNoLevelInstance = GenerateEntityIdListWithoutLevelInstance(entityIds);
|
||||
if (entityIdsNoLevelInstance.empty())
|
||||
{
|
||||
return AZ::Failure(AZStd::string("No entities to duplicate because only instance selected is the level instance."));
|
||||
}
|
||||
|
||||
if (!EntitiesBelongToSameInstance(entityIdsNoLevelInstance))
|
||||
{
|
||||
return AZ::Failure(AZStd::string("Cannot duplicate multiple entities belonging to different instances with one operation."
|
||||
"Change your selection to contain entities in the same instance."));
|
||||
@@ -909,7 +915,7 @@ namespace AzToolsFramework
|
||||
|
||||
// We've already verified the entities are all owned by the same instance,
|
||||
// so we can just retrieve our instance from the first entity in the list.
|
||||
AZ::EntityId firstEntityIdToDuplicate = entityIds[0];
|
||||
AZ::EntityId firstEntityIdToDuplicate = entityIdsNoLevelInstance[0];
|
||||
InstanceOptionalReference commonOwningInstance = GetOwnerInstanceByEntityId(firstEntityIdToDuplicate);
|
||||
if (!commonOwningInstance.has_value())
|
||||
{
|
||||
@@ -929,7 +935,7 @@ namespace AzToolsFramework
|
||||
|
||||
// This will cull out any entities that have ancestors in the list, since we will end up duplicating
|
||||
// the full nested hierarchy with what is returned from RetrieveAndSortPrefabEntitiesAndInstances
|
||||
AzToolsFramework::EntityIdSet duplicationSet = AzToolsFramework::GetCulledEntityHierarchy(entityIds);
|
||||
AzToolsFramework::EntityIdSet duplicationSet = AzToolsFramework::GetCulledEntityHierarchy(entityIdsNoLevelInstance);
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
@@ -1004,17 +1010,19 @@ namespace AzToolsFramework
|
||||
|
||||
PrefabOperationResult PrefabPublicHandler::DeleteFromInstance(const EntityIdList& entityIds, bool deleteDescendants)
|
||||
{
|
||||
if (entityIds.empty())
|
||||
const EntityIdList entityIdsNoLevelInstance = GenerateEntityIdListWithoutLevelInstance(entityIds);
|
||||
|
||||
if (entityIdsNoLevelInstance.empty())
|
||||
{
|
||||
return AZ::Success();
|
||||
}
|
||||
|
||||
if (!EntitiesBelongToSameInstance(entityIds))
|
||||
if (!EntitiesBelongToSameInstance(entityIdsNoLevelInstance))
|
||||
{
|
||||
return AZ::Failure(AZStd::string("Cannot delete multiple entities belonging to different instances with one operation."));
|
||||
}
|
||||
|
||||
AZ::EntityId firstEntityIdToDelete = entityIds[0];
|
||||
AZ::EntityId firstEntityIdToDelete = entityIdsNoLevelInstance[0];
|
||||
InstanceOptionalReference commonOwningInstance = GetOwnerInstanceByEntityId(firstEntityIdToDelete);
|
||||
|
||||
// If the first entity id is a container entity id, then we need to mark its parent as the common owning instance because you
|
||||
@@ -1025,7 +1033,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
// Retrieve entityList from entityIds
|
||||
EntityList inputEntityList = EntityIdListToEntityList(entityIds);
|
||||
EntityList inputEntityList = EntityIdListToEntityList(entityIdsNoLevelInstance);
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
@@ -1081,7 +1089,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
else
|
||||
{
|
||||
for (AZ::EntityId entityId : entityIds)
|
||||
for (AZ::EntityId entityId : entityIdsNoLevelInstance)
|
||||
{
|
||||
InstanceOptionalReference owningInstance = m_instanceEntityMapperInterface->FindOwningInstance(entityId);
|
||||
// If this is the container entity, it actually represents the instance so get its owner
|
||||
@@ -1437,6 +1445,22 @@ namespace AzToolsFramework
|
||||
return (outEntities.size() + outInstances.size()) > 0;
|
||||
}
|
||||
|
||||
EntityIdList PrefabPublicHandler::GenerateEntityIdListWithoutLevelInstance(
|
||||
const EntityIdList& entityIds) const
|
||||
{
|
||||
EntityIdList outEntityIds;
|
||||
outEntityIds.reserve(entityIds.size()); // Actual size could be smaller.
|
||||
|
||||
for (const AZ::EntityId& entityId : entityIds)
|
||||
{
|
||||
if (!IsLevelInstanceContainerEntity(entityId))
|
||||
{
|
||||
outEntityIds.emplace_back(entityId);
|
||||
}
|
||||
}
|
||||
return outEntityIds;
|
||||
}
|
||||
|
||||
bool PrefabPublicHandler::EntitiesBelongToSameInstance(const EntityIdList& entityIds) const
|
||||
{
|
||||
if (entityIds.size() <= 1)
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace AzToolsFramework
|
||||
PrefabOperationResult DeleteFromInstance(const EntityIdList& entityIds, bool deleteDescendants);
|
||||
bool RetrieveAndSortPrefabEntitiesAndInstances(const EntityList& inputEntities, Instance& commonRootEntityOwningInstance,
|
||||
EntityList& outEntities, AZStd::vector<Instance*>& outInstances) const;
|
||||
EntityIdList GenerateEntityIdListWithoutLevelInstance(const EntityIdList& entityIds) const;
|
||||
|
||||
InstanceOptionalReference GetOwnerInstanceByEntityId(AZ::EntityId entityId) const;
|
||||
bool EntitiesBelongToSameInstance(const EntityIdList& entityIds) const;
|
||||
|
||||
@@ -16,6 +16,7 @@ set_property(GLOBAL PROPERTY LAUNCHER_UNIFIED_BINARY_DIR ${CMAKE_CURRENT_BINARY_
|
||||
# When using an installed engine, this file will be included by the FindLauncherGenerator.cmake script
|
||||
get_property(LY_PROJECTS_TARGET_NAME GLOBAL PROPERTY LY_PROJECTS_TARGET_NAME)
|
||||
foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJECTS)
|
||||
|
||||
# Computes the realpath to the project
|
||||
# If the project_path is relative, it is evaluated relative to the ${LY_ROOT_FOLDER}
|
||||
# Otherwise the the absolute project_path is returned with symlinks resolved
|
||||
@@ -35,6 +36,28 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
|
||||
"to the LY_PROJECTS_TARGET_NAME global property. Other configuration errors might occur")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Assets
|
||||
################################################################################
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
add_custom_target(${project_name}.Assets
|
||||
COMMENT "Processing ${project_name} assets..."
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DLY_LOCK_FILE=$<TARGET_FILE_DIR:AZ::AssetProcessorBatch>/project_assets.lock
|
||||
-P ${LY_ROOT_FOLDER}/cmake/CommandExecution.cmake
|
||||
EXEC_COMMAND $<TARGET_FILE:AZ::AssetProcessorBatch>
|
||||
--zeroAnalysisMode
|
||||
--project-path=${project_real_path}
|
||||
--platforms=${LY_ASSET_DEPLOY_ASSET_TYPE}
|
||||
)
|
||||
set_target_properties(${project_name}.Assets
|
||||
PROPERTIES
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
FOLDER ${project_name}
|
||||
)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Monolithic game
|
||||
################################################################################
|
||||
|
||||
@@ -729,6 +729,9 @@ bool CCryEditDoc::SaveModified()
|
||||
void CCryEditDoc::OnFileSaveAs()
|
||||
{
|
||||
CLevelFileDialog levelFileDialog(false);
|
||||
levelFileDialog.show();
|
||||
levelFileDialog.adjustSize();
|
||||
|
||||
if (levelFileDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
if (OnSaveDocument(levelFileDialog.GetFileName()))
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME})
|
||||
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME})
|
||||
|
||||
include(${pal_dir}/platform_traits_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
|
||||
include(${pal_dir}/platform_traits_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
|
||||
|
||||
if(PAL_TRAIT_AZTESTRUNNER_SUPPORTED)
|
||||
|
||||
ly_add_target(
|
||||
NAME AzTestRunner ${PAL_TRAIT_AZTESTRUNNER_LAUNCHER_TYPE}
|
||||
NAMESPACE AZ
|
||||
@@ -32,19 +32,23 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
AZ::AzTest
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
|
||||
ly_add_target(
|
||||
NAME AzTestRunner.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
aztestrunner_test_files.cmake
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzTest
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME AzTestRunner.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE AZ
|
||||
FILES_CMAKE
|
||||
aztestrunner_test_files.cmake
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzTest
|
||||
)
|
||||
ly_add_googletest(
|
||||
NAME AZ::AzTestRunner.Tests
|
||||
)
|
||||
|
||||
ly_add_googletest(
|
||||
NAME AZ::AzTestRunner.Tests
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(PAL_TRAIT_AZTESTRUNNER_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_AZTESTRUNNER_LAUNCHER_TYPE MODULE)
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(PAL_TRAIT_AZTESTRUNNER_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_AZTESTRUNNER_LAUNCHER_TYPE EXECUTABLE)
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(PAL_TRAIT_AZTESTRUNNER_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_AZTESTRUNNER_LAUNCHER_TYPE EXECUTABLE)
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(PAL_TRAIT_AZTESTRUNNER_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_AZTESTRUNNER_LAUNCHER_TYPE EXECUTABLE)
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(PAL_TRAIT_AZTESTRUNNER_SUPPORTED TRUE)
|
||||
set(PAL_TRAIT_AZTESTRUNNER_LAUNCHER_TYPE EXECUTABLE)
|
||||
|
||||
|
||||
@@ -151,7 +151,6 @@ namespace O3DE::ProjectManager
|
||||
|
||||
void ProjectButton::ReadySetup()
|
||||
{
|
||||
connect(m_projectImageLabel, &LabelButton::triggered, [this]() { emit OpenProject(m_projectInfo.m_path); });
|
||||
connect(m_projectImageLabel->GetBuildButton(), &QPushButton::clicked, [this](){ emit BuildProject(m_projectInfo); });
|
||||
|
||||
QMenu* menu = new QMenu(this);
|
||||
|
||||
@@ -452,9 +452,9 @@ namespace O3DE::ProjectManager
|
||||
return result;
|
||||
}
|
||||
|
||||
AZ::Outcome<GemInfo> PythonBindings::GetGemInfo(const QString& path)
|
||||
AZ::Outcome<GemInfo> PythonBindings::GetGemInfo(const QString& path, const QString& projectPath)
|
||||
{
|
||||
GemInfo gemInfo = GemInfoFromPath(pybind11::str(path.toStdString()));
|
||||
GemInfo gemInfo = GemInfoFromPath(pybind11::str(path.toStdString()), pybind11::str(projectPath.toStdString()));
|
||||
if (gemInfo.IsValid())
|
||||
{
|
||||
return AZ::Success(AZStd::move(gemInfo));
|
||||
@@ -473,7 +473,7 @@ namespace O3DE::ProjectManager
|
||||
{
|
||||
for (auto path : m_manifest.attr("get_engine_gems")())
|
||||
{
|
||||
gems.push_back(GemInfoFromPath(path));
|
||||
gems.push_back(GemInfoFromPath(path, pybind11::none()));
|
||||
}
|
||||
});
|
||||
if (!result.IsSuccess())
|
||||
@@ -494,7 +494,7 @@ namespace O3DE::ProjectManager
|
||||
pybind11::str pyProjectPath = projectPath.toStdString();
|
||||
for (auto path : m_manifest.attr("get_all_gems")(pyProjectPath))
|
||||
{
|
||||
gems.push_back(GemInfoFromPath(path));
|
||||
gems.push_back(GemInfoFromPath(path, pyProjectPath));
|
||||
}
|
||||
});
|
||||
if (!result.IsSuccess())
|
||||
@@ -632,12 +632,12 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
GemInfo PythonBindings::GemInfoFromPath(pybind11::handle path)
|
||||
GemInfo PythonBindings::GemInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath)
|
||||
{
|
||||
GemInfo gemInfo;
|
||||
gemInfo.m_path = Py_To_String(path);
|
||||
|
||||
auto data = m_manifest.attr("get_gem_json_data")(pybind11::none(), path);
|
||||
auto data = m_manifest.attr("get_gem_json_data")(pybind11::none(), path, pyProjectPath);
|
||||
if (pybind11::isinstance<pybind11::dict>(data))
|
||||
{
|
||||
try
|
||||
@@ -782,12 +782,12 @@ namespace O3DE::ProjectManager
|
||||
});
|
||||
}
|
||||
|
||||
ProjectTemplateInfo PythonBindings::ProjectTemplateInfoFromPath(pybind11::handle path)
|
||||
ProjectTemplateInfo PythonBindings::ProjectTemplateInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath)
|
||||
{
|
||||
ProjectTemplateInfo templateInfo;
|
||||
templateInfo.m_path = Py_To_String(pybind11::str(path));
|
||||
|
||||
auto data = m_manifest.attr("get_template_json_data")(pybind11::none(), path);
|
||||
auto data = m_manifest.attr("get_template_json_data")(pybind11::none(), path, pyProjectPath);
|
||||
if (pybind11::isinstance<pybind11::dict>(data))
|
||||
{
|
||||
try
|
||||
@@ -829,14 +829,15 @@ namespace O3DE::ProjectManager
|
||||
return templateInfo;
|
||||
}
|
||||
|
||||
AZ::Outcome<QVector<ProjectTemplateInfo>> PythonBindings::GetProjectTemplates()
|
||||
AZ::Outcome<QVector<ProjectTemplateInfo>> PythonBindings::GetProjectTemplates(const QString& projectPath)
|
||||
{
|
||||
QVector<ProjectTemplateInfo> templates;
|
||||
|
||||
bool result = ExecuteWithLock([&] {
|
||||
pybind11::str pyProjectPath = projectPath.toStdString();
|
||||
for (auto path : m_manifest.attr("get_templates_for_project_creation")())
|
||||
{
|
||||
templates.push_back(ProjectTemplateInfoFromPath(path));
|
||||
templates.push_back(ProjectTemplateInfoFromPath(path, pyProjectPath));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace O3DE::ProjectManager
|
||||
bool SetEngineInfo(const EngineInfo& engineInfo) override;
|
||||
|
||||
// Gem
|
||||
AZ::Outcome<GemInfo> GetGemInfo(const QString& path) override;
|
||||
AZ::Outcome<GemInfo> GetGemInfo(const QString& path, const QString& projectPath = {}) override;
|
||||
AZ::Outcome<QVector<GemInfo>, AZStd::string> GetEngineGemInfos() override;
|
||||
AZ::Outcome<QVector<GemInfo>, AZStd::string> GetAllGemInfos(const QString& projectPath) override;
|
||||
AZ::Outcome<QVector<AZStd::string>, AZStd::string> GetEnabledGemNames(const QString& projectPath) override;
|
||||
@@ -55,16 +55,16 @@ namespace O3DE::ProjectManager
|
||||
AZ::Outcome<void, AZStd::string> RemoveGemFromProject(const QString& gemPath, const QString& projectPath) override;
|
||||
|
||||
// ProjectTemplate
|
||||
AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates() override;
|
||||
AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates(const QString& projectPath = {}) override;
|
||||
|
||||
private:
|
||||
AZ_DISABLE_COPY_MOVE(PythonBindings);
|
||||
|
||||
AZ::Outcome<void, AZStd::string> ExecuteWithLockErrorHandling(AZStd::function<void()> executionCallback);
|
||||
bool ExecuteWithLock(AZStd::function<void()> executionCallback);
|
||||
GemInfo GemInfoFromPath(pybind11::handle path);
|
||||
GemInfo GemInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath);
|
||||
ProjectInfo ProjectInfoFromPath(pybind11::handle path);
|
||||
ProjectTemplateInfo ProjectTemplateInfoFromPath(pybind11::handle path);
|
||||
ProjectTemplateInfo ProjectTemplateInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath);
|
||||
bool RegisterThisEngine();
|
||||
bool StartPython();
|
||||
bool StopPython();
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace O3DE::ProjectManager
|
||||
* @param path the absolute path to the Gem
|
||||
* @return an outcome with GemInfo on success
|
||||
*/
|
||||
virtual AZ::Outcome<GemInfo> GetGemInfo(const QString& path) = 0;
|
||||
virtual AZ::Outcome<GemInfo> GetGemInfo(const QString& path, const QString& projectPath = {}) = 0;
|
||||
|
||||
/**
|
||||
* Get all available gem infos. This concatenates gems registered by the engine and the project.
|
||||
@@ -147,7 +147,7 @@ namespace O3DE::ProjectManager
|
||||
* Get info about all known project templates
|
||||
* @return an outcome with ProjectTemplateInfos on success
|
||||
*/
|
||||
virtual AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates() = 0;
|
||||
virtual AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates(const QString& projectPath = {}) = 0;
|
||||
};
|
||||
|
||||
using PythonBindingsInterface = AZ::Interface<IPythonBindings>;
|
||||
|
||||
Reference in New Issue
Block a user