EditorAudioRtpcComponent.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 "EditorAudioRtpcComponent.h"
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace LmbrCentral
  12. {
  13. //=========================================================================
  14. void EditorAudioRtpcComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
  17. if (serializeContext)
  18. {
  19. serializeContext->Class<EditorAudioRtpcComponent, EditorComponentBase>()
  20. ->Version(1)
  21. ->Field("Rtpc Name", &EditorAudioRtpcComponent::m_defaultRtpc)
  22. ;
  23. if (auto editContext = serializeContext->GetEditContext())
  24. {
  25. editContext->Class<EditorAudioRtpcComponent>("Audio Rtpc", "The Audio Rtpc component provides basic Real-Time Parameter Control (RTPC) functionality allowing you to tweak sounds in real time")
  26. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  27. ->Attribute(AZ::Edit::Attributes::Category, "Audio")
  28. ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/AudioRtpc.svg")
  29. ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/AudioRtpc.svg")
  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/rtpc/")
  33. ->DataElement("AudioControl", &EditorAudioRtpcComponent::m_defaultRtpc, "Default Rtpc", "The default ATL Rtpc control to use")
  34. ;
  35. }
  36. }
  37. }
  38. //=========================================================================
  39. EditorAudioRtpcComponent::EditorAudioRtpcComponent()
  40. {
  41. m_defaultRtpc.m_propertyType = AzToolsFramework::AudioPropertyType::Rtpc;
  42. }
  43. //=========================================================================
  44. void EditorAudioRtpcComponent::BuildGameEntity(AZ::Entity* gameEntity)
  45. {
  46. gameEntity->CreateComponent<AudioRtpcComponent>(m_defaultRtpc.m_controlName);
  47. }
  48. } // namespace LmbrCentral