EditorAudioEnvironmentComponent.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "EditorAudioEnvironmentComponent.h"
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace LmbrCentral
  12. {
  13. //=========================================================================
  14. void EditorAudioEnvironmentComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
  17. if (serializeContext)
  18. {
  19. serializeContext->Class<EditorAudioEnvironmentComponent, EditorComponentBase>()
  20. ->Version(1)
  21. ->Field("Environment name", &EditorAudioEnvironmentComponent::m_defaultEnvironment)
  22. ;
  23. if (auto editContext = serializeContext->GetEditContext())
  24. {
  25. editContext->Class<EditorAudioEnvironmentComponent>("Audio Environment", "The Audio Environment component provides access to features of the Audio Translation Layer (ATL) environments to apply environmental effects such as reverb or echo")
  26. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  27. ->Attribute(AZ::Edit::Attributes::Category, "Audio")
  28. ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/AudioEnvironment.svg")
  29. ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/AudioEnvironment.png")
  30. ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
  31. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  32. ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/audio/environment/")
  33. ->DataElement("AudioControl", &EditorAudioEnvironmentComponent::m_defaultEnvironment, "Default Environment", "Name of the default ATL Environment control to use")
  34. ;
  35. }
  36. }
  37. }
  38. //=========================================================================
  39. EditorAudioEnvironmentComponent::EditorAudioEnvironmentComponent()
  40. {
  41. m_defaultEnvironment.m_propertyType = AzToolsFramework::AudioPropertyType::Environment;
  42. }
  43. //=========================================================================
  44. void EditorAudioEnvironmentComponent::BuildGameEntity(AZ::Entity* gameEntity)
  45. {
  46. gameEntity->CreateComponent<AudioEnvironmentComponent>(m_defaultEnvironment.m_controlName);
  47. }
  48. } // namespace LmbrCentral