NVIDIA DeepLearning Dataset Synthesizer (NDDS)
 All Classes Namespaces Functions Variables Typedefs Pages
RandomMaterialParameterComponentBase.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 "DRUtils.h"
16 #include "RandomMaterialParameterComponentBase.generated.h"
17 
18 /**
19 * URandomMaterialParameterComponentBase randomly change the value of some parameters of the materials in the owner's mesh
20 */
21 /// @cond DOXYGEN_SUPPRESSED_CODE
22 UCLASS(Blueprintable, Abstract, ClassGroup = (NVIDIA), meta = (BlueprintSpawnableComponent))
23 /// @endcond DOXYGEN_SUPPRESSED_CODE
24 class DOMAINRANDOMIZATIONDNN_API URandomMaterialParameterComponentBase : public URandomComponentBase
25 {
26  GENERATED_BODY()
27 
28 public:
30 
31 protected:
32  virtual void BeginPlay() override;
33  virtual void OnRandomization_Implementation() override;
34 
35 #if WITH_EDITORONLY_DATA
36  virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
37 #endif //WITH_EDITORONLY_DATA
38 
39  void UpdateMeshMaterial(class UMeshComponent* AffectedMeshComp);
40  void UpdateDecalMaterial(class UDecalComponent* AffectedDecalComp);
41  virtual void UpdateMaterial(UMaterialInstanceDynamic* MaterialToMofidy) PURE_VIRTUAL(URandomMaterialParameterComponentBase::UpdateMaterial,);
42 
43 protected: // Editor properties
44  // List of the parameters in the material that we want to modify
45  UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Randomization)
46  TArray<FName> MaterialParameterNames;
47 
48  UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Randomization, meta = (ShowOnlyInnerProperties))
49  FRandomMaterialSelection MaterialSelectionConfigData;
50 
51  UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Randomization)
52  EAffectedMaterialOwnerComponentType AffectedComponentType;
53 
54 protected:
55  // List of the mesh components from the owner actor that we need to change their materials
56  UPROPERTY(Transient)
57  TArray<class UMeshComponent*> OwnerMeshComponents;
58 
59  UPROPERTY(Transient)
60  TArray<class UDecalComponent*> OwnerDecalComponents;
61 };