Reenable support for UI Elements that use Render Targets (#2352)

* Re-add support for UI Elements that use Render Targets
* Move LyShine pass request from Atom's MainPipeline.pass to project's
* Make all dynamic draw contexts in LyShine draw to pass directly without the need of draw list tags
* Remove local RPI changes that are no longer needed
* Prevent crash if LyShine gem is enabled but its custom pass hasn't been added to the main render pipeline
* Revert to default UI pass if the LyShine pass has not been added to project's main render pipeline

Signed-off-by: abrmich <abrmich@amazon.com>
This commit is contained in:
michabr
2021-08-03 10:14:09 -07:00
committed by GitHub
parent 03722789cf
commit 3a689aa319
37 changed files with 1951 additions and 492 deletions
@@ -49,6 +49,7 @@
#include "UiDynamicLayoutComponent.h"
#include "UiDynamicScrollBoxComponent.h"
#include "UiNavigationSettings.h"
#include "LyShinePass.h"
namespace LyShine
{
@@ -113,9 +114,11 @@ namespace LyShine
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void LyShineSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
void LyShineSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
{
(void)required;
#if !defined(LYSHINE_BUILDER) && !defined(LYSHINE_TESTS)
required.push_back(AZ_CRC("RPISystem", 0xf2add773));
#endif
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -186,6 +189,17 @@ namespace LyShine
RegisterComponentTypeForMenuOrdering(UiDynamicScrollBoxComponent::RTTI_Type());
RegisterComponentTypeForMenuOrdering(UiParticleEmitterComponent::RTTI_Type());
RegisterComponentTypeForMenuOrdering(UiFlipbookAnimationComponent::RTTI_Type());
#if !defined(LYSHINE_BUILDER) && !defined(LYSHINE_TESTS)
// Add LyShine pass
auto* passSystem = AZ::RPI::PassSystemInterface::Get();
AZ_Assert(passSystem, "Cannot get the pass system.");
passSystem->AddPassCreator(AZ::Name("LyShinePass"), &LyShine::LyShinePass::Create);
// Setup handler for load pass template mappings
m_loadTemplatesHandler = AZ::RPI::PassSystemInterface::OnReadyLoadTemplatesEvent::Handler([this]() { this->LoadPassTemplateMappings(); });
AZ::RPI::PassSystemInterface::Get()->ConnectEvent(m_loadTemplatesHandler);
#endif
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -386,4 +400,13 @@ namespace LyShine
{
UiCursorBus::Broadcast(&UiCursorInterface::SetUiCursor, m_cursorImagePathname.GetAssetPath().c_str());
}
#if !defined(LYSHINE_BUILDER) && !defined(LYSHINE_TESTS)
////////////////////////////////////////////////////////////////////////////////////////////////////
void LyShineSystemComponent::LoadPassTemplateMappings()
{
const char* passTemplatesFile = "Passes/LyShinePassTemplates.azasset";
AZ::RPI::PassSystemInterface::Get()->LoadPassTemplateMappings(passTemplatesFile);
}
#endif
}