NVIDIA DeepLearning Dataset Synthesizer (NDDS)
 All Classes Namespaces Functions Variables Typedefs Pages
RandomAnimationComponent.h
1 /*
2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10 
11 #pragma once
12 
13 #include "DomainRandomizationDNNPCH.h"
14 #include "RandomComponentBase.h"
15 #include "Animation/AnimInstance.h"
16 #include "RandomAnimationComponent.generated.h"
17 
18 UENUM(BlueprintType)
19 enum class ENVHalfBodyType : uint8
20 {
21  LeftSide = 0,
22  RightSide = 1,
23  NVHalfBodyType_MAX UMETA(Hidden)
24 };
25 
26 UENUM(BlueprintType)
27 enum class ENVHalfBodyBoneType : uint8
28 {
29  Heel = 0,
30  Knee,
31  Pelvis,
32  Shoulder,
33  Elbow,
34  Wrist,
35  Ear,
36  Eye,
37  Nose,
38  NVHalfBodyBoneType_MAX UMETA(Hidden)
39 };
40 
41 USTRUCT(BlueprintType)
42 struct DOMAINRANDOMIZATIONDNN_API FNVHalfBodyBoneData
43 {
44  GENERATED_BODY()
45 
46 public: // Editor properties
47  UPROPERTY(EditAnywhere)
48  FName BoneNames[(uint8)ENVHalfBodyBoneType::NVHalfBodyBoneType_MAX];
49 };
50 
51 USTRUCT(BlueprintType)
52 struct DOMAINRANDOMIZATIONDNN_API FNVHumanSkeletalBoneData
53 {
54  GENERATED_BODY()
55 
56 public: // Editor properties
57  UPROPERTY(EditAnywhere)
58  FNVHalfBodyBoneData SideBoneData[(uint8)ENVHalfBodyType::NVHalfBodyType_MAX];
59 
60 public:
61  FName GetBoneName(ENVHalfBodyType BodySide, ENVHalfBodyBoneType BoneType) const
62  {
63  return SideBoneData[(uint8)BodySide].BoneNames[(uint8)BoneType];
64  }
65 };
66 
67 /// @cond DOXYGEN_SUPPRESSED_CODE
68 UCLASS(Blueprintable, ClassGroup = (NVIDIA), meta = (BlueprintSpawnableComponent))
69 /// @endcond DOXYGEN_SUPPRESSED_CODE
70 class DOMAINRANDOMIZATIONDNN_API URandomAnimationComponent : public URandomComponentBase
71 {
72  GENERATED_BODY()
73 
74 public:
76  virtual void BeginPlay() override;
77 
78 public: // Editor properties
79  UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Randomization)
80  bool bUseAllAnimationsInAFolder;
81 
82  // The path to the folder where to find the animation sequence
83  UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Randomization, meta = (EditCondition = "bUseAllTextureInAFolder"))
84  FString AnimationFolderPath;
85 
86  UPROPERTY(EditAnywhere, Category = Randomization, meta = (EditCondition = "!bUseAllTextureInAFolder"))
87  TArray<UAnimSequence*> RandomAnimList;
88 
89  UPROPERTY(EditAnywhere, Category = Randomization)
90  float TimeWaitAfterEachAnimation;
91 
92  UPROPERTY(EditAnywhere, Category = Randomization)
93  FNVHumanSkeletalBoneData HumanSkeletalBoneData;
94 
95 protected:
96  virtual void OnRandomization_Implementation() override;
97  virtual void OnFinishedRandomization() override;
98 
99 protected:
100  UPROPERTY(Transient)
101  UAnimSequence* CurrentAnimation;
102 
103  UPROPERTY(Transient)
104  TArray<FSoftObjectPath> FolderAnimSequenceReferences;
105 };