BlendShapeRule.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/SceneCore/DataTypes/GraphData/IBlendShapeData.h>
  13. #include <SceneAPI/SceneData/GraphData/SkinMeshData.h>
  14. #include <SceneAPI/SceneData/Rules/BlendShapeRule.h>
  15. namespace AZ
  16. {
  17. namespace SceneAPI
  18. {
  19. namespace SceneData
  20. {
  21. AZ_CLASS_ALLOCATOR_IMPL(BlendShapeRule, AZ::SystemAllocator)
  22. SceneNodeSelectionList& BlendShapeRule::GetNodeSelectionList()
  23. {
  24. return m_blendShapes;
  25. }
  26. DataTypes::ISceneNodeSelectionList& BlendShapeRule::GetSceneNodeSelectionList()
  27. {
  28. return m_blendShapes;
  29. }
  30. const DataTypes::ISceneNodeSelectionList& BlendShapeRule::GetSceneNodeSelectionList() const
  31. {
  32. return m_blendShapes;
  33. }
  34. void BlendShapeRule::Reflect(ReflectContext* context)
  35. {
  36. SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context);
  37. if (!serializeContext)
  38. {
  39. return;
  40. }
  41. serializeContext->Class<BlendShapeRule, DataTypes::IBlendShapeRule>()->Version(1)
  42. ->Field("blendShapes", &BlendShapeRule::m_blendShapes);
  43. EditContext* editContext = serializeContext->GetEditContext();
  44. if (editContext)
  45. {
  46. editContext->Class<BlendShapeRule>("Blend shapes", "Select mesh targets to configure blend shapes at a later time using Open 3D Engine.")
  47. ->ClassElement(Edit::ClassElements::EditorData, "")
  48. ->Attribute("AutoExpand", true)
  49. ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
  50. ->DataElement(AZ_CRC("ManifestName", 0x5215b349), &BlendShapeRule::m_blendShapes, "Select blend shapes",
  51. "Select 1 or more meshes to include in the skin group for later use with the blend shape system.")
  52. ->Attribute("FilterName", "blend shapes")
  53. ->Attribute("FilterType", DataTypes::IBlendShapeData::TYPEINFO_Uuid())
  54. ->Attribute("NarrowSelection", true);
  55. }
  56. }
  57. } // namespace SceneData
  58. } // namespace SceneAPI
  59. } // namespace AZ