CommentRule.cpp 1.9 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 <AzCore/RTTI/ReflectContext.h>
  9. #include <AzCore/Memory/SystemAllocator.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include <AzCore/Serialization/EditContext.h>
  12. #include <SceneAPI/SceneData/Rules/CommentRule.h>
  13. namespace AZ
  14. {
  15. namespace SceneAPI
  16. {
  17. namespace SceneData
  18. {
  19. AZ_CLASS_ALLOCATOR_IMPL(CommentRule, AZ::SystemAllocator)
  20. const AZStd::string& CommentRule::GetComment() const
  21. {
  22. return m_comment;
  23. }
  24. void CommentRule::Reflect(AZ::ReflectContext* context)
  25. {
  26. AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
  27. if (!serializeContext)
  28. {
  29. return;
  30. }
  31. serializeContext->Class<CommentRule, DataTypes::ICommentRule>()->Version(1)
  32. ->Field("comment", &CommentRule::m_comment);
  33. AZ::EditContext* editContext = serializeContext->GetEditContext();
  34. if (editContext)
  35. {
  36. editContext->Class<CommentRule>("Comment", "Add an optional comment to the asset's properties.")
  37. ->ClassElement(Edit::ClassElements::EditorData, "")
  38. ->Attribute("AutoExpand", true)
  39. ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
  40. ->DataElement("MultiLineEdit", &CommentRule::m_comment, "", "Text for the comment.")
  41. ->Attribute("PlaceholderText", "Add comment text here");
  42. }
  43. }
  44. } // SceneData
  45. } // SceneAPI
  46. } // AZ