NVIDIA DeepLearning Dataset Synthesizer (NDDS)
 All Classes Namespaces Functions Variables Typedefs Pages
NVSceneManager.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 "GameFramework/Actor.h"
14 #include "NVSceneMarker.h"
15 #include "NVObjectMaskManager.h"
16 #include "NVSceneManager.generated.h"
17 
18 class ANVSceneManager;
20 
21 /**
22  * Capturing State.
23  */
24 UENUM(BlueprintType)
25 enum class ENVSceneManagerState : uint8
26 {
27  /** This Scene manager is not used. */
28  NotActive UMETA(DisplayName = "This SceneManager is not active."),
29 
30  /** This Scene manager is active to capture the scene. */
31  Active UMETA(DisplayName = "This SceneManager is active."),
32 
33  /** This Scene manager is active and ready to capture or it is capturing now.*/
34  Ready UMETA(DisplayName = "Ready to capture."),
35 
36  /** All scenes are captured. */
37  Captured UMETA(DisplayName = "Capturing is done."),
38 };
39 
40 /**
41  * Declaration for SetupCompleted multicast.
42  * This event happens, when all instances are ready to capture.
43  */
44 DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FNVSceneManger_SetupCompleted, ANVSceneManager*, SceneManager, bool, bIsSucceeded);
45 
46 /**
47  * Actor representing the scene to be annotated and have its info captured and exported.
48  * Although multiple instances can be created, only one can be active for scene capturing at a time.
49  * All other instances' 'bIsActive' property will be disabled when capturing starts.
50  */
51 /// @cond DOXYGEN_SUPPRESSED_CODE
52 UCLASS(Blueprintable, ClassGroup = (NVIDIA), Config=Engine, HideCategories = (Replication, Tick, Tags, Input, Actor, Rendering))
53 /// @endcond DOXYGEN_SUPPRESSED_CODE
54 class NVSCENECAPTURER_API ANVSceneManager : public AActor
55 {
56  GENERATED_BODY()
57 
58 public:
59  /// Use SpawnActor() to create this instance.
60  ANVSceneManager(const FObjectInitializer& ObjectInitializer);
61 
62  /// Get singleton this instance.
63  /// After lifecycle "PostInitializeComponents" is finished, this method is available.
64  UFUNCTION(BlueprintCallable, Category = "Capturer")
65  static ANVSceneManager* GetANVSceneManagerPtr();
66 
67  /// Get scene capturing state.
68  ENVSceneManagerState GetState() const;
69 
70  /// if state is CAPTURED, this change the state to READY.
71  UFUNCTION(BlueprintCallable, Category = "Capturer")
72  void ResetState();
73 
74  UPROPERTY(EditAnywhere, Category = CapturerScene)
75  FNVObjectSegmentation_Class ObjectClassSegmentation;
76 
77  UPROPERTY(EditAnywhere, Category = CapturerScene)
78  FNVObjectSegmentation_Instance ObjectInstanceSegmentation;
79 
80 protected:
81  virtual void PreInitializeComponents() override;
82  virtual void PostInitializeComponents() override;
83  virtual void BeginPlay() override;
84 
85  virtual void UpdateSettingsFromCommandLine();
86  virtual void SetupSceneInternal();
87 
88  void SetupScene();
89  void FocusNextMarker();
90  bool IsAllSceneCaptured() const;
91 
92  UFUNCTION()
93  virtual void OnCapturingCompleted(ANVSceneCapturerActor* SceneCapturer, bool bIsSucceeded);
94 
95 #if WITH_EDITORONLY_DATA
96  virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
97 #endif //WITH_EDITORONLY_DATA
98 
99 protected: // Editor properties
100  /// Whether this scene manager actively change the scene or not
101  UPROPERTY(EditAnywhere)
102  bool bIsActive;
103 
104  /// List of anchors for point-of-interests
105  UPROPERTY(EditInstanceOnly)
106  TArray<AActor*> SceneMarkers;
107 
108  UPROPERTY(EditAnywhere)
109  bool bCaptureAtAllMarkers;
110 
111  /// If true, this exporter will automatically shutdown the game after it finish exporting
112  UPROPERTY(EditAnywhere)
113  bool bAutoExitAfterExportingComplete;
114 
115  UPROPERTY(BlueprintAssignable, Category = "Events")
116  FNVSceneManger_SetupCompleted OnSetupCompleted;
117 
118  UPROPERTY(EditAnywhere)
119  bool bUseMarkerNameAsPostfix;
120 
121 protected: // Transient properties
122  /// Keep track of all the scene capturers in the map
123  UPROPERTY(Transient)
124  TArray<class ANVSceneCapturerActor*> SceneCapturers;
125 
126  UPROPERTY(Transient)
127  TArray<FString> SceneCaptureExportDirNames;
128 
129  UPROPERTY(Transient)
130  AActor* CurrentSceneMarker;
131 
132  UPROPERTY(Transient)
133  ENVSceneManagerState SceneManagerState;
134 
135  UPROPERTY(Transient)
136  int32 CurrentMarkerIndex;
137 };
bool bIsActive
Whether this capturer actor is active and can start capturing or not.
The scene exporter actor.