/* * 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 "VegetationSystemComponent.h" #include #include #include #include #include #include #include #include #include #include #include #include namespace Vegetation { namespace Details { AzFramework::GenericAssetHandler* s_vegetationDescriptorListAssetHandler = nullptr; void RegisterAssethandlers() { s_vegetationDescriptorListAssetHandler = aznew AzFramework::GenericAssetHandler("Vegetation Descriptor List", "Other", "vegdescriptorlist"); s_vegetationDescriptorListAssetHandler->Register(); } void UnregisterAssethandlers() { if (s_vegetationDescriptorListAssetHandler) { s_vegetationDescriptorListAssetHandler->Unregister(); delete s_vegetationDescriptorListAssetHandler; s_vegetationDescriptorListAssetHandler = nullptr; } } } void VegetationSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services) { services.push_back(AZ_CRC_CE("VegetationSystemService")); } void VegetationSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services) { services.push_back(AZ_CRC_CE("VegetationSystemService")); } void VegetationSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& services) { services.push_back(AZ_CRC_CE("VegetationAreaSystemService")); services.push_back(AZ_CRC_CE("VegetationInstanceSystemService")); services.push_back(AZ_CRC_CE("SurfaceDataSystemService")); } void VegetationSystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& services) { services.push_back(AZ_CRC_CE("SurfaceDataProviderService")); } void VegetationSystemComponent::Reflect(AZ::ReflectContext* context) { InstanceSpawner::Reflect(context); EmptyInstanceSpawner::Reflect(context); DynamicSliceInstanceSpawner::Reflect(context); PrefabInstanceSpawner::Reflect(context); Descriptor::Reflect(context); AreaConfig::Reflect(context); AreaComponentBase::Reflect(context); DescriptorListAsset::Reflect(context); if (AZ::SerializeContext* serialize = azrtti_cast(context)) { serialize->Class() ->Version(0) ; if (AZ::EditContext* editContext = serialize->GetEditContext()) { editContext->Class("Vegetation System", "Reflects types and defines required services for dynamic vegetation systems to function") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, "Vegetation") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ; } } if (auto behaviorContext = azrtti_cast(context)) { behaviorContext->EBus("FilterRequestBus") ->Attribute(AZ::Script::Attributes::Category, "Vegetation") ->Event("GetFilterStage", &FilterRequestBus::Events::GetFilterStage) ->Event("SetFilterStage", &FilterRequestBus::Events::SetFilterStage) ->VirtualProperty("FilterStage", "GetFilterStage", "SetFilterStage"); ; } } VegetationSystemComponent::VegetationSystemComponent() { } VegetationSystemComponent::~VegetationSystemComponent() { } void VegetationSystemComponent::Activate() { Details::RegisterAssethandlers(); } void VegetationSystemComponent::Deactivate() { Details::UnregisterAssethandlers(); } }