TestActorAssets.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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. #pragma once
  9. #include <AzCore/std/string/string.h>
  10. #include <Integration/Assets/ActorAsset.h>
  11. #include <EMotionFX/Source/EMotionFXManager.h>
  12. #include <EMotionFX/Source/ActorManager.h>
  13. #include <Tests/TestAssetCode/ActorFactory.h>
  14. namespace EMotionFX
  15. {
  16. class TestActorAssets
  17. {
  18. public:
  19. static AZStd::string FileToBase64(const char* filePath);
  20. static AZ::Data::Asset<Integration::ActorAsset> GetAssetFromActor(const AZ::Data::AssetId& assetId, AZStd::unique_ptr<Actor>&& actor);
  21. template<class ActorT, typename... Args>
  22. static AZ::Data::Asset<Integration::ActorAsset> CreateActorAssetAndRegister(const AZ::Data::AssetId& assetId, Args&&... args)
  23. {
  24. AZStd::unique_ptr<ActorT> actor = ActorFactory::CreateAndInit<ActorT>(AZStd::forward<Args>(args)...);
  25. AZ::Data::Asset<Integration::ActorAsset> actorAsset = TestActorAssets::GetAssetFromActor(assetId, AZStd::move(actor));
  26. GetEMotionFX().GetActorManager()->RegisterActor(actorAsset);
  27. return AZStd::move(actorAsset);
  28. }
  29. };
  30. } // namespace EMotionFX