Merge branch 'stabilization/2106' into JsonSerialization/UnsupportedWarnings
This commit is contained in:
@@ -9,18 +9,6 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
#! Adds the --project-path argument to the VS IDE debugger command arguments
|
||||
function(add_vs_debugger_arguments)
|
||||
# Inject the project root into the --project-path argument into the Visual Studio Debugger arguments by defaults
|
||||
list(APPEND app_targets AutomatedTesting.GameLauncher AutomatedTesting.ServerLauncher)
|
||||
list(APPEND app_targets AssetBuilder AssetProcessor AssetProcessorBatch Editor)
|
||||
foreach(app_target IN LISTS app_targets)
|
||||
if (TARGET ${app_target})
|
||||
set_property(TARGET ${app_target} APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${CMAKE_CURRENT_LIST_DIR}\"")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
if(NOT PROJECT_NAME)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
project(AutomatedTesting
|
||||
@@ -30,7 +18,6 @@ if(NOT PROJECT_NAME)
|
||||
include(EngineFinder.cmake OPTIONAL)
|
||||
find_package(o3de REQUIRED)
|
||||
o3de_initialize()
|
||||
add_vs_debugger_arguments()
|
||||
else()
|
||||
# Add the project_name to global LY_PROJECTS_TARGET_NAME property
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json)
|
||||
|
||||
+11746
-38
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:92fae957e7559bc486cf11d454dda4e066c1d25f03f7ff43d76f0869c54fec4e
|
||||
size 41820
|
||||
oid sha256:68193ec6abac0cb04fd9842d540814d31655b8ffd1c5a9ff1086fe800c0c8c72
|
||||
size 40812
|
||||
|
||||
+1100
-66
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:46eadb0c54b22ef320639c05086abb3df6147623da0a15ff85e52a752c1114b4
|
||||
size 38908
|
||||
oid sha256:bf9aa8e1075a1f1c3e3e15958106e4f79760e37abfc4e87b823712873984cb8d
|
||||
size 19516
|
||||
|
||||
+123005
-16
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d032e52065468197a83056aabe8565b4add43e046c3bcd0d838c2f41cb96607
|
||||
size 33420
|
||||
oid sha256:2cf646a0a977c2edc5ee2ab6351ef633f194ce60c59ea3cb8359f71648db668e
|
||||
size 374492
|
||||
|
||||
@@ -322,12 +322,6 @@ namespace AzFramework
|
||||
//! @param optionalArgs Optional additional arguments, see BarrierOptionalArgs.
|
||||
virtual void Barrier(EntitySpawnTicket& ticket, BarrierCallback completionCallback, BarrierOptionalArgs optionalArgs = {}) = 0;
|
||||
|
||||
//! Register a handler for OnSpawned events.
|
||||
virtual void AddOnSpawnedHandler(AZ::Event<AZ::Data::Asset<Spawnable>>::Handler& handler) = 0;
|
||||
|
||||
//! Register a handler for OnDespawned events.
|
||||
virtual void AddOnDespawnedHandler(AZ::Event<AZ::Data::Asset<Spawnable>>::Handler& handler) = 0;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] virtual AZStd::pair<EntitySpawnTicket::Id, void*> CreateTicket(AZ::Data::Asset<Spawnable>&& spawnable) = 0;
|
||||
virtual void DestroyTicket(void* ticket) = 0;
|
||||
|
||||
@@ -150,16 +150,6 @@ namespace AzFramework
|
||||
QueueRequest(ticket, optionalArgs.m_priority, AZStd::move(queueEntry));
|
||||
}
|
||||
|
||||
void SpawnableEntitiesManager::AddOnSpawnedHandler(AZ::Event<AZ::Data::Asset<Spawnable>>::Handler& handler)
|
||||
{
|
||||
handler.Connect(m_onSpawnedEvent);
|
||||
}
|
||||
|
||||
void SpawnableEntitiesManager::AddOnDespawnedHandler(AZ::Event<AZ::Data::Asset<Spawnable>>::Handler& handler)
|
||||
{
|
||||
handler.Connect(m_onDespawnedEvent);
|
||||
}
|
||||
|
||||
auto SpawnableEntitiesManager::ProcessQueue(CommandQueuePriority priority) -> CommandQueueStatus
|
||||
{
|
||||
CommandQueueStatus result = CommandQueueStatus::NoCommandsLeft;
|
||||
@@ -320,8 +310,6 @@ namespace AzFramework
|
||||
ticket.m_spawnedEntities.begin() + spawnedEntitiesInitialCount, ticket.m_spawnedEntities.end()));
|
||||
}
|
||||
|
||||
m_onSpawnedEvent.Signal(ticket.m_spawnable);
|
||||
|
||||
ticket.m_currentRequestId++;
|
||||
return true;
|
||||
}
|
||||
@@ -401,8 +389,6 @@ namespace AzFramework
|
||||
ticket.m_spawnedEntities.begin() + spawnedEntitiesInitialCount, ticket.m_spawnedEntities.end()));
|
||||
}
|
||||
|
||||
m_onSpawnedEvent.Signal(ticket.m_spawnable);
|
||||
|
||||
ticket.m_currentRequestId++;
|
||||
return true;
|
||||
}
|
||||
@@ -434,8 +420,6 @@ namespace AzFramework
|
||||
request.m_completionCallback(request.m_ticketId);
|
||||
}
|
||||
|
||||
m_onDespawnedEvent.Signal(ticket.m_spawnable);
|
||||
|
||||
ticket.m_currentRequestId++;
|
||||
return true;
|
||||
}
|
||||
@@ -463,8 +447,6 @@ namespace AzFramework
|
||||
}
|
||||
}
|
||||
|
||||
m_onDespawnedEvent.Signal(ticket.m_spawnable);
|
||||
|
||||
// Rebuild the list of entities.
|
||||
ticket.m_spawnedEntities.clear();
|
||||
const Spawnable::EntityList& entities = request.m_spawnable->GetEntities();
|
||||
@@ -517,8 +499,6 @@ namespace AzFramework
|
||||
|
||||
ticket.m_currentRequestId++;
|
||||
|
||||
m_onSpawnedEvent.Signal(ticket.m_spawnable);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -73,9 +73,6 @@ namespace AzFramework
|
||||
|
||||
void Barrier(EntitySpawnTicket& spawnInfo, BarrierCallback completionCallback, BarrierOptionalArgs optionalArgs = {}) override;
|
||||
|
||||
void AddOnSpawnedHandler(AZ::Event<AZ::Data::Asset<Spawnable>>::Handler& handler) override;
|
||||
void AddOnDespawnedHandler(AZ::Event<AZ::Data::Asset<Spawnable>>::Handler& handler) override;
|
||||
|
||||
//
|
||||
// The following function is thread safe but intended to be run from the main thread.
|
||||
//
|
||||
@@ -200,9 +197,6 @@ namespace AzFramework
|
||||
Queue m_highPriorityQueue;
|
||||
Queue m_regularPriorityQueue;
|
||||
|
||||
AZ::Event<AZ::Data::Asset<Spawnable>> m_onSpawnedEvent;
|
||||
AZ::Event<AZ::Data::Asset<Spawnable>> m_onDespawnedEvent;
|
||||
|
||||
AZ::SerializeContext* m_defaultSerializeContext { nullptr };
|
||||
//! The threshold used to determine if a request goes in the regular (if bigger than the value) or high priority queue (if smaller
|
||||
//! or equal to this value). The starting value of 64 is chosen as it's between default values SpawnablePriority_High and
|
||||
|
||||
+44
@@ -1447,6 +1447,49 @@ namespace AzToolsFramework
|
||||
GUI->SetBrowseButtonIcon(QIcon(iconPath.c_str()));
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ_CRC("EditCallback", 0xb74f2ee1))
|
||||
{
|
||||
PropertyAssetCtrl::EditCallbackType* func = azdynamic_cast<PropertyAssetCtrl::EditCallbackType*>(attrValue->GetAttribute());
|
||||
if (func)
|
||||
{
|
||||
GUI->SetEditButtonVisible(true);
|
||||
GUI->SetEditNotifyCallback(func);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI->SetEditNotifyCallback(nullptr);
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ_CRC("EditButton", 0x898c35dc))
|
||||
{
|
||||
GUI->SetEditButtonVisible(true);
|
||||
|
||||
AZStd::string iconPath;
|
||||
attrValue->Read<AZStd::string>(iconPath);
|
||||
|
||||
if (!iconPath.empty())
|
||||
{
|
||||
QString path(iconPath.c_str());
|
||||
|
||||
if (!QFile::exists(path))
|
||||
{
|
||||
AZ::IO::FixedMaxPathString engineRoot = AZ::Utils::GetEnginePath();
|
||||
QDir engineDir = !engineRoot.empty() ? QDir(QString(engineRoot.c_str())) : QDir::current();
|
||||
|
||||
path = engineDir.absoluteFilePath(iconPath.c_str());
|
||||
}
|
||||
|
||||
GUI->SetEditButtonIcon(QIcon(path));
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ_CRC("EditDescription", 0x9b52634a))
|
||||
{
|
||||
AZStd::string buttonTooltip;
|
||||
if (attrValue->Read<AZStd::string>(buttonTooltip))
|
||||
{
|
||||
GUI->SetEditButtonTooltip(tr(buttonTooltip.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleAssetPropertyHandlerDefault::WriteGUIValuesIntoProperty(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node)
|
||||
@@ -1476,6 +1519,7 @@ namespace AzToolsFramework
|
||||
// Set the hint in case the asset is not able to be found by assetId
|
||||
GUI->SetCurrentAssetHint(instance.GetAssetPath());
|
||||
GUI->SetSelectedAssetID(assetId, instance.GetAssetType());
|
||||
GUI->SetEditNotifyTarget(node->GetParent()->GetInstance(0));
|
||||
|
||||
GUI->blockSignals(false);
|
||||
return false;
|
||||
|
||||
@@ -126,6 +126,10 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
|
||||
FOLDER ${project_name}
|
||||
)
|
||||
|
||||
if(LY_DEFAULT_PROJECT_PATH)
|
||||
set_property(TARGET ${project_name}.GameLauncher APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${LY_DEFAULT_PROJECT_PATH}\"")
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Server
|
||||
################################################################################
|
||||
@@ -166,6 +170,10 @@ foreach(project_name project_path IN ZIP_LISTS LY_PROJECTS_TARGET_NAME LY_PROJEC
|
||||
PROPERTIES
|
||||
FOLDER ${project_name}
|
||||
)
|
||||
|
||||
if(LY_DEFAULT_PROJECT_PATH)
|
||||
set_property(TARGET ${project_name}.ServerLauncher APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${LY_DEFAULT_PROJECT_PATH}\"")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -1277,7 +1277,6 @@ void CEntityObject::OnEvent(ObjectEvent event)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
AZ_TracePrintf("CEntityObject", "Unhandled object event: %d", event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void CViewportTitleDlg::SetupOverflowMenu()
|
||||
|
||||
overFlowMenu->addSeparator();
|
||||
|
||||
m_enableAngleSnappingAction = new QAction("Enable Grid Snapping", overFlowMenu);
|
||||
m_enableAngleSnappingAction = new QAction("Enable Angle Snapping", overFlowMenu);
|
||||
connect(m_enableAngleSnappingAction, &QAction::triggered, this, &CViewportTitleDlg::OnAngleSnappingToggled);
|
||||
m_enableAngleSnappingAction->setCheckable(true);
|
||||
overFlowMenu->addAction(m_enableAngleSnappingAction);
|
||||
|
||||
@@ -28,6 +28,10 @@ ly_add_target(
|
||||
AZ::AzToolsFramework
|
||||
)
|
||||
|
||||
if(LY_DEFAULT_PROJECT_PATH)
|
||||
set_property(TARGET AssetBuilder APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${LY_DEFAULT_PROJECT_PATH}\"")
|
||||
endif()
|
||||
|
||||
# Aggregates all combined AssetBuilders into a single LY_ASSET_BUILDERS #define
|
||||
get_property(asset_builders GLOBAL PROPERTY LY_ASSET_BUILDERS)
|
||||
string (REPLACE ";" "," asset_builders "${asset_builders}")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "o3de_editor.ico"
|
||||
@@ -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>;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#
|
||||
|
||||
set(FILES
|
||||
Resources/ProjectManager.rc
|
||||
Resources/ProjectManager.qrc
|
||||
Resources/ProjectManager.qss
|
||||
Source/main.cpp
|
||||
|
||||
@@ -775,6 +775,12 @@ namespace AZ
|
||||
material = materialAssignment.m_materialInstance;
|
||||
}
|
||||
|
||||
if (!material)
|
||||
{
|
||||
AZ_Warning("MeshFeatureProcessor", false, "No material provided for mesh. Skipping.");
|
||||
continue;
|
||||
}
|
||||
|
||||
// retrieve vertex/index buffers
|
||||
RPI::ModelLod::StreamBufferViewList streamBufferViews;
|
||||
[[maybe_unused]] bool result = modelLod->GetStreamsForMesh(
|
||||
|
||||
@@ -103,9 +103,7 @@ namespace EMotionFX
|
||||
->Attribute("Hidden", AZ::Edit::Attributes::PropertyHidden)
|
||||
->VirtualProperty("PlayTime", "GetPlayTime", "PlayTime")
|
||||
->Event("Motion", &SimpleMotionComponentRequestBus::Events::Motion)
|
||||
->Attribute(AZ::Script::Attributes::Ignore, true)
|
||||
->Event("GetMotion", &SimpleMotionComponentRequestBus::Events::GetMotion)
|
||||
->Attribute(AZ::Script::Attributes::Ignore, true)
|
||||
->VirtualProperty("Motion", "GetMotion", "Motion")
|
||||
->Event("BlendInTime", &SimpleMotionComponentRequestBus::Events::BlendInTime)
|
||||
->Event("GetBlendInTime", &SimpleMotionComponentRequestBus::Events::GetBlendInTime)
|
||||
|
||||
-1
@@ -70,7 +70,6 @@ namespace EMotionFX
|
||||
->Attribute("Hidden", AZ::Edit::Attributes::PropertyHidden)
|
||||
->VirtualProperty("PreviewInEditor", "GetPreviewInEditor", "SetPreviewInEditor")
|
||||
->Event("GetAssetDuration", &EditorSimpleMotionComponentRequestBus::Events::GetAssetDuration)
|
||||
->Attribute(AZ::Script::Attributes::Ignore, true)
|
||||
;
|
||||
|
||||
behaviorContext->Class<EditorSimpleMotionComponent>()
|
||||
|
||||
@@ -718,7 +718,8 @@ namespace EditorPythonBindings
|
||||
|
||||
for (int arg = 0; arg < args.size(); arg++)
|
||||
{
|
||||
argv[arg + 1] = Py_DecodeLocale(args[arg].data(), nullptr);
|
||||
AZStd::string argString(args[arg]);
|
||||
argv[arg + 1] = Py_DecodeLocale(argString.c_str(), nullptr);
|
||||
}
|
||||
// Tell Python the command-line args.
|
||||
// Note that this has a side effect of adding the script's path to the set of directories checked for "import" commands.
|
||||
|
||||
@@ -86,7 +86,6 @@ namespace LmbrCentral
|
||||
{
|
||||
behaviorContext->Class<TagComponentBehaviorHelper>("Tag Helper")
|
||||
->Method("Get Entities by Tag", &TagComponentBehaviorHelper::FindTaggedEntities)
|
||||
->Attribute(AZ::Script::Attributes::Ignore, 0)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Gameplay/Tag")
|
||||
->Attribute(AZ::ScriptCanvasAttributes::FloatingFunction, 0)
|
||||
;
|
||||
|
||||
@@ -107,6 +107,7 @@ namespace LyShineEditor
|
||||
void LyShineEditorSystemComponent::Activate()
|
||||
{
|
||||
AzToolsFramework::EditorEventsBus::Handler::BusConnect();
|
||||
LyShine::LyShineRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -119,6 +120,7 @@ namespace LyShineEditor
|
||||
|
||||
CUiAnimViewSequenceManager::Destroy();
|
||||
}
|
||||
LyShine::LyShineRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorEventsBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -191,4 +193,17 @@ namespace LyShineEditor
|
||||
}
|
||||
return AzToolsFramework::AssetBrowser::SourceFileDetails();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void LyShineEditorSystemComponent::EditUICanvas([[maybe_unused]] const AZStd::string_view& canvasPath)
|
||||
{
|
||||
AzToolsFramework::OpenViewPane(LyViewPane::UiEditor);
|
||||
AZStd::string stringPath = canvasPath;
|
||||
|
||||
if (!stringPath.empty())
|
||||
{
|
||||
QString absoluteName = stringPath.c_str();
|
||||
UiEditorDLLBus::Broadcast(&UiEditorDLLInterface::OpenSourceCanvasFile, absoluteName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <LyShine/LyShineBus.h>
|
||||
|
||||
namespace LyShineEditor
|
||||
{
|
||||
@@ -22,6 +23,7 @@ namespace LyShineEditor
|
||||
: public AZ::Component
|
||||
, protected AzToolsFramework::EditorEvents::Bus::Handler
|
||||
, protected AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
|
||||
, protected LyShine::LyShineRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(LyShineEditorSystemComponent, "{64D08A3F-A682-4CAF-86C1-DA91638494BA}");
|
||||
@@ -55,5 +57,10 @@ namespace LyShineEditor
|
||||
void AddSourceFileOpeners(const char* fullSourceFileName, const AZ::Uuid& /*sourceUUID*/, AzToolsFramework::AssetBrowser::SourceFileOpenerList& openers) override;
|
||||
AzToolsFramework::AssetBrowser::SourceFileDetails GetSourceFileDetails(const char* fullSourceFileName) override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// LyShineRequestBus interface implementation
|
||||
void EditUICanvas(const AZStd::string_view& canvasPath) override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
@@ -24,6 +25,8 @@ namespace LyShine
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
// Public functions
|
||||
|
||||
virtual void EditUICanvas(const AZStd::string_view&) {};
|
||||
};
|
||||
using LyShineRequestBus = AZ::EBus<LyShineRequests>;
|
||||
} // namespace LyShine
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <LyShine/Bus/UiCanvasBus.h>
|
||||
#include <LyShine/LyShineBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! UiCanvasAssetRefNotificationBus Behavior context handler class
|
||||
@@ -177,7 +178,10 @@ void UiCanvasAssetRefComponent::Reflect(AZ::ReflectContext* context)
|
||||
|
||||
editInfo->DataElement("SimpleAssetRef", &UiCanvasAssetRefComponent::m_canvasAssetRef,
|
||||
"Canvas pathname", "The pathname of the canvas.")
|
||||
->Attribute("BrowseIcon", ":/stylesheet/img/UI20/browse-edit-select-files.svg");
|
||||
->Attribute("BrowseIcon", ":/stylesheet/img/UI20/browse-edit-select-files.svg")
|
||||
->Attribute("EditButton", "")
|
||||
->Attribute("EditDescription", "Open in UI Editor")
|
||||
->Attribute("EditCallback", &UiCanvasAssetRefComponent::LaunchUIEditor);
|
||||
editInfo->DataElement(AZ::Edit::UIHandlers::CheckBox, &UiCanvasAssetRefComponent::m_isAutoLoad,
|
||||
"Load automatically", "When checked, the canvas is loaded when this component is activated.")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ_CRC("RefreshEntireTree", 0xefbc823c));
|
||||
@@ -209,6 +213,12 @@ void UiCanvasAssetRefComponent::Reflect(AZ::ReflectContext* context)
|
||||
// PROTECTED MEMBER FUNCTIONS
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void UiCanvasAssetRefComponent::LaunchUIEditor([[maybe_unused]] const AZ::Data::AssetId& assetId, const AZ::Data::AssetType&)
|
||||
{
|
||||
LyShine::LyShineRequestBus::Broadcast(&LyShine::LyShineRequests::EditUICanvas, GetCanvasPathname());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void UiCanvasAssetRefComponent::Activate()
|
||||
{
|
||||
|
||||
@@ -69,6 +69,8 @@ public: // static member functions
|
||||
|
||||
protected: // member functions
|
||||
|
||||
void LaunchUIEditor(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType&);
|
||||
|
||||
// AZ::Component
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
|
||||
@@ -1220,8 +1220,18 @@ namespace ScriptCanvas
|
||||
|
||||
void GraphToLua::WriteClassPropertyRead(Grammar::ExecutionTreeConstPtr execution)
|
||||
{
|
||||
WriteFunctionCallInput(execution, 0, IsFormatStringInput::No);
|
||||
m_dotLua.Write(".%s", Grammar::ToIdentifier(execution->GetName()).c_str());
|
||||
if (execution->GetInputCount() > 0)
|
||||
{
|
||||
WriteFunctionCallInput(execution, 0, IsFormatStringInput::No);
|
||||
m_dotLua.Write(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's a constant
|
||||
WriteResolvedScope(execution, execution->GetNameLexicalScope());
|
||||
}
|
||||
|
||||
m_dotLua.Write(Grammar::ToIdentifier(execution->GetName()).c_str());
|
||||
}
|
||||
|
||||
void GraphToLua::WriteClassPropertyWrite(Grammar::ExecutionTreeConstPtr execution)
|
||||
@@ -1509,20 +1519,7 @@ namespace ScriptCanvas
|
||||
}
|
||||
else
|
||||
{
|
||||
const AZStd::string resolvedScope = ResolveScope(lexicalScope.m_namespaces);
|
||||
|
||||
auto& abbreviation = FindAbbreviation(resolvedScope);
|
||||
|
||||
if (!abbreviation.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", abbreviation.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
else if (!resolvedScope.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", resolvedScope.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
WriteResolvedScope(execution, lexicalScope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2413,5 +2410,28 @@ namespace ScriptCanvas
|
||||
}
|
||||
}
|
||||
|
||||
void GraphToLua::WriteResolvedScope(Grammar::ExecutionTreeConstPtr execution, const Grammar::LexicalScope& lexicalScope)
|
||||
{
|
||||
if (lexicalScope.m_type != Grammar::LexicalScopeType::Class && lexicalScope.m_type != Grammar::LexicalScopeType::Namespace)
|
||||
{
|
||||
AddError(execution, aznew Internal::ParseError(execution->GetNodeId(), "Invalid arguments to WriteResolvedScope."));
|
||||
return;
|
||||
}
|
||||
|
||||
const AZStd::string resolvedScope = ResolveScope(lexicalScope.m_namespaces);
|
||||
|
||||
auto& abbreviation = FindAbbreviation(resolvedScope);
|
||||
|
||||
if (!abbreviation.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", abbreviation.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
else if (!resolvedScope.empty())
|
||||
{
|
||||
m_dotLua.Write("%s%.*s", resolvedScope.c_str(),
|
||||
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ namespace ScriptCanvas
|
||||
void WriteOperatorArithmetic(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution, const AZStd::vector<AZStd::pair<const Slot*, Grammar::OutputAssignmentConstPtr>>& output);
|
||||
void WriteResolvedScope(Grammar::ExecutionTreeConstPtr execution, const Grammar::LexicalScope& lexicalScope);
|
||||
void WriteReturnStatement(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteReturnValueInitialization(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteStaticInitializerInput(IsLeadingCommaRequired commaRequired);
|
||||
@@ -170,7 +171,6 @@ namespace ScriptCanvas
|
||||
void WriteVariableWrite(Grammar::ExecutionTreeConstPtr execution, const AZStd::vector<AZStd::pair<const Slot*, Grammar::OutputAssignmentConstPtr>>& output);
|
||||
void WriteWrittenMathExpression(Grammar::ExecutionTreeConstPtr execution);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+1173
File diff suppressed because it is too large
Load Diff
@@ -53,6 +53,7 @@ namespace ScriptCanvasTestingNodes
|
||||
->Method("SetString", &BehaviorContextObjectTest::SetString)
|
||||
->Method("GetString", &BehaviorContextObjectTest::GetString)
|
||||
->Property("Name", BehaviorValueProperty(&BehaviorContextObjectTest::m_name))
|
||||
->Constant("Always24", BehaviorConstant(24))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ScriptCanvasTestFixture, UseBehaviorContextClassConstant)
|
||||
{
|
||||
RunUnitTestGraph("LY_SC_UnitTest_UseBehaviorContextClassConstant");
|
||||
}
|
||||
|
||||
TEST_F(ScriptCanvasTestFixture, ParseFunctionIfBranchWithConnectedInput)
|
||||
{
|
||||
RunUnitTestGraph("LY_SC_UnitTest_ParseFunctionIfBranchWithConnectedInput");
|
||||
|
||||
@@ -167,6 +167,7 @@ namespace StartingPointInput
|
||||
{ "actionName", "The name of the Input event action used to create an InputEventNotificationId" } } });
|
||||
|
||||
behaviorContext->EBus<InputEventNotificationBus>("InputEventNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
|
||||
->Handler<BehaviorInputEventNotificationBusHandler>()
|
||||
->Event("OnPressed", &InputEventNotificationBus::Events::OnPressed)
|
||||
->Event("OnHeld", &InputEventNotificationBus::Events::OnHeld)
|
||||
|
||||
@@ -11,18 +11,6 @@
|
||||
#
|
||||
# {END_LICENSE}
|
||||
|
||||
#! Adds the --project-path argument to the VS IDE debugger command arguments
|
||||
function(add_vs_debugger_arguments)
|
||||
# Inject the project root into the --project-path argument into the Visual Studio Debugger arguments by defaults
|
||||
list(APPEND app_targets ${Name}.GameLauncher ${Name}.ServerLauncher)
|
||||
list(APPEND app_targets AssetBuilder AssetProcessor AssetProcessorBatch Editor)
|
||||
foreach(app_target IN LISTS app_targets)
|
||||
if (TARGET ${app_target})
|
||||
set_property(TARGET ${app_target} APPEND PROPERTY VS_DEBUGGER_COMMAND_ARGUMENTS "--project-path=\"${CMAKE_CURRENT_LIST_DIR}\"")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
if(NOT PROJECT_NAME)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
project(${Name}
|
||||
@@ -32,7 +20,6 @@ if(NOT PROJECT_NAME)
|
||||
include(EngineFinder.cmake OPTIONAL)
|
||||
find_package(o3de REQUIRED)
|
||||
o3de_initialize()
|
||||
add_vs_debugger_arguments()
|
||||
else()
|
||||
# Add the project_name to global LY_PROJECTS_TARGET_NAME property
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json)
|
||||
|
||||
+79
-21
@@ -40,26 +40,52 @@ def add_gem_dependency(cmake_file: pathlib.Path,
|
||||
# on a line by basis, see if there already is {gem_name}
|
||||
# find the first occurrence of a gem, copy its formatting and replace
|
||||
# the gem name with the new one and append it
|
||||
# if the gem is already present fail
|
||||
t_data = []
|
||||
added = False
|
||||
line_index_to_append = None
|
||||
with open(cmake_file, 'r') as s:
|
||||
start_marker_line_index = None
|
||||
end_marker_line_index = None
|
||||
with cmake_file.open('r') as s:
|
||||
in_gem_list = False
|
||||
line_index = 0
|
||||
for line in s:
|
||||
if line.strip().startswith(enable_gem_start_marker):
|
||||
line_index_to_append = line_index
|
||||
if f'{gem_name}' == line.strip():
|
||||
logger.warning(f'{gem_name} is already enabled in file {str(cmake_file)}.')
|
||||
return 0
|
||||
parsed_line = line.strip()
|
||||
if parsed_line.startswith(enable_gem_start_marker):
|
||||
# Skip pass the 'set(ENABLED_GEMS' marker just in case their are gems declared on the same line
|
||||
parsed_line = parsed_line[len(enable_gem_start_marker):]
|
||||
# Set the flag to indicate that we are in the ENABLED_GEMS variable
|
||||
in_gem_list = True
|
||||
start_marker_line_index = line_index
|
||||
|
||||
if in_gem_list:
|
||||
# Since we are inside the ENABLED_GEMS variable determine if the line has the end_marker of ')'
|
||||
if parsed_line.endswith(enable_gem_end_marker):
|
||||
# Strip away the line end marker
|
||||
parsed_line = parsed_line[:-len(enable_gem_end_marker)]
|
||||
# Set the flag to indicate that we are no longer in the ENABLED_GEMS variable after this line
|
||||
in_gem_list = False
|
||||
end_marker_line_index = line_index
|
||||
|
||||
# Split the rest of the line on whitespace just in case there are multiple gems in a line
|
||||
gem_name_list = map(lambda gem_name: gem_name.strip('"'), parsed_line.split())
|
||||
if gem_name in gem_name_list:
|
||||
logger.warning(f'{gem_name} is already enabled in file {str(cmake_file)}.')
|
||||
return 0
|
||||
|
||||
t_data.append(line)
|
||||
line_index += 1
|
||||
|
||||
|
||||
indent = 4
|
||||
if line_index_to_append:
|
||||
# Insert the gem after the 'set(ENABLED_GEMS)...` line
|
||||
t_data.insert(line_index_to_append + 1, f'{" " * indent}{gem_name}\n')
|
||||
if start_marker_line_index:
|
||||
# Make sure if there is a enable gem start marker, there is an end marker as well
|
||||
if not end_marker_line_index:
|
||||
logger.error(f'The Enable Gem start marker of "{enable_gem_start_marker}" has been found, but not the'
|
||||
f' Enable Gem end marker of "{enable_gem_end_marker}"')
|
||||
return 1
|
||||
|
||||
# Insert the gem before the ')' end marker
|
||||
end_marker_partition = list(t_data[end_marker_line_index].rpartition(enable_gem_end_marker))
|
||||
end_marker_partition[1] = f'{" " * indent}{gem_name}\n' + end_marker_partition[1]
|
||||
t_data[end_marker_line_index] = ''.join(end_marker_partition)
|
||||
added = True
|
||||
|
||||
# if we didn't add, then create a new set(ENABLED_GEMS) variable
|
||||
@@ -71,7 +97,7 @@ def add_gem_dependency(cmake_file: pathlib.Path,
|
||||
t_data.append(f'{enable_gem_end_marker}\n')
|
||||
|
||||
# write the cmake
|
||||
with open(cmake_file, 'w') as s:
|
||||
with cmake_file.open('w') as s:
|
||||
s.writelines(t_data)
|
||||
|
||||
return 0
|
||||
@@ -90,12 +116,44 @@ def remove_gem_dependency(cmake_file: pathlib.Path,
|
||||
|
||||
# on a line by basis, remove any line with {gem_name}
|
||||
t_data = []
|
||||
# Remove the gem from the enabled_gem file by skipping the gem name entry
|
||||
removed = False
|
||||
with open(cmake_file, 'r') as s:
|
||||
|
||||
with cmake_file.open('r') as s:
|
||||
in_gem_list = False
|
||||
for line in s:
|
||||
if gem_name == line.strip():
|
||||
removed = True
|
||||
# Strip whitespace from both ends of the line, but keep track of the leading whitespace
|
||||
# for indenting the result line
|
||||
parsed_line = line.lstrip()
|
||||
indent = line[:-len(parsed_line)]
|
||||
parsed_line = parsed_line.rstrip()
|
||||
result_line = indent
|
||||
if parsed_line.startswith(enable_gem_start_marker):
|
||||
# Skip pass the 'set(ENABLED_GEMS' marker just in case their are gems declared on the same line
|
||||
parsed_line = parsed_line[len(enable_gem_start_marker):]
|
||||
result_line += enable_gem_start_marker
|
||||
# Set the flag to indicate that we are in the ENABLED_GEMS variable
|
||||
in_gem_list = True
|
||||
|
||||
if in_gem_list:
|
||||
# Since we are inside the ENABLED_GEMS variable determine if the line has the end_marker of ')'
|
||||
if parsed_line.endswith(enable_gem_end_marker):
|
||||
# Strip away the line end marker
|
||||
parsed_line = parsed_line[:-len(enable_gem_end_marker)]
|
||||
# Set the flag to indicate that we are no longer in the ENABLED_GEMS variable after this line
|
||||
in_gem_list = False
|
||||
# Split the rest of the line on whitespace just in case there are multiple gems in a line
|
||||
# Strip double quotes surround any gem name
|
||||
gem_name_list = list(map(lambda gem_name: gem_name.strip('"'), parsed_line.split()))
|
||||
while gem_name in gem_name_list:
|
||||
gem_name_list.remove(gem_name)
|
||||
removed = True
|
||||
|
||||
# Append the renaming gems to the line
|
||||
result_line += ' '.join(gem_name_list)
|
||||
# If the in_gem_list was flipped to false, that means the currently parsed line contained the
|
||||
# line end marker, so append that to the result_line
|
||||
result_line += enable_gem_end_marker if not in_gem_list else ''
|
||||
t_data.append(result_line + '\n')
|
||||
else:
|
||||
t_data.append(line)
|
||||
|
||||
@@ -104,14 +162,14 @@ def remove_gem_dependency(cmake_file: pathlib.Path,
|
||||
return 1
|
||||
|
||||
# write the cmake
|
||||
with open(cmake_file, 'w') as s:
|
||||
with cmake_file.open('w') as s:
|
||||
s.writelines(t_data)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def get_project_gems(project_path: pathlib.Path,
|
||||
platform: str = 'Common') -> set:
|
||||
platform: str = 'Common') -> set:
|
||||
return get_gems_from_cmake_file(get_enabled_gem_cmake_file(project_path=project_path, platform=platform))
|
||||
|
||||
|
||||
@@ -145,7 +203,7 @@ def get_enabled_gems(cmake_file: pathlib.Path) -> set:
|
||||
# Set the flag to indicate that we are no longer in the ENABLED_GEMS variable after this line
|
||||
in_gem_list = False
|
||||
# Split the rest of the line on whitespace just in case there are multiple gems in a line
|
||||
gem_name_list = line.split()
|
||||
gem_name_list = list(map(lambda gem_name: gem_name.strip('"'), line.split()))
|
||||
gem_target_set.update(gem_name_list)
|
||||
|
||||
return gem_target_set
|
||||
@@ -156,7 +214,7 @@ def get_project_gem_paths(project_path: pathlib.Path,
|
||||
gem_names = get_project_gems(project_path, platform)
|
||||
gem_paths = set()
|
||||
for gem_name in gem_names:
|
||||
gem_paths.add(manifest.get_registered(gem_name=gem_name))
|
||||
gem_paths.add(manifest.get_registered(gem_name=gem_name, project_path=project_path))
|
||||
return gem_paths
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ def disable_gem_in_project(gem_name: str = None,
|
||||
|
||||
# if gem name resolve it into a path
|
||||
if gem_name and not gem_path:
|
||||
gem_path = manifest.get_registered(gem_name=gem_name)
|
||||
gem_path = manifest.get_registered(gem_name=gem_name, project_path=project_path)
|
||||
if not gem_path:
|
||||
logger.error(f'Unable to locate gem path from the registered manifest.json files:'
|
||||
f' {str(pathlib.Path.home() / ".o3de/manifest.json")},'
|
||||
@@ -78,7 +78,7 @@ def disable_gem_in_project(gem_name: str = None,
|
||||
|
||||
|
||||
# Read gem.json from the gem path
|
||||
gem_json_data = manifest.get_gem_json_data(gem_path=gem_path)
|
||||
gem_json_data = manifest.get_gem_json_data(gem_path=gem_path, project_path=project_path)
|
||||
if not gem_json_data:
|
||||
logger.error(f'Could not read gem.json content under {gem_path}.')
|
||||
return 1
|
||||
|
||||
@@ -64,7 +64,7 @@ def enable_gem_in_project(gem_name: str = None,
|
||||
|
||||
# if gem name resolve it into a path
|
||||
if gem_name and not gem_path:
|
||||
gem_path = manifest.get_registered(gem_name=gem_name)
|
||||
gem_path = manifest.get_registered(gem_name=gem_name, project_path=project_path)
|
||||
if not gem_path:
|
||||
logger.error(f'Unable to locate gem path from the registered manifest.json files:'
|
||||
f' {str(pathlib.Path( "~/.o3de/o3de_manifest.json").expanduser())},'
|
||||
@@ -78,7 +78,7 @@ def enable_gem_in_project(gem_name: str = None,
|
||||
return 1
|
||||
|
||||
# Read gem.json from the gem path
|
||||
gem_json_data = manifest.get_gem_json_data(gem_path=gem_path)
|
||||
gem_json_data = manifest.get_gem_json_data(gem_path=gem_path, project_path=project_path)
|
||||
if not gem_json_data:
|
||||
logger.error(f'Could not read gem.json content under {gem_path}.')
|
||||
return 1
|
||||
|
||||
@@ -354,7 +354,7 @@ def get_all_templates(project_path: pathlib.Path = None) -> list:
|
||||
return list(dict.fromkeys(templates_data))
|
||||
|
||||
|
||||
def get_all_restricted() -> list:
|
||||
def get_all_restricted(project_path: pathlib.Path = None) -> list:
|
||||
restricted_data = get_restricted()
|
||||
restricted_data.extend(get_engine_restricted())
|
||||
if project_path:
|
||||
@@ -488,14 +488,14 @@ def get_project_json_data(project_name: str = None,
|
||||
return None
|
||||
|
||||
|
||||
def get_gem_json_data(gem_name: str = None,
|
||||
gem_path: str or pathlib.Path = None) -> dict or None:
|
||||
def get_gem_json_data(gem_name: str = None, gem_path: str or pathlib.Path = None,
|
||||
project_path: pathlib.Path = None) -> dict or None:
|
||||
if not gem_name and not gem_path:
|
||||
logger.error('Must specify either a Gem name or Gem Path.')
|
||||
return None
|
||||
|
||||
if gem_name and not gem_path:
|
||||
gem_path = get_registered(gem_name=gem_name)
|
||||
gem_path = get_registered(gem_name=gem_name, project_path=project_path)
|
||||
|
||||
if not gem_path:
|
||||
logger.error(f'Gem Path {gem_path} has not been registered.')
|
||||
@@ -521,14 +521,14 @@ def get_gem_json_data(gem_name: str = None,
|
||||
return None
|
||||
|
||||
|
||||
def get_template_json_data(template_name: str = None,
|
||||
template_path: str or pathlib.Path = None) -> dict or None:
|
||||
def get_template_json_data(template_name: str = None, template_path: str or pathlib.Path = None,
|
||||
project_path: pathlib.Path = None) -> dict or None:
|
||||
if not template_name and not template_path:
|
||||
logger.error('Must specify either a Template name or Template Path.')
|
||||
return None
|
||||
|
||||
if template_name and not template_path:
|
||||
template_path = get_registered(template_name=template_name)
|
||||
template_path = get_registered(template_name=template_name, project_path=project_path)
|
||||
|
||||
if not template_path:
|
||||
logger.error(f'Template Path {template_path} has not been registered.')
|
||||
@@ -554,14 +554,14 @@ def get_template_json_data(template_name: str = None,
|
||||
return None
|
||||
|
||||
|
||||
def get_restricted_json_data(restricted_name: str = None,
|
||||
restricted_path: str or pathlib.Path = None) -> dict or None:
|
||||
def get_restricted_json_data(restricted_name: str = None, restricted_path: str or pathlib.Path = None,
|
||||
project_path: pathlib.Path = None) -> dict or None:
|
||||
if not restricted_name and not restricted_path:
|
||||
logger.error('Must specify either a Restricted name or Restricted Path.')
|
||||
return None
|
||||
|
||||
if restricted_name and not restricted_path:
|
||||
restricted_path = get_registered(restricted_name=restricted_name)
|
||||
restricted_path = get_registered(restricted_name=restricted_name, project_path=project_path)
|
||||
|
||||
if not restricted_path:
|
||||
logger.error(f'Restricted Path {restricted_path} has not been registered.')
|
||||
@@ -593,7 +593,32 @@ def get_registered(engine_name: str = None,
|
||||
template_name: str = None,
|
||||
default_folder: str = None,
|
||||
repo_name: str = None,
|
||||
restricted_name: str = None) -> pathlib.Path or None:
|
||||
restricted_name: str = None,
|
||||
project_path: pathlib.Path = None) -> pathlib.Path or None:
|
||||
"""
|
||||
Looks up a registered entry in either the ~/.o3de/o3de_manifest.json, <this-engine-root>/engine.json
|
||||
or the <project-path>/project.json (if the project_path parameter is supplied)
|
||||
|
||||
:param engine_name: Name of a registered engine to lookup in the ~/.o3de/o3de_manifest.json file
|
||||
:param project_name: Name of a project to lookup in either the ~/.o3de/o3de_manifest.json or
|
||||
<this-engine-root>/engine.json file
|
||||
:param gem_name: Name of a gem to lookup in either the ~/.o3de/o3de_manifest.json, <this-engine-root>/engine.json
|
||||
or <project-path>/project.json. NOTE: The project_path parameter must be supplied to lookup the registration
|
||||
with the project.json
|
||||
:param template_name: Name of a template to lookup in either the ~/.o3de/o3de_manifest.json, <this-engine-root>/engine.json
|
||||
or <project-path>/project.json. NOTE: The project_path parameter must be supplied to lookup the registration
|
||||
with the project.json
|
||||
:param repo_name: Name of a repo to lookup in the ~/.o3de/o3de_manifest.json
|
||||
:param default_folder: Type of "default" folder to lookup in the ~/.o3de/o3de_manifest.json
|
||||
Valid values are "engines", "projects", "gems", "templates,", "restricted"
|
||||
:param restricted_name: Name of a restricted directory object to lookup in either the ~/.o3de/o3de_manifest.json,
|
||||
<this-engine-root>/engine.json or <project-path>/project.json.
|
||||
NOTE: The project_path parameter must be supplied to lookup the registration with the project.json
|
||||
:param project_path: Path to project root, which is used to examined the project.json file in order to
|
||||
query either gems, templates or restricted directories registered with the project
|
||||
|
||||
:return path value associated with the registered object name if found. Otherwise None is returned
|
||||
"""
|
||||
json_data = load_o3de_manifest()
|
||||
|
||||
# check global first then this engine
|
||||
@@ -627,7 +652,7 @@ def get_registered(engine_name: str = None,
|
||||
return project_path
|
||||
|
||||
elif isinstance(gem_name, str):
|
||||
gems = get_all_gems()
|
||||
gems = get_all_gems(project_path)
|
||||
for gem_path in gems:
|
||||
gem_path = pathlib.Path(gem_path).resolve()
|
||||
gem_json = gem_path / 'gem.json'
|
||||
@@ -642,7 +667,7 @@ def get_registered(engine_name: str = None,
|
||||
return gem_path
|
||||
|
||||
elif isinstance(template_name, str):
|
||||
templates = get_all_templates()
|
||||
templates = get_all_templates(project_path)
|
||||
for template_path in templates:
|
||||
template_path = pathlib.Path(template_path).resolve()
|
||||
template_json = template_path / 'template.json'
|
||||
@@ -657,7 +682,7 @@ def get_registered(engine_name: str = None,
|
||||
return template_path
|
||||
|
||||
elif isinstance(restricted_name, str):
|
||||
restricted = get_all_restricted()
|
||||
restricted = get_all_restricted(project_path)
|
||||
for restricted_path in restricted:
|
||||
restricted_path = pathlib.Path(restricted_path).resolve()
|
||||
restricted_json = restricted_path / 'restricted.json'
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import unittest.mock
|
||||
|
||||
import pytest
|
||||
import pathlib
|
||||
from unittest.mock import patch
|
||||
@@ -67,3 +69,164 @@ class TestGetEnabledGems:
|
||||
enabled_gems_set = cmake.get_enabled_gems(pathlib.Path('enabled_gems.cmake'))
|
||||
|
||||
assert enabled_gems_set == expected_set
|
||||
|
||||
|
||||
class TestAddGemDependency:
|
||||
@pytest.mark.parametrize(
|
||||
"enable_gems_cmake_data, expected_set, expected_return", [
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS foo bar baz)
|
||||
""", set(['foo', 'bar', 'baz', 'TestGem']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
)
|
||||
""", set(['foo', 'bar', 'baz', 'TestGem']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS
|
||||
foo
|
||||
bar
|
||||
baz)
|
||||
""", set(['foo', 'bar', 'baz', 'TestGem']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS
|
||||
foo bar
|
||||
baz)
|
||||
""", set(['foo', 'bar', 'baz', 'TestGem']), 0),
|
||||
pytest.param("""
|
||||
""", set(['TestGem']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(RANDOM_VARIABLE TestGame, TestProject Test Engine)
|
||||
set(ENABLED_GEMS HelloWorld IceCream
|
||||
foo
|
||||
baz bar
|
||||
baz baz baz baz baz morebaz lessbaz
|
||||
)
|
||||
Random Text
|
||||
""", set(['HelloWorld', 'IceCream', 'foo', 'bar', 'baz', 'morebaz', 'lessbaz', 'TestGem']),
|
||||
0),
|
||||
pytest.param("""
|
||||
set(ENABLED_GEMS foo bar baz
|
||||
""", set(['foo', 'bar', 'baz']), 1),
|
||||
]
|
||||
)
|
||||
def test_add_gem_dependency(self, enable_gems_cmake_data, expected_set, expected_return):
|
||||
enabled_gems_set = set()
|
||||
add_gem_return = None
|
||||
|
||||
class StringBufferIOWrapper(io.StringIO):
|
||||
def __init__(self):
|
||||
nonlocal enable_gems_cmake_data
|
||||
super().__init__(enable_gems_cmake_data)
|
||||
def __enter__(self):
|
||||
return super().__enter__()
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
nonlocal enable_gems_cmake_data
|
||||
enable_gems_cmake_data = super().getvalue()
|
||||
super().__exit__(exc_tb, exc_val, exc_tb)
|
||||
|
||||
|
||||
with patch('pathlib.Path.resolve', return_value=pathlib.Path('enabled_gems.cmake')) as pathlib_is_resolve_mock,\
|
||||
patch('pathlib.Path.is_file', return_value=True) as pathlib_is_file_mock,\
|
||||
patch('pathlib.Path.open', side_effect=lambda mode: StringBufferIOWrapper()) as pathlib_open_mock:
|
||||
|
||||
add_gem_return = cmake.add_gem_dependency(pathlib.Path('enabled_gems.cmake'), 'TestGem')
|
||||
enabled_gems_set = cmake.get_enabled_gems(pathlib.Path('enabled_gems.cmake'))
|
||||
|
||||
assert add_gem_return == expected_return
|
||||
assert enabled_gems_set == expected_set
|
||||
|
||||
|
||||
class TestRemoveGemDependency:
|
||||
@pytest.mark.parametrize(
|
||||
"enable_gems_cmake_data, expected_set, expected_return", [
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS foo bar baz TestGem)
|
||||
""", set(['foo', 'bar', 'baz']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
TestGem
|
||||
)
|
||||
""", set(['foo', 'bar', 'baz']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
TestGem)
|
||||
""", set(['foo', 'bar', 'baz']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS
|
||||
foo bar
|
||||
baz TestGem)
|
||||
""", set(['foo', 'bar', 'baz']), 0),
|
||||
pytest.param("""
|
||||
# Comment
|
||||
set(ENABLED_GEMS
|
||||
foo
|
||||
TestGem
|
||||
bar
|
||||
TestGem
|
||||
baz
|
||||
)
|
||||
Random Text
|
||||
""", set(['foo', 'bar', 'baz']),
|
||||
0),
|
||||
pytest.param("""
|
||||
set(ENABLED_GEMS
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
"TestGem"
|
||||
)
|
||||
""", set(['foo', 'bar', 'baz']), 0),
|
||||
pytest.param("""
|
||||
""", set(), 1),
|
||||
pytest.param("""
|
||||
set(ENABLED_GEMS
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
)
|
||||
""", set(['foo', 'bar', 'baz']), 1),
|
||||
]
|
||||
)
|
||||
def test_remove_gem_dependency(self, enable_gems_cmake_data, expected_set, expected_return):
|
||||
enabled_gems_set = set()
|
||||
add_gem_return = None
|
||||
|
||||
class StringBufferIOWrapper(io.StringIO):
|
||||
def __init__(self):
|
||||
nonlocal enable_gems_cmake_data
|
||||
super().__init__(enable_gems_cmake_data)
|
||||
def __enter__(self):
|
||||
return super().__enter__()
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
nonlocal enable_gems_cmake_data
|
||||
enable_gems_cmake_data = super().getvalue()
|
||||
super().__exit__(exc_tb, exc_val, exc_tb)
|
||||
|
||||
|
||||
with patch('pathlib.Path.resolve', return_value=pathlib.Path('enabled_gems.cmake')) as pathlib_is_resolve_mock,\
|
||||
patch('pathlib.Path.is_file', return_value=True) as pathlib_is_file_mock,\
|
||||
patch('pathlib.Path.open', side_effect=lambda mode: StringBufferIOWrapper()) as pathlib_open_mock:
|
||||
|
||||
add_gem_return = cmake.remove_gem_dependency(pathlib.Path('enabled_gems.cmake'), 'TestGem')
|
||||
enabled_gems_set = cmake.get_enabled_gems(pathlib.Path('enabled_gems.cmake'))
|
||||
|
||||
assert add_gem_return == expected_return
|
||||
assert enabled_gems_set == expected_set
|
||||
|
||||
Reference in New Issue
Block a user