/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include #include #include namespace AZ { namespace Render { void PostFxLayerComponentConfig::Reflect(ReflectContext* context) { if (auto serializeContext = azrtti_cast(context)) { serializeContext->Class() ->Version(2) ->Field("layerCategory", &PostFxLayerComponentConfig::m_layerCategoryValue) #define SERIALIZE_CLASS PostFxLayerComponentConfig #include #include #include #undef SERIALIZE_CLASS ->Field("cameraTags", &PostFxLayerComponentConfig::m_cameraTags) ->Field("exclusionTags", &PostFxLayerComponentConfig::m_exclusionTags) ; } } void PostFxLayerComponentConfig::CopySettingsTo(PostProcessSettingsInterface* settings) const { if (!settings) { return; } #define COPY_TARGET settings #include #include #include #undef COPY_TARGET settings->SetLayerCategoryValue(m_layerCategoryValue); } AZStd::string PostFxLayerComponentConfig::GetPriorityLabel() { auto priorityLayersList = BuildLayerCategories(); // use the first match as the priority label since all labels with the same priority will belong to the same layer auto it = AZStd::find_if( priorityLayersList.begin(), priorityLayersList.end(), [this](const auto& entry) { return m_layerCategoryValue == entry.first; }); return it == priorityLayersList.end() ? "Priority" : "Priority in " + it->second; } AZStd::vector> PostFxLayerComponentConfig::BuildLayerCategories() const { // Call the bus to retrieve a list of categories PostFx::LayerCategoriesMap layerCategories; PostFxLayerCategoriesProviderRequestBus::Broadcast(&PostFxLayerCategoriesProviderRequests::GetLayerCategories, layerCategories); AZStd::vector> results; results.reserve(layerCategories.size()); for (const auto& layer : layerCategories) { results.push_back(AZStd::pair(layer.second, layer.first)); } AZStd::sort( results.begin(), results.end(), [](auto& left, auto& right) { return left.first < right.first;}); return results; } } // namespace Render } // namespace AZ