3
0

ActorFactory.h 891 B

1234567891011121314151617181920212223242526272829
  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/smart_ptr/unique_ptr.h>
  10. namespace EMotionFX
  11. {
  12. class ActorFactory
  13. {
  14. public:
  15. template<class ActorT, typename... Args>
  16. static AZStd::unique_ptr<ActorT> CreateAndInit(Args&&... args)
  17. {
  18. AZStd::unique_ptr<ActorT> actor = AZStd::make_unique<ActorT>(AZStd::forward<Args>(args)...);
  19. actor->SetID(0);
  20. actor->GetSkeleton()->UpdateNodeIndexValues(0);
  21. actor->ResizeTransformData();
  22. actor->PostCreateInit(/*makeGeomLodsCompatibleWithSkeletalLODs=*/false, /*convertUnitType=*/false);
  23. return actor;
  24. }
  25. };
  26. } // namespace EMotionFX