AnimAZEntityNode.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #ifndef CRYINCLUDE_CRYMOVIE_ANIMAZENTITYNODE_H
  9. #define CRYINCLUDE_CRYMOVIE_ANIMAZENTITYNODE_H
  10. #pragma once
  11. #include <AzCore/std/containers/vector.h>
  12. #include <AzCore/std/containers/unordered_set.h>
  13. #include <set>
  14. #include "AnimNode.h"
  15. class CAnimComponentNode;
  16. /**
  17. * CAnimAzEntityNode
  18. *
  19. * AZEntities are containers for Components. All the animation is keyed to Components, so the CAnimAzEntityNode
  20. * only exists to support 'Add Selected Node' functionality in TrackView and to marshall TrackView messages/events
  21. * to contained components.
  22. */
  23. class CAnimAzEntityNode
  24. : public CAnimNode
  25. {
  26. struct SScriptPropertyParamInfo;
  27. struct SAnimState;
  28. public:
  29. AZ_CLASS_ALLOCATOR(CAnimAzEntityNode, AZ::SystemAllocator);
  30. AZ_RTTI(CAnimAzEntityNode, "{28C02702-3498-488C-BF93-B5FC3FECC9F1}", CAnimNode);
  31. CAnimAzEntityNode(const int id);
  32. CAnimAzEntityNode();
  33. ~CAnimAzEntityNode();
  34. void SetAzEntityId(const AZ::EntityId& id) override { m_entityId = id; }
  35. AZ::EntityId GetAzEntityId() const override { return m_entityId; }
  36. //////////////////////////////////////////////////////////////////////////
  37. // Overrides from IAnimNode
  38. // AzEntityNodes don't have any animatable params - they are all handled by their children components
  39. // return AnimParamType::Invalid for this pure virtual for the legacy system
  40. CAnimParamType GetParamType(unsigned int nIndex) const override;
  41. void SetPos(float time, const AZ::Vector3& pos) override;
  42. void SetRotate(float time, const AZ::Quaternion& quat) override;
  43. void SetScale(float time, const AZ::Vector3& scale) override;
  44. Vec3 GetOffsetPosition(const Vec3& position) override;
  45. Vec3 GetPos() override;
  46. Quat GetRotate() override;
  47. Quat GetRotate(float time) override;
  48. Vec3 GetScale() override;
  49. //////////////////////////////////////////////////////////////////////////
  50. void Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTracks) override;
  51. // this is an unfortunate hold-over from legacy entities - used when a SceneNode overrides the camera animation so
  52. // we must disable the transform and camera components from updating animation on this entity because the SceneNode
  53. // will be animating these components during interpolation.
  54. void SetSkipInterpolatedCameraNode(const bool skipNodeCameraAnimation) override;
  55. static void Reflect(AZ::ReflectContext* context);
  56. private:
  57. // searches children nodes for a component matching the given typeId and returns a pointer to it or nullptr if one is not found
  58. CAnimComponentNode* GetComponentNodeForComponentWithTypeId(const AZ::Uuid& componentTypeId) const;
  59. // searches children nodes for a transform component and returns a pointer to it or nullptr if one is not found
  60. CAnimComponentNode* GetTransformComponentNode() const;
  61. //! Reference to game entity.
  62. AZ::EntityId m_entityId;
  63. };
  64. #endif // CRYINCLUDE_CRYMOVIE_ANIMAZENTITYNODE_H