Merge branch 'stabilization/2106' of https://github.com/aws-lumberyard/o3de into jckand/FoundationAutoStabilization

This commit is contained in:
jckand-amzn
2021-06-16 12:19:18 -05:00
163 changed files with 3136 additions and 561 deletions
@@ -406,6 +406,7 @@ namespace AZ
AZStd::vector<AZ::BehaviorParameter> eventParamsTypes{ AZStd::initializer_list<AZ::BehaviorParameter>{
CreateBehaviorEventParameter<decay_array<T>>()... } };
behaviorContext->Class<AZ::Event<T...>>()
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::ListOnly)
->Attribute(AZ::Script::Attributes::EventHandlerCreationFunction, createHandlerHolder)
->Attribute(AZ::Script::Attributes::EventParameterTypes, eventParamsTypes)
->Method("HasHandlerConnected", &AZ::Event<T...>::HasHandlerConnected)
@@ -413,6 +414,7 @@ namespace AZ
behaviorContext->Class<AZ::EventHandler<T...>>()
->Method("Disconnect", &AZ::EventHandler<T...>::Disconnect)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::ListOnly)
;
}
}
@@ -29,15 +29,20 @@ namespace Benchmark
{},
m_pathString));
auto& prefabDom = m_prefabSystemComponent->FindTemplateDom(instance->GetTemplateId());
for (auto _ : state)
{
state.PauseTiming();
AzFramework::Spawnable spawnable;
AzToolsFramework::Prefab::SpawnableUtils::CreateSpawnable(spawnable, prefabDom);
state.ResumeTiming();
// Create a vector to store spawnables so that they don't get destroyed immediately after construction.
AZStd::vector<AZStd::unique_ptr<AzFramework::Spawnable>> spawnables;
spawnables.reserve(numSpawnables);
for (int spwanableCounter = 0; spwanableCounter < numSpawnables; ++spwanableCounter)
{
AZStd::unique_ptr<AzFramework::Spawnable> spawnable = AZStd::make_unique<AzFramework::Spawnable>();
AzToolsFramework::Prefab::SpawnableUtils::CreateSpawnable(*spawnable, prefabDom);
spawnables.push_back(AZStd::move(spawnable));
}
}
state.SetComplexityN(numSpawnables);
@@ -50,3 +55,4 @@ namespace Benchmark
}
#endif
@@ -12,6 +12,7 @@
#include "BuilderManager.h"
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <native/connection/connectionManager.h>
@@ -186,10 +187,9 @@ namespace AssetProcessor
QDir projectCacheRoot;
AssetUtilities::ComputeProjectCacheRoot(projectCacheRoot);
QString gameName = AssetUtilities::ComputeProjectName();
QString projectPath = AssetUtilities::ComputeProjectPath();
QDir engineRoot;
AssetUtilities::ComputeEngineRoot(engineRoot);
AZ::SettingsRegistryInterface::FixedValueString projectName = AZ::Utils::GetProjectName();
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
AZ::IO::FixedMaxPathString enginePath = AZ::Utils::GetEnginePath();
int portNumber = 0;
ApplicationServerBus::BroadcastResult(portNumber, &ApplicationServerBus::Events::GetServerListeningPort);
@@ -197,14 +197,14 @@ namespace AssetProcessor
AZStd::string params;
#if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
params = AZStd::string::format(
R"(-task=%s -id="%s" -project-name="%s" -project-cache-path="%s" -project-path="%s" -engine-path="%s" -port %d)", task,
builderGuid.c_str(), gameName.toUtf8().constData(), projectCacheRoot.absolutePath().toUtf8().constData(),
projectPath.toUtf8().constData(), engineRoot.absolutePath().toUtf8().constData(), portNumber);
R"(-task=%s -id="%s" -project-name="%s" -project-cache-path="%s" -project-path="%s" -engine-path="%s" -port %d)",
task, builderGuid.c_str(), projectName.c_str(), projectCacheRoot.absolutePath().toUtf8().constData(),
projectPath.c_str(), enginePath.c_str(), portNumber);
#else
params = AZStd::string::format(
R"(-task=%s -id="%s" -project-name="\"%s\"" -project-cache-path="\"%s\"" -project-path="\"%s\"" -engine-path="\"%s\"" -port %d)",
task, builderGuid.c_str(), gameName.toUtf8().constData(), projectCacheRoot.absolutePath().toUtf8().constData(),
projectPath.toUtf8().constData(), engineRoot.absolutePath().toUtf8().constData(), portNumber);
task, builderGuid.c_str(), projectName.c_str(), projectCacheRoot.absolutePath().toUtf8().constData(),
projectPath.c_str(), enginePath.c_str(), portNumber);
#endif // !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
if (moduleFilePath && moduleFilePath[0])
@@ -151,7 +151,7 @@ namespace AZ
SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
if (serializeContext)
{
serializeContext->Class<AssImpAnimationImporter, SceneCore::LoadingComponent>()->Version(4); // [LYN-3971] Bone pruning crash fix in AssImp SDK
serializeContext->Class<AssImpAnimationImporter, SceneCore::LoadingComponent>()->Version(5); // [LYN-4226] Invert PostRotation matrix in animation chains
}
}
@@ -417,7 +417,7 @@ namespace AZ
AZ::IO::FileIOStream sourceMtlfileStream(inputMetalFile.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary);
if (!sourceMtlfileStream.IsOpen())
{
AZ_Error(platformName, false, "Failed because the shader file \"%s\" could not be opened", inputMetalFile);
AZ_Error(platformName, false, "Failed because the shader file \"%s\" could not be opened", inputMetalFile.c_str());
return false;
}
@@ -0,0 +1,43 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
namespace AZ
{
namespace RPI
{
//! Bus for post-load initialization of assets.
//! Assets that need to do post-load initialization should connect to this bus in their asset handler's LoadAssetData() function.
//! Be sure to disconnect from this bus as soon as initialization is complete, as it will be called every frame.
//! (Note this bus is needed rather than utilizing TickBus because TickBus is not protected by a mutex which means it can't be
//! connected on an asset load job thread).
class AssetInitEvents
: public EBusTraits
{
public:
// EBus Configuration
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
typedef AZStd::recursive_mutex MutexType;
//! This function is called every frame on the main thread to perform any necessary post-load initialization.
//! Connect to the bus after loading the asset data, and disconnect when initialization is complete.
//! @return whether initialization was successful
virtual bool PostLoadInit() = 0;
};
using AssetInitBus = AZ::EBus<AssetInitEvents>;
} // namespace RPI
} // namespace AZ
@@ -12,6 +12,7 @@
#pragma once
#include <Atom/RPI.Public/Shader/ShaderVariant.h>
#include <Atom/RPI.Public/Shader/ShaderReloadNotificationBus.h>
#include <Atom/RPI.Reflect/Shader/ShaderAsset.h>
#include <Atom/RPI.Reflect/Shader/ShaderOptionGroup.h>
@@ -57,6 +58,7 @@ namespace AZ
: public Data::InstanceData
, public Data::AssetBus::Handler
, public ShaderVariantFinderNotificationBus::Handler
, public ShaderReloadNotificationBus::Handler
{
friend class ShaderSystem;
public:
@@ -149,6 +151,15 @@ namespace AZ
void OnShaderVariantTreeAssetReady(Data::Asset<ShaderVariantTreeAsset> /*shaderVariantTreeAsset*/, bool /*isError*/) override {};
void OnShaderVariantAssetReady(Data::Asset<ShaderVariantAsset> shaderVariantAsset, bool IsError) override;
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
// ShaderReloadNotificationBus overrides...
void OnShaderAssetReinitialized(const Data::Asset<ShaderAsset>& shaderAsset) override;
// Note we don't need OnShaderVariantReinitialized because the Shader class doesn't do anything with the data inside
// the ShaderVariant object. The only thing we might want to do is propagate the message upward, but that's unnecessary
// because the ShaderReloadNotificationBus uses the Shader's AssetId as the ID for all messages including those from the variants.
// And of course we don't need to handle OnShaderReinitialized because this *is* this Shader.
///////////////////////////////////////////////////////////////////
/// Returns the path to the pipeline library cache file.
AZStd::string GetPipelineLibraryPath() const;
@@ -15,6 +15,7 @@
#include <AzCore/std/containers/vector.h>
#include <AtomCore/std/containers/array_view.h>
#include <Atom/RPI.Public/AssetInitBus.h>
#include <Atom/RPI.Reflect/Base.h>
#include <Atom/RPI.Reflect/Material/MaterialTypeAsset.h>
#include <Atom/RPI.Reflect/Material/MaterialPropertyValue.h>
@@ -38,6 +39,7 @@ namespace AZ
: public AZ::Data::AssetData
, public Data::AssetBus::Handler
, public MaterialReloadNotificationBus::Handler
, public AssetInitBus::Handler
{
friend class MaterialAssetCreator;
friend class MaterialAssetHandler;
@@ -90,13 +92,17 @@ namespace AZ
AZStd::array_view<MaterialPropertyValue> GetPropertyValues() const;
private:
bool PostLoadInit();
bool PostLoadInit() override;
//! Called by asset creators to assign the asset to a ready state.
void SetReady();
// AssetBus overrides...
void OnAssetReloaded(Data::Asset<Data::AssetData> asset) override;
void OnAssetReady(Data::Asset<Data::AssetData> asset) override;
//! Replaces the MaterialTypeAsset when a reload occurs
void ReinitializeMaterialTypeAsset(Data::Asset<Data::AssetData> asset);
// MaterialReloadNotificationBus overrides...
void OnMaterialTypeAssetReinitialized(const Data::Asset<MaterialTypeAsset>& materialTypeAsset) override;
@@ -17,6 +17,7 @@
#include <AzCore/EBus/Event.h>
#include <AtomCore/std/containers/array_view.h>
#include <Atom/RPI.Public/AssetInitBus.h>
#include <Atom/RPI.Reflect/Base.h>
#include <Atom/RPI.Reflect/Material/ShaderCollection.h>
#include <Atom/RPI.Reflect/Material/MaterialPropertiesLayout.h>
@@ -52,6 +53,7 @@ namespace AZ
class MaterialTypeAsset
: public AZ::Data::AssetData
, public Data::AssetBus::MultiHandler
, public AssetInitBus::Handler
{
friend class MaterialTypeAssetCreator;
friend class MaterialTypeAssetHandler;
@@ -100,13 +102,17 @@ namespace AZ
MaterialUvNameMap GetUvNameMap() const;
private:
bool PostLoadInit();
bool PostLoadInit() override;
//! Called by asset creators to assign the asset to a ready state.
void SetReady();
// AssetBus overrides...
void OnAssetReloaded(Data::Asset<Data::AssetData> asset) override;
void OnAssetReady(Data::Asset<Data::AssetData> asset) override;
//! Replaces the appropriate asset members when a reload occurs
void ReinitializeAsset(Data::Asset<Data::AssetData> asset);
//! Holds values for each material property, used to initialize Material instances.
//! This is indexed by MaterialPropertyIndex and aligns with entries in m_materialPropertiesLayout.
@@ -15,6 +15,7 @@
#include <AzCore/std/optional.h>
#include <AzCore/EBus/Event.h>
#include <Atom/RPI.Public/AssetInitBus.h>
#include <Atom/RPI.Reflect/Asset/AssetHandler.h>
#include <Atom/RPI.Reflect/Shader/ShaderOptionGroupLayout.h>
#include <Atom/RPI.Reflect/Shader/ShaderVariantAsset.h>
@@ -40,6 +41,7 @@ namespace AZ
: public Data::AssetData
, public ShaderVariantFinderNotificationBus::Handler
, public Data::AssetBus::Handler
, public AssetInitBus::Handler
{
friend class ShaderAssetCreator;
friend class ShaderAssetHandler;
@@ -134,8 +136,11 @@ namespace AZ
///////////////////////////////////////////////////////////////////
/// AssetBus overrides
void OnAssetReloaded(Data::Asset<Data::AssetData> asset) override;
void OnAssetReady(Data::Asset<Data::AssetData> asset) override;
///////////////////////////////////////////////////////////////////
void ReinitializeRootShaderVariant(Data::Asset<Data::AssetData> asset);
///////////////////////////////////////////////////////////////////
/// ShaderVariantFinderNotificationBus overrides
void OnShaderVariantTreeAssetReady(Data::Asset<ShaderVariantTreeAsset> shaderVariantTreeAsset, bool isError) override;
@@ -165,8 +170,13 @@ namespace AZ
RHI::ShaderStageAttributeMapList m_attributeMaps;
};
bool FinalizeAfterLoad();
bool PostLoadInit() override;
void SetReady();
//! SelectShaderApiData() must be called before most other ShaderAsset functions.
bool SelectShaderApiData();
//! Returns the active ShaderApiDataContainer which was selected in SelectShaderApiData().
ShaderApiDataContainer& GetCurrentShaderApiData();
const ShaderApiDataContainer& GetCurrentShaderApiData() const;
@@ -216,7 +226,6 @@ namespace AZ
const Data::Asset<Data::AssetData>& asset,
AZStd::shared_ptr<Data::AssetDataStream> stream,
const Data::AssetFilterCB& assetLoadFilterCB) override;
Data::AssetHandler::LoadResult PostLoadInit(const Data::Asset<Data::AssetData>& asset);
};
//////////////////////////////////////////////////////////////////////////
@@ -23,6 +23,7 @@
#include <Atom/RPI.Reflect/System/RenderPipelineDescriptor.h>
#include <Atom/RPI.Reflect/Asset/AssetUtils.h>
#include <Atom/RPI.Public/AssetInitBus.h>
#include <Atom/RPI.Public/FeatureProcessor.h>
#include <Atom/RPI.Public/GpuQuery/GpuQueryTypes.h>
#include <Atom/RPI.Public/Scene.h>
@@ -240,6 +241,8 @@ namespace AZ
}
AZ_ATOM_PROFILE_FUNCTION("RPI", "RPISystem: SimulationTick");
AssetInitBus::Broadcast(&AssetInitBus::Events::PostLoadInit);
// Update tick time info
FillTickTimeInfo();
@@ -21,7 +21,6 @@
#include <AtomCore/Instance/InstanceDatabase.h>
#include <AzCore/Interface/Interface.h>
#include <Atom/RPI.Public/Shader/ShaderReloadNotificationBus.h>
#include <Atom/RPI.Public/Shader/ShaderReloadDebugTracker.h>
namespace AZ
@@ -55,8 +54,9 @@ namespace AZ
RHI::ResultCode Shader::Init(ShaderAsset& shaderAsset)
{
Data::AssetBus::Handler::BusDisconnect();
ShaderReloadNotificationBus::Handler::BusDisconnect();
ShaderVariantFinderNotificationBus::Handler::BusDisconnect();
ShaderVariantFinderNotificationBus::Handler::BusConnect(shaderAsset.GetId());
RHI::RHISystemInterface* rhiSystem = RHI::RHISystemInterface::Get();
RHI::DrawListTagRegistry* drawListTagRegistry = rhiSystem->GetDrawListTagRegistry();
@@ -100,8 +100,10 @@ namespace AZ
AZ_Error("Shader", false, "Failed to acquire a DrawListTag. Entries are full.");
}
}
ShaderVariantFinderNotificationBus::Handler::BusConnect(m_asset.GetId());
Data::AssetBus::Handler::BusConnect(m_asset.GetId());
ShaderReloadNotificationBus::Handler::BusConnect(m_asset.GetId());
return RHI::ResultCode::Success;
}
@@ -110,6 +112,7 @@ namespace AZ
{
ShaderVariantFinderNotificationBus::Handler::BusDisconnect();
Data::AssetBus::Handler::BusDisconnect();
ShaderReloadNotificationBus::Handler::BusDisconnect();
if (m_pipelineLibraryHandle.IsValid())
{
@@ -139,7 +142,6 @@ namespace AZ
Data::Asset<ShaderAsset> newAsset = { asset.GetAs<ShaderAsset>(), AZ::Data::AssetLoadBehavior::PreLoad };
AZ_Assert(newAsset, "Reloaded ShaderAsset is null");
Data::AssetBus::Handler::BusDisconnect();
Init(*newAsset.Get());
ShaderReloadNotificationBus::Event(asset.GetId(), &ShaderReloadNotificationBus::Events::OnShaderReinitialized, *this);
}
@@ -196,6 +198,19 @@ namespace AZ
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
// ShaderReloadNotificationBus overrides...
void Shader::OnShaderAssetReinitialized(const Data::Asset<ShaderAsset>& shaderAsset)
{
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->Shader::OnShaderAssetReinitialized %s", this, shaderAsset.GetHint().c_str());
Init(*m_asset.Get());
ShaderReloadNotificationBus::Event(shaderAsset.GetId(), &ShaderReloadNotificationBus::Events::OnShaderReinitialized, *this);
}
///////////////////////////////////////////////////////////////////
ConstPtr<RHI::PipelineLibraryData> Shader::LoadPipelineLibrary() const
{
if (IO::FileIOBase::GetInstance())
@@ -18,6 +18,7 @@
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Component/TickBus.h>
namespace AZ
{
@@ -47,6 +48,7 @@ namespace AZ
{
MaterialReloadNotificationBus::Handler::BusDisconnect();
Data::AssetBus::Handler::BusDisconnect();
AssetInitBus::Handler::BusDisconnect();
}
const Data::Asset<MaterialTypeAsset>& MaterialAsset::GetMaterialTypeAsset() const
@@ -97,6 +99,8 @@ namespace AZ
{
if (!m_materialTypeAsset.Get())
{
AssetInitBus::Handler::BusDisconnect();
// Any MaterialAsset with invalid MaterialTypeAsset is not a successfully-loaded asset.
return false;
}
@@ -104,6 +108,8 @@ namespace AZ
{
Data::AssetBus::Handler::BusConnect(m_materialTypeAsset.GetId());
MaterialReloadNotificationBus::Handler::BusConnect(m_materialTypeAsset.GetId());
AssetInitBus::Handler::BusDisconnect();
return true;
}
@@ -116,11 +122,9 @@ namespace AZ
// Ultimately it's the Material that cares about these changes, so we just forward any signal we get.
MaterialReloadNotificationBus::Event(GetId(), &MaterialReloadNotifications::OnMaterialAssetReinitialized, Data::Asset<MaterialAsset>{this, AZ::Data::AssetLoadBehavior::PreLoad});
}
void MaterialAsset::OnAssetReloaded(Data::Asset<Data::AssetData> asset)
void MaterialAsset::ReinitializeMaterialTypeAsset(Data::Asset<Data::AssetData> asset)
{
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->MaterialAsset::OnAssetReloaded %s", this, asset.GetHint().c_str());
Data::Asset<MaterialTypeAsset> newMaterialTypeAsset = { asset.GetAs<MaterialTypeAsset>(), AZ::Data::AssetLoadBehavior::PreLoad };
if (newMaterialTypeAsset)
@@ -135,16 +139,31 @@ namespace AZ
}
}
void MaterialAsset::OnAssetReloaded(Data::Asset<Data::AssetData> asset)
{
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->MaterialAsset::OnAssetReloaded %s", this, asset.GetHint().c_str());
ReinitializeMaterialTypeAsset(asset);
}
void MaterialAsset::OnAssetReady(Data::Asset<Data::AssetData> asset)
{
// Regarding why we listen to both OnAssetReloaded and OnAssetReady, see explanation in ShaderAsset::OnAssetReady.
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->MaterialAsset::OnAssetReady %s", this, asset.GetHint().c_str());
ReinitializeMaterialTypeAsset(asset);
}
Data::AssetHandler::LoadResult MaterialAssetHandler::LoadAssetData(
const AZ::Data::Asset<AZ::Data::AssetData>& asset,
AZStd::shared_ptr<AZ::Data::AssetDataStream> stream,
const AZ::Data::AssetFilterCB& assetLoadFilterCB)
{
Data::AssetHandler::LoadResult baseResult = Base::LoadAssetData(asset, stream, assetLoadFilterCB);
bool postLoadResult = asset.GetAs<MaterialAsset>()->PostLoadInit();
return ((baseResult == Data::AssetHandler::LoadResult::LoadComplete) && postLoadResult) ?
Data::AssetHandler::LoadResult::LoadComplete :
Data::AssetHandler::LoadResult::Error;
if (Base::LoadAssetData(asset, stream, assetLoadFilterCB) == Data::AssetHandler::LoadResult::LoadComplete)
{
asset.GetAs<MaterialAsset>()->AssetInitBus::Handler::BusConnect();
return Data::AssetHandler::LoadResult::LoadComplete;
}
return Data::AssetHandler::LoadResult::Error;
}
} // namespace RPI
@@ -65,6 +65,7 @@ namespace AZ
MaterialTypeAsset::~MaterialTypeAsset()
{
Data::AssetBus::MultiHandler::BusDisconnect();
AssetInitBus::Handler::BusDisconnect();
}
const ShaderCollection& MaterialTypeAsset::GetShaderCollection() const
@@ -116,6 +117,8 @@ namespace AZ
Data::AssetBus::MultiHandler::BusConnect(shaderItem.GetShaderAsset().GetId());
}
AssetInitBus::Handler::BusDisconnect();
return true;
}
@@ -127,11 +130,9 @@ namespace AZ
assetToReplace = newAsset;
}
}
void MaterialTypeAsset::OnAssetReloaded(Data::Asset<Data::AssetData> asset)
void MaterialTypeAsset::ReinitializeAsset(Data::Asset<Data::AssetData> asset)
{
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->MaterialTypeAsset::OnAssetReloaded %s", this, asset.GetHint().c_str());
// The order of asset reloads is non-deterministic. If the MaterialTypeAsset reloads before these
// dependency assets, this will make sure the MaterialTypeAsset gets the latest ones when they reload.
// Or in some cases a these assets could get updated and reloaded without reloading the MaterialTypeAsset at all.
@@ -146,16 +147,31 @@ namespace AZ
MaterialReloadNotificationBus::Event(GetId(), &MaterialReloadNotifications::OnMaterialTypeAssetReinitialized, Data::Asset<MaterialTypeAsset>{this, AZ::Data::AssetLoadBehavior::PreLoad});
}
void MaterialTypeAsset::OnAssetReloaded(Data::Asset<Data::AssetData> asset)
{
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->MaterialTypeAsset::OnAssetReloaded %s", this, asset.GetHint().c_str());
ReinitializeAsset(asset);
}
void MaterialTypeAsset::OnAssetReady(Data::Asset<Data::AssetData> asset)
{
// Regarding why we listen to both OnAssetReloaded and OnAssetReady, see explanation in ShaderAsset::OnAssetReady.
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->MaterialTypeAsset::OnAssetReady %s", this, asset.GetHint().c_str());
ReinitializeAsset(asset);
}
AZ::Data::AssetHandler::LoadResult MaterialTypeAssetHandler::LoadAssetData(
const AZ::Data::Asset<AZ::Data::AssetData>& asset,
AZStd::shared_ptr<AZ::Data::AssetDataStream> stream,
const AZ::Data::AssetFilterCB& assetLoadFilterCB)
{
Data::AssetHandler::LoadResult baseResult = Base::LoadAssetData(asset, stream, assetLoadFilterCB);
bool postLoadResult = asset.GetAs<MaterialTypeAsset>()->PostLoadInit();
return ((baseResult == Data::AssetHandler::LoadResult::LoadComplete) && postLoadResult) ?
Data::AssetHandler::LoadResult::LoadComplete :
Data::AssetHandler::LoadResult::Error;
if (Base::LoadAssetData(asset, stream, assetLoadFilterCB) == Data::AssetHandler::LoadResult::LoadComplete)
{
asset.GetAs<MaterialTypeAsset>()->AssetInitBus::Handler::BusConnect();
return Data::AssetHandler::LoadResult::LoadComplete;
}
return Data::AssetHandler::LoadResult::Error;
}
}
@@ -85,6 +85,7 @@ namespace AZ
{
Data::AssetBus::Handler::BusDisconnect();
ShaderVariantFinderNotificationBus::Handler::BusDisconnect();
AssetInitBus::Handler::BusDisconnect();
}
const Name& ShaderAsset::GetName() const
@@ -331,8 +332,8 @@ namespace AZ
// We may only endup here when running in a Builder context.
return m_perAPIShaderData[0];
}
bool ShaderAsset::FinalizeAfterLoad()
bool ShaderAsset::SelectShaderApiData()
{
// Use the current RHI that is active to select which shader data to use.
// We don't assert if the Factory is not available because this method could be called during build time,
@@ -370,28 +371,51 @@ namespace AZ
}
}
return true;
}
bool ShaderAsset::PostLoadInit()
{
// Once the ShaderAsset is loaded, it is necessary to listen for changes in the Root Variant Asset.
Data::AssetBus::Handler::BusConnect(GetRootVariant().GetId());
ShaderVariantFinderNotificationBus::Handler::BusConnect(GetId());
AssetInitBus::Handler::BusDisconnect();
return true;
}
void ShaderAsset::ReinitializeRootShaderVariant(Data::Asset<Data::AssetData> asset)
{
Data::Asset<ShaderVariantAsset> shaderVariantAsset = { asset.GetAs<ShaderVariantAsset>(), AZ::Data::AssetLoadBehavior::PreLoad };
AZ_Assert(shaderVariantAsset->GetStableId() == RootShaderVariantStableId, "Was expecting to update the root variant");
GetCurrentShaderApiData().m_rootShaderVariantAsset = asset;
ShaderReloadNotificationBus::Event(GetId(), &ShaderReloadNotificationBus::Events::OnShaderAssetReinitialized, Data::Asset<ShaderAsset>{ this, AZ::Data::AssetLoadBehavior::PreLoad } );
}
///////////////////////////////////////////////////////////////////////
// AssetBus overrides...
void ShaderAsset::OnAssetReloaded(Data::Asset<Data::AssetData> asset)
{
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->ShaderAsset::OnAssetReloaded %s", this, asset.GetHint().c_str());
ReinitializeRootShaderVariant(asset);
}
void ShaderAsset::OnAssetReady(Data::Asset<Data::AssetData> asset)
{
// We have to listen to OnAssetReady, OnAssetReloaded isn't enough, because of the following scenario:
// The user changes a .shader file, which causes the AP to rebuild the ShaderAsset and root ShaderVariantAsset.
// 1) Thread A creates the new ShaderAsset, loads it, and gets the old ShaderVariantAsset.
// 2) Thread B creates the new ShaderVariantAsset, loads it, and calls OnAssetReloaded.
// 3) Main thread calls ShaderAsset::PostLoadInit which connects to the AssetBus but it's too late to receive OnAssetReloaded,
// so it continues using the old ShaderVariantAsset instead of the new one.
// The OnAssetReady bus function is called automatically whenever a connection to AssetBus is made, so listening to this gives
// us the opportunity to assign the appropriate ShaderVariantAsset.
Data::Asset<ShaderVariantAsset> shaderVariantAsset = { asset.GetAs<ShaderVariantAsset>(), AZ::Data::AssetLoadBehavior::PreLoad };
AZ_Assert(shaderVariantAsset->GetStableId() == RootShaderVariantStableId,
"Was expecting to update the root variant");
GetCurrentShaderApiData().m_rootShaderVariantAsset = asset;
ShaderReloadNotificationBus::Event(GetId(), &ShaderReloadNotificationBus::Events::OnShaderAssetReinitialized, Data::Asset<ShaderAsset>{ this, AZ::Data::AssetLoadBehavior::PreLoad } );
ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->ShaderAsset::OnAssetReady %s", this, asset.GetHint().c_str());
ReinitializeRootShaderVariant(asset);
}
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
/// ShaderVariantFinderNotificationBus overrides
void ShaderAsset::OnShaderVariantTreeAssetReady(Data::Asset<ShaderVariantTreeAsset> shaderVariantTreeAsset, bool isError)
@@ -425,25 +449,25 @@ namespace AZ
{
if (Base::LoadAssetData(asset, stream, assetLoadFilterCB) == Data::AssetHandler::LoadResult::LoadComplete)
{
return PostLoadInit(asset);
}
return Data::AssetHandler::LoadResult::Error;
}
ShaderAsset* shaderAsset = asset.GetAs<ShaderAsset>();
Data::AssetHandler::LoadResult ShaderAssetHandler::PostLoadInit(const Data::Asset<Data::AssetData>& asset)
{
if (ShaderAsset* shaderAsset = asset.GetAs<ShaderAsset>())
{
if (!shaderAsset->FinalizeAfterLoad())
// The shader API selection must occur immediately ofter loading, on the same thread, rather than
// deferring to AssetInitBus::PostLoadInit. Many functions in the ShaderAsset class are invalid
// until after SelectShaderApiData() is called and some client code may need to access data in
// the ShaderAsset before then.
if (!shaderAsset->SelectShaderApiData())
{
AZ_Error("ShaderAssetHandler", false, "Shader asset failed to finalize.");
return Data::AssetHandler::LoadResult::Error;
}
shaderAsset->AssetInitBus::Handler::BusConnect();
return Data::AssetHandler::LoadResult::LoadComplete;
}
return Data::AssetHandler::LoadResult::Error;
}
///////////////////////////////////////////////////////////////////////
} // namespace RPI
@@ -218,7 +218,7 @@ namespace AZ
return false;
}
if (!m_asset->FinalizeAfterLoad())
if (!m_asset->SelectShaderApiData())
{
ReportError("Failed to finalize the ShaderAsset.");
return false;
@@ -56,7 +56,7 @@ namespace AZ
AZ::Data::Asset<ShaderAsset> SerializeInHelper(const AZ::Data::AssetId& assetId)
{
AZ::Data::Asset<ShaderAsset> asset = Base::SerializeIn(assetId);
asset->FinalizeAfterLoad();
asset->SelectShaderApiData();
asset->SetReady();
return asset;
}
@@ -10,6 +10,7 @@
#
set(FILES
Include/Atom/RPI.Public/AssetInitBus.h
Include/Atom/RPI.Public/Base.h
Include/Atom/RPI.Public/Culling.h
Include/Atom/RPI.Public/FeatureProcessor.h
+4
View File
@@ -8,3 +8,7 @@
# 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.
#
add_subdirectory(LookDevelopmentStudioPixar)
add_subdirectory(ReferenceMaterials)
add_subdirectory(Sponza)
@@ -0,0 +1,15 @@
#
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME AtomContent_LookDevelopmentStudioPixar.Builders NAMESPACE Gem)
endif()
@@ -0,0 +1,15 @@
#
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME AtomContent_ReferenceMaterials.Builders NAMESPACE Gem)
endif()
+15
View File
@@ -0,0 +1,15 @@
#
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME AtomContent_Sponza.Builders NAMESPACE Gem)
endif()
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bb8c1839f46df4623818bc1b02f626d85d8f83d77cbeabd0d56c6a5c997c3ab3
size 495250984
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9bb547a502aa028624e3f95491d2e459860db5fdc5551eece757c271362c902d
size 42981863
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:962248929564f7a3a2a25813ba8ab83d72f2f4d8db71eb495bd650ad4eca5c25
size 8681159
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c5998edda6eb34ace8b7a5f63e72f922e0daebb6aeb453142b31e605157736d
size 17366289
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a79b82df3f6f908b2ed31f9247d9befde7daf0ff53c87479920c0463cc12d437
size 1308624196
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9892d5de71db58217f9c942f542c058891ab2f0949443c48111aa71fe621cae
size 128078160
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:353ff22364447796ec01799a16e6ee39fbcde337a5fee4de409069316eccbb8f
size 6942256
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e934a8772f33e6c7bc11e70071c5d14147d01d123a5bed3bd51fc861047f17cb
size 305364828
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:247402172cb0539faaae937659507bd72087e629004e3eb2e8f67df97063a92f
size 70531613
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aa4f9fbb9fc332fa0fb3f35df3b21ef72439073a854ad55d637efbed89ad3b3c
size 562609478
+5
View File
@@ -8,3 +8,8 @@
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME DevTextures.Builders NAMESPACE Gem)
endif()
@@ -21,6 +21,7 @@
#include <SceneAPI/SceneCore/Containers/Utilities/Filters.h>
#include <SceneAPI/SceneCore/Containers/Utilities/SceneGraphUtilities.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IMeshData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IBlendShapeData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IBoneData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/ISkinWeightData.h>
#include <SceneAPI/SceneCore/DataTypes/GraphData/IAnimationData.h>
@@ -172,10 +173,13 @@ namespace EMotionFX
AZ::SceneAPI::Events::ProcessingResult ActorGroupBehavior::BuildDefault(AZ::SceneAPI::Containers::Scene& scene) const
{
const bool hasBoneOrSkinData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike<AZ::SceneAPI::DataTypes::IBoneData>(scene, true) ||
AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike<AZ::SceneAPI::DataTypes::ISkinWeightData>(scene, true);
const bool hasAnimationData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike<AZ::SceneAPI::DataTypes::IAnimationData>(scene, true);
if (SceneHasActorGroup(scene) || !hasBoneOrSkinData || hasAnimationData)
const bool hasBoneData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike<AZ::SceneAPI::DataTypes::IBoneData>(scene, true);
const bool hasSkinData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike<AZ::SceneAPI::DataTypes::ISkinWeightData>(scene, true);
const bool hasBlendShapeData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike<AZ::SceneAPI::DataTypes::IBlendShapeData>(scene, true);
// Skip building the default actor in case a valid actor group with overwritten settings exists, or
// in the most common case for animation files, that do contain an animated skeleton while not containing a skin or blend shapes.
if (SceneHasActorGroup(scene) ||
(hasBoneData && (!hasSkinData && !hasBlendShapeData)))
{
return AZ::SceneAPI::Events::ProcessingResult::Ignored;
}
@@ -8,3 +8,8 @@
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME PBSreferenceMaterials.Builders NAMESPACE Gem)
endif()
+5
View File
@@ -8,3 +8,8 @@
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME PhysXSamples.Builders NAMESPACE Gem)
endif()
+5
View File
@@ -8,3 +8,8 @@
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME PhysicsEntities.Builders NAMESPACE Gem)
endif()
+6
View File
@@ -8,3 +8,9 @@
# 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.
#
# Add the PrimitiveAssets Asset-only gem as a Builder variant
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME PrimitiveAssets.Builders NAMESPACE Gem)
endif()
@@ -475,6 +475,11 @@ namespace
continue;
}
if (auto excludeFromPointer = AZ::FindAttribute(AZ::ScriptCanvasAttributes::Internal::ImplementedAsNodeGeneric, behaviorClass->m_attributes))
{
continue;
}
if (auto excludeFromPointer = AZ::FindAttribute(AZ::Script::Attributes::ExcludeFrom, behaviorClass->m_attributes))
{
AZ::Script::Attributes::ExcludeFlags excludeFlags{};
@@ -133,12 +133,12 @@
<addaction name="action_PresetsEditor"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuUtilities">
<!-- Disabled until tool is stabilized <widget class="QMenu" name="menuUtilities">
<property name="title">
<string>&amp;Utilities</string>
</property>
<addaction name="action_UpgradeTool"/>
</widget>
</widget> -->
<widget class="QMenu" name="menuSettings_2">
<property name="title">
<string>&amp;Preferences</string>
@@ -3764,6 +3764,12 @@ namespace ScriptCanvas
nextSlot = onceResetSlot;
}
if (!nextSlot)
{
AddError(ID.m_node->GetEntityId(), once, "Once node missing next slot, likely needs replacement");
return;
}
ParseExecutionTreeBody(nextParse, *nextSlot);
nextParse->MarkDebugEmptyStatement();
}
@@ -928,6 +928,7 @@ namespace ScriptCanvas
{
return execution->GetId().m_node
&& IsOnce(*execution->GetId().m_node)
&& execution->GetId().m_slot
&& execution->GetId().m_slot->GetType() == CombinedSlotType::ExecutionIn;
}
@@ -938,7 +939,7 @@ namespace ScriptCanvas
bool IsOnceReset(const Node& node, const Slot* slot)
{
return slot = OnceProperty::GetResetSlot(&node);
return slot == OnceProperty::GetResetSlot(&node);
}
bool IsOperatorArithmetic(const ExecutionTreeConstPtr& execution)
+5
View File
@@ -8,3 +8,8 @@
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME UiBasics.Builders NAMESPACE Gem)
endif()
@@ -8,3 +8,8 @@
# 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.
#
# This will export its "SourcePaths" to the generated "cmake_dependencies.<project>.assetbuilder.setreg"
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME Vegetation_Gem_Assets.Builders NAMESPACE Gem)
endif()
@@ -0,0 +1,18 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
# This will export the path to the directory containing the gem.json
# to the "SourcePaths" entry within the "cmake_dependencies.<project>.assetbuilder.setreg"
# which is generated when cmake is run
# This path is the gem root directory
if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_create_alias(NAME ${Name}.Builders NAMESPACE Gem)
endif()
+14
View File
@@ -0,0 +1,14 @@
{
"gem_name": "${Name}",
"origin": "The primary repo for ${Name} goes here: i.e. http://www.mydomain.com",
"license": "What license ${Name} uses goes here: i.e. https://opensource.org/licenses/MIT",
"display_name": "${Name}",
"summary": "A short description of ${Name}.",
"canonical_tags": [
"Gem"
],
"user_tags": [
"${Name}"
],
"icon_path": "preview.png"
}
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa
size 41127
+38
View File
@@ -0,0 +1,38 @@
{
"template_name": "AssetGem",
"origin": "The primary repo for AssetGem goes here: i.e. http://www.mydomain.com",
"license": "What license AssetGem uses goes here: i.e. https://opensource.org/licenses/MIT",
"display_name": "AssetGem",
"summary": "A short description of AssetGem template.",
"canonical_tags": [],
"user_tags": [
"AssetGem"
],
"icon_path": "preview.png",
"copyFiles": [
{
"file": "CMakeLists.txt",
"origin": "CMakeLists.txt",
"isTemplated": true,
"isOptional": false
},
{
"file": "gem.json",
"origin": "gem.json",
"isTemplated": true,
"isOptional": false
},
{
"file": "preview.png",
"origin": "preview.png",
"isTemplated": false,
"isOptional": false
}
],
"createDirectories": [
{
"dir": "Assets",
"origin": "Assets"
}
]
}
@@ -10,5 +10,5 @@
# {END_LICENSE}
set(FILES
Source/${Name}Module.cpp
Source/${Name}EditorModule.cpp
)
@@ -10,6 +10,8 @@
# {END_LICENSE}
set(FILES
Include/${Name}/${Name}Bus.h
Source/${Name}ModuleInterface.h
Source/${Name}SystemComponent.cpp
Source/${Name}SystemComponent.h
)
@@ -22,7 +22,7 @@ namespace ${SanitizedCppName}
class ${SanitizedCppName}Requests
{
public:
AZ_RTTI(${SanitizedCppName}Requests, "${Random_Uuid}");
AZ_RTTI(${SanitizedCppName}Requests, "{${Random_Uuid}}");
virtual ~${SanitizedCppName}Requests() = default;
// Put your public methods here
};
@@ -0,0 +1,51 @@
// {BEGIN_LICENSE}
/*
* 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.
*
*/
// {END_LICENSE}
#include <${Name}ModuleInterface.h>
#include <${Name}EditorSystemComponent.h>
namespace ${SanitizedCppName}
{
class ${SanitizedCppName}EditorModule
: public ${SanitizedCppName}ModuleInterface
{
public:
AZ_RTTI(${SanitizedCppName}EditorModule, "${ModuleClassId}", ${SanitizedCppName}ModuleInterface);
AZ_CLASS_ALLOCATOR(${SanitizedCppName}EditorModule, AZ::SystemAllocator, 0);
${SanitizedCppName}EditorModule()
{
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
// Add ALL components descriptors associated with this gem to m_descriptors.
// This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
// This happens through the [MyComponent]::Reflect() function.
m_descriptors.insert(m_descriptors.end(), {
${SanitizedCppName}EditorSystemComponent::CreateDescriptor(),
});
}
/**
* Add required SystemComponents to the SystemEntity.
* Non-SystemComponents should not be added here
*/
AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return AZ::ComponentTypeList {
azrtti_typeid<${SanitizedCppName}EditorSystemComponent>(),
};
}
};
}// namespace ${SanitizedCppName}
AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}, ${SanitizedCppName}::${SanitizedCppName}EditorModule)
@@ -21,34 +21,47 @@ namespace ${SanitizedCppName}
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<${SanitizedCppName}EditorSystemComponent, AZ::Component>()->Version(1);
serializeContext->Class<${SanitizedCppName}EditorSystemComponent, ${SanitizedCppName}SystemComponent>()
->Version(0);
}
}
${SanitizedCppName}EditorSystemComponent::${SanitizedCppName}EditorSystemComponent()
${SanitizedCppName}EditorSystemComponent::${SanitizedCppName}EditorSystemComponent() = default;
${SanitizedCppName}EditorSystemComponent::~${SanitizedCppName}EditorSystemComponent() = default;
void ${SanitizedCppName}EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
if (${SanitizedCppName}Interface::Get() == nullptr)
{
${SanitizedCppName}Interface::Register(this);
}
BaseSystemComponent::GetProvidedServices(provided);
provided.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
}
${SanitizedCppName}EditorSystemComponent::~${SanitizedCppName}EditorSystemComponent()
void ${SanitizedCppName}EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
if (${SanitizedCppName}Interface::Get() == this)
{
${SanitizedCppName}Interface::Unregister(this);
}
BaseSystemComponent::GetIncompatibleServices(incompatible);
incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}EditorService"));
}
void ${SanitizedCppName}EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
{
BaseSystemComponent::GetRequiredServices(required);
}
void ${SanitizedCppName}EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
{
BaseSystemComponent::GetDependentServices(dependent);
}
void ${SanitizedCppName}EditorSystemComponent::Activate()
{
${SanitizedCppName}SystemComponent::Activate();
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
}
void ${SanitizedCppName}EditorSystemComponent::Deactivate()
{
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
${SanitizedCppName}SystemComponent::Deactivate();
}
} // namespace ${SanitizedCppName}
@@ -14,7 +14,7 @@
#pragma once
#include <AzCore/Component/Component.h>
#include <${Name}SystemComponent.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
@@ -22,26 +22,22 @@ namespace ${SanitizedCppName}
{
/// System component for ${SanitizedCppName} editor
class ${SanitizedCppName}EditorSystemComponent
: public AZ::Component
: public ${SanitizedCppName}SystemComponent
, private AzToolsFramework::EditorEvents::Bus::Handler
{
using BaseSystemComponent = ${SanitizedCppName}SystemComponent;
public:
AZ_COMPONENT(${SanitizedCppName}EditorSystemComponent, "${EditorSysCompClassId}");
AZ_COMPONENT(${SanitizedCppName}EditorSystemComponent, "${EditorSysCompClassId}", BaseSystemComponent);
static void Reflect(AZ::ReflectContext* context);
${SanitizedCppName}EditorSystemComponent();
~${SanitizedCppName}EditorSystemComponent();
private:
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("${SanitizedCppName}EditorService"));
}
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC("${SanitizedCppName}Service"));
}
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
// AZ::Component
void Activate() override;
@@ -12,38 +12,18 @@
*/
// {END_LICENSE}
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Module/Module.h>
#include <${Name}ModuleInterface.h>
#include <${Name}SystemComponent.h>
namespace ${SanitizedCppName}
{
class ${SanitizedCppName}Module
: public AZ::Module
: public ${SanitizedCppName}ModuleInterface
{
public:
AZ_RTTI(${SanitizedCppName}Module, "${ModuleClassId}", AZ::Module);
AZ_RTTI(${SanitizedCppName}Module, "${ModuleClassId}", ${SanitizedCppName}ModuleInterface);
AZ_CLASS_ALLOCATOR(${SanitizedCppName}Module, AZ::SystemAllocator, 0);
${SanitizedCppName}Module()
: AZ::Module()
{
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
m_descriptors.insert(m_descriptors.end(), {
${SanitizedCppName}SystemComponent::CreateDescriptor(),
});
}
/**
* Add required SystemComponents to the SystemEntity.
*/
AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return AZ::ComponentTypeList {
azrtti_typeid<${SanitizedCppName}SystemComponent>(),
};
}
};
}// namespace ${SanitizedCppName}
@@ -0,0 +1,49 @@
// {BEGIN_LICENSE}
/*
* 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.
*
*/
// {END_LICENSE}
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Module/Module.h>
#include <${Name}SystemComponent.h>
namespace ${SanitizedCppName}
{
class ${SanitizedCppName}ModuleInterface
: public AZ::Module
{
public:
AZ_RTTI(${SanitizedCppName}ModuleInterface, "{${Random_Uuid}}", AZ::Module);
AZ_CLASS_ALLOCATOR(${SanitizedCppName}ModuleInterface, AZ::SystemAllocator, 0);
${SanitizedCppName}ModuleInterface()
{
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
// Add ALL components descriptors associated with this gem to m_descriptors.
// This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
// This happens through the [MyComponent]::Reflect() function.
m_descriptors.insert(m_descriptors.end(), {
${SanitizedCppName}SystemComponent::CreateDescriptor(),
});
}
/**
* Add required SystemComponents to the SystemEntity.
*/
AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return AZ::ComponentTypeList{
azrtti_typeid<${SanitizedCppName}SystemComponent>(),
};
}
};
}// namespace ${SanitizedCppName}
@@ -41,22 +41,20 @@ namespace ${SanitizedCppName}
void ${SanitizedCppName}SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("${SanitizedCppName}Service"));
provided.push_back(AZ_CRC_CE("${SanitizedCppName}Service"));
}
void ${SanitizedCppName}SystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC("${SanitizedCppName}Service"));
incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}Service"));
}
void ${SanitizedCppName}SystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
void ${SanitizedCppName}SystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
{
AZ_UNUSED(required);
}
void ${SanitizedCppName}SystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
void ${SanitizedCppName}SystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
{
AZ_UNUSED(dependent);
}
${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent()
@@ -91,9 +89,8 @@ namespace ${SanitizedCppName}
${SanitizedCppName}RequestBus::Handler::BusDisconnect();
}
void ${SanitizedCppName}SystemComponent::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint /*time*/)
void ${SanitizedCppName}SystemComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
{
}
} // namespace ${SanitizedCppName}
@@ -14,24 +14,4 @@
#include <AzTest/AzTest.h>
class ${SanitizedCppName}EditorTest
: public ::testing::Test
{
protected:
void SetUp() override
{
}
void TearDown() override
{
}
};
TEST_F(${SanitizedCppName}EditorTest, SanityTest)
{
ASSERT_TRUE(true);
}
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
@@ -14,24 +14,4 @@
#include <AzTest/AzTest.h>
class ${SanitizedCppName}Test
: public ::testing::Test
{
protected:
void SetUp() override
{
}
void TearDown() override
{
}
};
TEST_F(${SanitizedCppName}Test, SanityTest)
{
ASSERT_TRUE(true);
}
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
+12
View File
@@ -156,6 +156,12 @@
"isTemplated": true,
"isOptional": false
},
{
"file": "Code/Source/${Name}EditorModule.cpp",
"origin": "Code/Source/${Name}EditorModule.cpp",
"isTemplated": true,
"isOptional": false
},
{
"file": "Code/Source/${Name}EditorSystemComponent.cpp",
"origin": "Code/Source/${Name}EditorSystemComponent.cpp",
@@ -174,6 +180,12 @@
"isTemplated": true,
"isOptional": false
},
{
"file": "Code/Source/${Name}ModuleInterface.h",
"origin": "Code/Source/${Name}ModuleInterface.h",
"isTemplated": true,
"isOptional": false
},
{
"file": "Code/Source/${Name}SystemComponent.cpp",
"origin": "Code/Source/${Name}SystemComponent.cpp",
@@ -49,14 +49,12 @@ namespace ${SanitizedCppName}
incompatible.push_back(AZ_CRC("${SanitizedCppName}Service"));
}
void ${SanitizedCppName}SystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
void ${SanitizedCppName}SystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
{
AZ_UNUSED(required);
}
void ${SanitizedCppName}SystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
void ${SanitizedCppName}SystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
{
AZ_UNUSED(dependent);
}
${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent()
@@ -12,17 +12,22 @@
set(ENABLED_GEMS
${Name}
Atom_AtomBridge
Camera
AudioSystem
AWSCore
CameraFramework
DebugDraw
EditorPythonBindings
EMotionFX
GradientSignal
GameState
ImGui
LmbrCentral
LandscapeCanvas
LyShine
Maestro
NvCloth
SceneProcessing
Multiplayer
PhysX
SaveData
ScriptCanvasPhysics
ScriptEvents
StartingPointInput
TextureAtlas
WhiteBox
)
@@ -1,3 +1,4 @@
# {BEGIN_LICENSE}
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
@@ -8,6 +9,7 @@
# 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.
#
# {END_LICENSE}
# This file is copied during engine registration. Edits to this file will be lost next
# time a registration happens.
@@ -7,8 +7,7 @@
[
"Assets",
"ShaderLib",
"Shaders",
"Registry"
"Shaders"
]
}
}
@@ -1,7 +1,3 @@
sys_game_name = "${Name}"
sys_localization_folder = Localization
ca_useIMG_CAF = 0
-- Enable warnings when asset loads take longer than the given millisecond threshold
cl_assetLoadWarningEnable=true
cl_assetLoadWarningMsThreshold=100
+18 -14
View File
@@ -25,12 +25,6 @@
"isTemplated": true,
"isOptional": false
},
{
"file": "EngineFinder.cmake",
"origin": "EngineFinder.cmake",
"isTemplated": false,
"isOptional": false
},
{
"file": "Code/${NameLower}_files.cmake",
"origin": "Code/${NameLower}_files.cmake",
@@ -49,12 +43,6 @@
"isTemplated": true,
"isOptional": false
},
{
"file": "Code/gem.json",
"origin": "Code/gem.json",
"isTemplated": true,
"isOptional": true
},
{
"file": "Code/Include/${Name}/${Name}Bus.h",
"origin": "Code/Include/${Name}/${Name}Bus.h",
@@ -175,12 +163,24 @@
"isTemplated": true,
"isOptional": false
},
{
"file": "Code/gem.json",
"origin": "Code/gem.json",
"isTemplated": true,
"isOptional": true
},
{
"file": "Config/shader_global_build_options.json",
"origin": "Config/shader_global_build_options.json",
"isTemplated": false,
"isOptional": false
},
{
"file": "EngineFinder.cmake",
"origin": "EngineFinder.cmake",
"isTemplated": false,
"isOptional": false
},
{
"file": "Platform/Android/android_project.cmake",
"origin": "Platform/Android/android_project.cmake",
@@ -478,7 +478,7 @@
{
"file": "ShaderLib/README.md",
"origin": "ShaderLib/README.md",
"isTemplated": true,
"isTemplated": false,
"isOptional": true
},
{
@@ -514,7 +514,7 @@
{
"file": "game.cfg",
"origin": "game.cfg",
"isTemplated": true,
"isTemplated": false,
"isOptional": false
},
{
@@ -650,6 +650,10 @@
{
"dir": "Shaders",
"origin": "Shaders"
},
{
"dir": "Shaders/ShaderResourceGroups",
"origin": "Shaders/ShaderResourceGroups"
}
]
}
@@ -0,0 +1,3 @@
[Bb]uild/
[Cc]ache/
[Uu]ser/
@@ -0,0 +1,35 @@
# {BEGIN_LICENSE}
#
# 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.
#
# {END_LICENSE}
if(NOT PROJECT_NAME)
cmake_minimum_required(VERSION 3.20)
project(${Name}
LANGUAGES C CXX
VERSION 1.0.0.0
)
include(EngineFinder.cmake OPTIONAL)
find_package(o3de REQUIRED)
o3de_initialize()
else()
# Add the project_name to global LY_PROJECTS_TARGET_NAME property
file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json)
string(JSON project_target_name ERROR_VARIABLE json_error GET ${project_json} "project_name")
if(json_error)
message(FATAL_ERROR "Unable to read key 'project_name' from 'project.json'")
endif()
set_property(GLOBAL APPEND PROPERTY LY_PROJECTS_TARGET_NAME ${project_target_name})
add_subdirectory(Code)
endif()
@@ -0,0 +1,17 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
Include/${Name}/${Name}Bus.h
Source/${Name}SystemComponent.cpp
Source/${Name}SystemComponent.h
enabled_gems.cmake
)
@@ -0,0 +1,14 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
Source/${Name}Module.cpp
)
@@ -0,0 +1,116 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
# Currently we are in the ${Name}/Code folder: ${CMAKE_CURRENT_LIST_DIR}
# Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
# Note: ly_get_list_relative_pal_filename will take care of the details for us, as this may be a restricted platform
# in which case it will see if that platform is present here or in the restricted folder.
# i.e. It could here : ${Name}/Code/Platform/<platorm_name> or
# <restricted_folder>/<platform_name>/${Name}/Code
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} ${o3de_project_restricted_path} ${o3de_project_path} ${o3de_project_name})
# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
# traits for this platform. Traits for a platform are defines for things like whether or not something in this project
# is supported by this platform.
include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
# Now that we have loaded our project traits for this platform, see if this project is even supported on this platform.
# If its not supported we just return after including the unsupported.
if(NOT PAL_TRAIT_${NameUpper}_SUPPORTED)
return()
endif()
# We are on a supported platform, so add the ${Name} target
# Note: We include the common files and the platform specific files which are set in ${NameLower}_files.cmake and
# in ${pal_dir}/${NameLower}_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
ly_add_target(
NAME ${Name}.Static STATIC
NAMESPACE Gem
FILES_CMAKE
${NameLower}_files.cmake
${pal_dir}/${NameLower}_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
INCLUDE_DIRECTORIES
PUBLIC
Include
BUILD_DEPENDENCIES
PRIVATE
AZ::AzGameFramework
Gem::Atom_AtomBridge.Static
)
ly_add_target(
NAME ${Name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
NAMESPACE Gem
FILES_CMAKE
${NameLower}_shared_files.cmake
${pal_dir}/${NameLower}_shared_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
INCLUDE_DIRECTORIES
PUBLIC
Include
BUILD_DEPENDENCIES
PRIVATE
Gem::${Name}.Static
AZ::AzCore
)
# if enabled, ${Name} is used by all kinds of applications
ly_create_alias(NAME ${Name}.Builders NAMESPACE Gem TARGETS Gem::${Name})
ly_create_alias(NAME ${Name}.Tools NAMESPACE Gem TARGETS Gem::${Name})
ly_create_alias(NAME ${Name}.Clients NAMESPACE Gem TARGETS Gem::${Name})
ly_create_alias(NAME ${Name}.Servers NAMESPACE Gem TARGETS Gem::${Name})
################################################################################
# Gem dependencies
################################################################################
# The GameLauncher uses "Clients" gem variants:
ly_enable_gems(
PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake
TARGETS
${Name}.GameLauncher
VARIANTS
Clients)
if(PAL_TRAIT_BUILD_HOST_TOOLS)
# the builder type applications use the "Builders" variants of the enabled gems.
ly_enable_gems(
PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake
TARGETS
AssetBuilder
AssetProcessor
AssetProcessorBatch
VARIANTS
Builders)
# the Editor applications use the "Tools" variants of the enabled gems.
ly_enable_gems(
PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake
TARGETS
Editor
VARIANTS
Tools)
endif()
if(PAL_TRAIT_BUILD_SERVER_SUPPORTED)
# this property causes it to actually make a ServerLauncher.
# if you don't want a Server application, you can remove this and the
# following ly_enable_gems lines.
set_property(GLOBAL APPEND PROPERTY LY_LAUNCHER_SERVER_PROJECTS ${Name})
# The ServerLauncher uses the "Servers" variants of enabled gems:
ly_enable_gems(
PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake
TARGETS
${Name}.ServerLauncher
VARIANTS
Servers)
endif()
@@ -0,0 +1,44 @@
// {BEGIN_LICENSE}
/*
* 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.
*
*/
// {END_LICENSE}
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/Interface/Interface.h>
namespace ${SanitizedCppName}
{
class ${SanitizedCppName}Requests
{
public:
AZ_RTTI(${SanitizedCppName}Requests, "${Random_Uuid}");
virtual ~${SanitizedCppName}Requests() = default;
// Put your public methods here
};
class ${SanitizedCppName}BusTraits
: public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//////////////////////////////////////////////////////////////////////////
};
using ${SanitizedCppName}RequestBus = AZ::EBus<${SanitizedCppName}Requests, ${SanitizedCppName}BusTraits>;
using ${SanitizedCppName}Interface = AZ::Interface<${SanitizedCppName}Requests>;
} // namespace ${SanitizedCppName}
@@ -0,0 +1,14 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
PAL_android.cmake
)
@@ -0,0 +1,13 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
)
@@ -0,0 +1,12 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
@@ -0,0 +1,14 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
PAL_linux.cmake
)
@@ -0,0 +1,13 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
)
@@ -0,0 +1,12 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
@@ -0,0 +1,15 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
../../../Resources/Platform/Mac/Info.plist
PAL_mac.cmake
)
@@ -0,0 +1,14 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
../../../Resources/Platform/Mac/Info.plist
)
@@ -0,0 +1,12 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
@@ -0,0 +1,13 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
)
@@ -0,0 +1,14 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
PAL_windows.cmake
)
@@ -0,0 +1,12 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
@@ -0,0 +1,15 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
../Resources/Platform/iOS/Info.plist
PAL_ios.cmake
)
@@ -0,0 +1,13 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(FILES
)
@@ -0,0 +1,12 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE)
@@ -0,0 +1,50 @@
// {BEGIN_LICENSE}
/*
* 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.
*
*/
// {END_LICENSE}
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Module/Module.h>
#include "${Name}SystemComponent.h"
namespace ${SanitizedCppName}
{
class ${SanitizedCppName}Module
: public AZ::Module
{
public:
AZ_RTTI(${SanitizedCppName}Module, "${ModuleClassId}", AZ::Module);
AZ_CLASS_ALLOCATOR(${SanitizedCppName}Module, AZ::SystemAllocator, 0);
${SanitizedCppName}Module()
: AZ::Module()
{
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
m_descriptors.insert(m_descriptors.end(), {
${SanitizedCppName}SystemComponent::CreateDescriptor(),
});
}
/**
* Add required SystemComponents to the SystemEntity.
*/
AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return AZ::ComponentTypeList{
azrtti_typeid<${SanitizedCppName}SystemComponent>(),
};
}
};
}// namespace ${SanitizedCppName}
AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}, ${SanitizedCppName}::${SanitizedCppName}Module)
@@ -0,0 +1,91 @@
// {BEGIN_LICENSE}
/*
* 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.
*
*/
// {END_LICENSE}
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/EditContextConstants.inl>
#include "${Name}SystemComponent.h"
namespace ${SanitizedCppName}
{
void ${SanitizedCppName}SystemComponent::Reflect(AZ::ReflectContext* context)
{
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
{
serialize->Class<${SanitizedCppName}SystemComponent, AZ::Component>()
->Version(0)
;
if (AZ::EditContext* ec = serialize->GetEditContext())
{
ec->Class<${SanitizedCppName}SystemComponent>("${SanitizedCppName}", "[Description of functionality provided by this System Component]")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
;
}
}
}
void ${SanitizedCppName}SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("${SanitizedCppName}Service"));
}
void ${SanitizedCppName}SystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC("${SanitizedCppName}Service"));
}
void ${SanitizedCppName}SystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
AZ_UNUSED(required);
}
void ${SanitizedCppName}SystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
{
AZ_UNUSED(dependent);
}
${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent()
{
if (${SanitizedCppName}Interface::Get() == nullptr)
{
${SanitizedCppName}Interface::Register(this);
}
}
${SanitizedCppName}SystemComponent::~${SanitizedCppName}SystemComponent()
{
if (${SanitizedCppName}Interface::Get() == this)
{
${SanitizedCppName}Interface::Unregister(this);
}
}
void ${SanitizedCppName}SystemComponent::Init()
{
}
void ${SanitizedCppName}SystemComponent::Activate()
{
${SanitizedCppName}RequestBus::Handler::BusConnect();
}
void ${SanitizedCppName}SystemComponent::Deactivate()
{
${SanitizedCppName}RequestBus::Handler::BusDisconnect();
}
}
@@ -0,0 +1,53 @@
// {BEGIN_LICENSE}
/*
* 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.
*
*/
// {END_LICENSE}
#pragma once
#include <AzCore/Component/Component.h>
#include <${Name}/${Name}Bus.h>
namespace ${SanitizedCppName}
{
class ${SanitizedCppName}SystemComponent
: public AZ::Component
, protected ${SanitizedCppName}RequestBus::Handler
{
public:
AZ_COMPONENT(${SanitizedCppName}SystemComponent, "${SysCompClassId}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
${SanitizedCppName}SystemComponent();
~${SanitizedCppName}SystemComponent();
protected:
////////////////////////////////////////////////////////////////////////
// ${SanitizedCppName}RequestBus interface implementation
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// AZ::Component interface implementation
void Init() override;
void Activate() override;
void Deactivate() override;
////////////////////////////////////////////////////////////////////////
};
}
@@ -0,0 +1,17 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
set(ENABLED_GEMS
${Name}
Atom_AtomBridge
CameraFramework
ImGui
)
@@ -0,0 +1,14 @@
{
"gem_name": "${Name}",
"origin": "The primary repo for ${Name} goes here: i.e. http://www.mydomain.com",
"license": "What license ${Name} uses goes here: i.e. https://opensource.org/licenses/MIT",
"display_name": "${Name}",
"summary": "A short description of ${Name}.",
"canonical_tags": [
"Gem"
],
"user_tags": [
"${Name}"
],
"icon_path": "preview.png"
}
@@ -0,0 +1,11 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "GlobalBuildOptions",
"ClassData": {
"ShaderCompilerArguments" : {
"DefaultMatrixOrder" : "Row",
"AzslcAdditionalFreeArguments" : "--strip-unused-srgs"
}
}
}
@@ -0,0 +1,70 @@
# {BEGIN_LICENSE}
#
# 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.
#
# {END_LICENSE}
# This file is copied during engine registration. Edits to this file will be lost next
# time a registration happens.
include_guard()
# Read the engine name from the project_json file
file(READ ${CMAKE_CURRENT_LIST_DIR}/project.json project_json)
string(JSON LY_ENGINE_NAME_TO_USE ERROR_VARIABLE json_error GET ${project_json} engine)
if(json_error)
message(FATAL_ERROR "Unable to read key 'engine' from 'project.json', error: ${json_error}")
endif()
if(DEFINED ENV{USERPROFILE} AND EXISTS $ENV{USERPROFILE})
set(manifest_path $ENV{USERPROFILE}/.o3de/o3de_manifest.json) # Windows
else()
set(manifest_path $ENV{HOME}/.o3de/o3de_manifest.json) # Unix
endif()
# Read the ~/.o3de/o3de_manifest.json file and look through the 'engines_path' object.
# Find a key that matches LY_ENGINE_NAME_TO_USE and use that as the engine path.
if(EXISTS ${manifest_path})
file(READ ${manifest_path} manifest_json)
string(JSON engines_path_count ERROR_VARIABLE json_error LENGTH ${manifest_json} engines_path)
if(json_error)
message(FATAL_ERROR "Unable to read key 'engines_path' from '${manifest_path}', error: ${json_error}")
endif()
string(JSON engines_path_type ERROR_VARIABLE json_error TYPE ${manifest_json} engines_path)
if(json_error OR NOT ${engines_path_type} STREQUAL "OBJECT")
message(FATAL_ERROR "Type of 'engines_path' in '${manifest_path}' is not a JSON Object, error: ${json_error}")
endif()
math(EXPR engines_path_count "${engines_path_count}-1")
foreach(engine_path_index RANGE ${engines_path_count})
string(JSON engine_name ERROR_VARIABLE json_error MEMBER ${manifest_json} engines_path ${engine_path_index})
if(json_error)
message(FATAL_ERROR "Unable to read 'engines_path/${engine_path_index}' from '${manifest_path}', error: ${json_error}")
endif()
if(LY_ENGINE_NAME_TO_USE STREQUAL engine_name)
string(JSON engine_path ERROR_VARIABLE json_error GET ${manifest_json} engines_path ${engine_name})
if(json_error)
message(FATAL_ERROR "Unable to read value from 'engines_path/${engine_name}', error: ${json_error}")
endif()
if(engine_path)
list(APPEND CMAKE_MODULE_PATH "${engine_path}/cmake")
break()
endif()
endif()
endforeach()
else()
# If the user is passing CMAKE_MODULE_PATH we assume thats where we will find the engine
if(NOT CMAKE_MODULE_PATH)
message(FATAL_ERROR "Engine registration is required before configuring a project. Please register an engine by running 'scripts/o3de register --this-engine'")
endif()
endif()
@@ -0,0 +1,11 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
@@ -0,0 +1,9 @@
{
"Tags": ["Android"],
"android_settings" : {
"package_name" : "com.lumberyard.${Name}",
"version_number" : 1,
"version_name" : "1.0.0.0",
"orientation" : "landscape"
}
}
@@ -0,0 +1,11 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
@@ -0,0 +1,3 @@
{
"Tags": ["Linux"]
}
@@ -0,0 +1,11 @@
# {BEGIN_LICENSE}
# 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.
# {END_LICENSE}
@@ -0,0 +1,3 @@
{
"Tags": ["Mac"]
}

Some files were not shown because too many files have changed in this diff Show More