RapyutaSimulationPlugins
RRBaseActor.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 
16 
17 // std
18 
19 #include <mutex>
20 
21 
22 
23 // UE
24 
25 #include "GameFramework/Pawn.h"
26 
27 #include "Net/UnrealNetwork.h"
28 
29 
30 
31 // RapyutaSimulationPlugins
32 
33 #include "Core/RRActorCommon.h"
34 
35 #include "Core/RREntityStructs.h"
36 
37 
38 
39 #include "RRBaseActor.generated.h"
40 
41 
42 
43 class ARRGameMode;
44 
45 class ARRGameState;
46 
47 class URRGameSingleton;
48 
50 
51 
52 
70 class RAPYUTASIMULATIONPLUGINS_API ARRBaseActor : public APawn
71 
72 {
73 
74 public:
75 
90  static TMap<UClass*, TUniquePtr<std::once_flag>> OnceFlagList;
91 
92 
93 
95 
96  static std::once_flag OnceFlag;
97 
98 
99 
120  ARRBaseActor();
121 
122 
123 
134  ARRBaseActor(const FObjectInitializer& ObjectInitializer);
135 
136 
137 
146  void SetupDefaultBase();
147 
148 
149 
150  TSharedPtr<FRRActorSpawnInfo> ActorInfo = nullptr;
151 
152 
153 
154  static int8 SSceneInstanceId;
155 
156 
157 
159 
160 
165  ARRGameState* RRGameState = nullptr;
166 
167 
168 
170 
171 
176  URRGameSingleton* RRGameSingleton = nullptr;
177 
178 
179 
181 
182 
187  ARRGameMode* RRGameMode = nullptr;
188 
189 
190 
192 
193 
198  ARRPlayerController* RRPlayerController = nullptr;
199 
200 
201 
202 
208 
209 
210 
211 
216  URRActorCommon* ActorCommon = nullptr;
217 
218 
219 
242 
243 
244 
245 
251 
252  void SetEntityModelName(const FString& InEntityModelName)
253 
254  {
255 
256  EntityModelName = InEntityModelName;
257 
258  if (ActorInfo.IsValid())
259 
260  {
261 
262  ActorInfo->EntityModelName = InEntityModelName;
263 
264  }
265 
266  }
267 
268 
269 
270  bool IsDataSynthEntity() const
271 
272  {
273 
274  return ActorInfo.IsValid() ? ActorInfo->bIsDataSynthEntity : false;
275 
276  }
277 
278 
279 
280 
285  FTimerHandle GenericTimerHandle;
286 
287 
288 
289 public:
290 
307  template<typename TActorSpawnInfo>
308 
309  bool InitializeWithSpawnInfo(const TActorSpawnInfo& InActorInfo)
310 
311  {
312 
313  ActorInfo = MakeShared<TActorSpawnInfo>(InActorInfo);
314 
315 
316 
317  // ACTOR INTIALIZING GENERAL INFO (Unique name, mesh list, material list, etc.)
318 
319  return Initialize();
320 
321  }
322 
323 
324 
345  virtual bool Initialize();
346 
347 
348 
349  virtual bool HasInitialized(bool bIsLogged = false) const;
350 
351 
352 
361  virtual void Reset();
362 
363 
364 
375  void SetTickEnabled(bool bInIsTickEnabled);
376 
377 
378 
391  virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
392 
393 
394 
395 protected:
396 
403  virtual void PreInitializeComponents() override;
404 
411  virtual void PrintSimConfig() const
412 
413  {
414 
415  }
416 
423  virtual void DoGlobalConfig()
424 
425  {
426 
427  }
428 
429 };
430 
ARRBaseActor::OnceFlag
static std::once_flag OnceFlag
Used for class having single-branch child classes (linear inheritance tree)
Definition: RRBaseActor.h:96
URRActorCommon
Scene instance's common object which houses Plugin-specific dynamic properties and implement objects-...
Definition: RRActorCommon.h:1127
ARRBaseActor::EntityUniqueName
FString EntityUniqueName
Actually Object's Name is also unique as noted by UE, but we just do not want to rely on it.
Definition: RRBaseActor.h:241
ARRGameMode
GameMode with specific setting, asset loading and #SceneDirector. Parent class, ARRROS2GameMode,...
Definition: RRGameMode.h:79
URRActorCommon::DEFAULT_SCENE_INSTANCE_ID
static constexpr int8 DEFAULT_SCENE_INSTANCE_ID
Definition: RRActorCommon.h:1149
RREntityStructs.h
Contains various commonly used struct definitions for robot & object entities.
ARRBaseActor::EntityModelName
FString EntityModelName
Definition: RRBaseActor.h:250
ARRBaseActor
Base actor class for all Rapyuta Sim actors:
Definition: RRBaseActor.h:70
ARRGameState
Game state which handles multiple URRSceneInstance which spit game in scenes for data gen,...
Definition: RRGameState.h:64
ARRBaseActor::OnceFlagList
static TMap< UClass *, TUniquePtr< std::once_flag > > OnceFlagList
[std::once_flag] also applies even in case of consecutive PIE runs,
Definition: RRBaseActor.h:90
ARRBaseActor::IsDataSynthEntity
bool IsDataSynthEntity() const
Definition: RRBaseActor.h:270
ARRBaseActor::PrintSimConfig
virtual void PrintSimConfig() const
Print class members' values configured in RapyutaSimSettings.ini.
Definition: RRBaseActor.h:411
ARRBaseActor::DoGlobalConfig
virtual void DoGlobalConfig()
Globally config custom setups (eg. Exec() cmds) applied for all instances of this class.
Definition: RRBaseActor.h:423
ARRBaseActor::SSceneInstanceId
static int8 SSceneInstanceId
Definition: RRBaseActor.h:154
ARRBaseActor::GenericTimerHandle
FTimerHandle GenericTimerHandle
Definition: RRBaseActor.h:285
ARRPlayerController
Player controller designed to be used with SceneDirector.
Definition: RRPlayerController.h:58
RRActorCommon.h
Asset utils.
URRGameSingleton
GameSingleton class which handles asset loading.
Definition: RRGameSingleton.h:144
ARRBaseActor::SetEntityModelName
void SetEntityModelName(const FString &InEntityModelName)
Definition: RRBaseActor.h:252
ARRBaseActor::InitializeWithSpawnInfo
bool InitializeWithSpawnInfo(const TActorSpawnInfo &InActorInfo)
ACTOR INTIALIZING GENERAL INFO (Unique name, mesh list, material list, etc.)
Definition: RRBaseActor.h:309