EditorAreaBlenderComponent.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "EditorAreaBlenderComponent.h"
  9. #include <AzCore/Serialization/Utils.h>
  10. #include <AzToolsFramework/API/ToolsApplicationAPI.h>
  11. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  12. #include <LmbrCentral/Dependency/DependencyNotificationBus.h>
  13. #include <GradientSignal/Ebuses/SectorDataRequestBus.h>
  14. #include <Vegetation/Ebuses/AreaSystemRequestBus.h>
  15. #include <LmbrCentral/Shape/BoxShapeComponentBus.h>
  16. namespace Vegetation
  17. {
  18. void EditorAreaBlenderComponent::Reflect(AZ::ReflectContext* context)
  19. {
  20. ReflectSubClass<DerivedClassType, BaseClassType>(context, 1, &EditorAreaComponentBaseVersionConverter<typename BaseClassType::WrappedComponentType, typename BaseClassType::WrappedConfigType>);
  21. }
  22. void EditorAreaBlenderComponent::Init()
  23. {
  24. ForceOneEntry();
  25. BaseClassType::Init();
  26. }
  27. void EditorAreaBlenderComponent::Activate()
  28. {
  29. ForceOneEntry();
  30. BaseClassType::Activate();
  31. }
  32. AZ::u32 EditorAreaBlenderComponent::ConfigurationChanged()
  33. {
  34. ForceOneEntry();
  35. return BaseClassType::ConfigurationChanged();
  36. }
  37. void EditorAreaBlenderComponent::ForceOneEntry()
  38. {
  39. if (m_configuration.m_vegetationAreaIds.empty())
  40. {
  41. m_configuration.m_vegetationAreaIds.emplace_back();
  42. SetDirty();
  43. }
  44. }
  45. }