/* * 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. * */ #include "WhiteBox_precompiled.h" #include "Asset/WhiteBoxMeshAsset.h" #include "Asset/WhiteBoxMeshAssetHandler.h" #include "Rendering/Legacy/WhiteBoxLegacyRenderMesh.h" #include "Rendering/Legacy/WhiteBoxLegacyMaterials.h" #include "WhiteBoxSystemComponent.h" #include "WhiteBoxToolApiReflection.h" #include #include namespace WhiteBox { struct Impl { //! Look-up table for White Box materials. WhiteBoxLegacyMaterials m_whiteBoxLegacyMaterials; }; void WhiteBoxSystemComponent::Reflect(AZ::ReflectContext* context) { if (auto serialize = azrtti_cast(context)) { serialize->Class()->Version(0); if (AZ::EditContext* ec = serialize->GetEditContext()) { ec->Class( "WhiteBox", "[Description of functionality provided by this System Component]") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) ->Attribute(AZ::Edit::Attributes::AutoExpand, true); } } #ifdef WHITE_BOX_EDITOR WhiteBox::Reflect(context); #endif } WhiteBoxSystemComponent::WhiteBoxSystemComponent() = default; WhiteBoxSystemComponent::~WhiteBoxSystemComponent() = default; void WhiteBoxSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) { provided.push_back(AZ_CRC("WhiteBoxService", 0x2f2f42b8)); } void WhiteBoxSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) { incompatible.push_back(AZ_CRC("WhiteBoxService", 0x2f2f42b8)); } void WhiteBoxSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& /*required*/) {} void WhiteBoxSystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& /*dependent*/) {} template void RegisterAsset(AZStd::vector>& assetHandlers) { AZ::Data::AssetCatalogRequestBus::Broadcast( &AZ::Data::AssetCatalogRequests::EnableCatalogForAsset, AZ::AzTypeInfo::Uuid()); AZ::Data::AssetCatalogRequestBus::Broadcast( &AZ::Data::AssetCatalogRequests::AddExtension, AssetHandlerT::AssetFileExtension); assetHandlers.emplace_back(AZStd::make_unique()); } void WhiteBoxSystemComponent::Activate() { WhiteBoxRequestBus::Handler::BusConnect(); #ifdef WHITE_BOX_EDITOR RegisterAsset(m_assetHandlers); #endif m_impl = AZStd::make_unique(); m_impl->m_whiteBoxLegacyMaterials.Connect(); } void WhiteBoxSystemComponent::Deactivate() { m_impl->m_whiteBoxLegacyMaterials.Disconnect(); m_impl.reset(); WhiteBoxRequestBus::Handler::BusDisconnect(); m_assetHandlers.clear(); } AZStd::unique_ptr WhiteBoxSystemComponent::CreateRenderMeshInterface() { // #if LEGACY return AZStd::make_unique(); // #else if ATOM // return AZStd::make_unique(); // #endif } } // namespace WhiteBox