RuntimeMeshActor.cpp
Go to the documentation of this file.
1 // Copyright 2016-2018 Chris Conway (Koderz). All Rights Reserved.
2 
3 #include "RuntimeMeshActor.h"
4 #include "RuntimeMeshComponent.h"
6 #include "Engine/CollisionProfile.h"
7 
8 
9 
10 ARuntimeMeshActor::ARuntimeMeshActor(const FObjectInitializer& ObjectInitializer)
11  : Super(ObjectInitializer)
12  , bRunGenerateMeshesOnConstruction(true)
13  , bRunGenerateMeshesOnBeginPlay(false)
14 {
15 #if ENGINE_MAJOR_VERSION >= 4 && ENGINE_MINOR_VERSION >= 24
16  SetCanBeDamaged(false);
17 #else
18  bCanBeDamaged = false;
19 #endif
20 
21  RuntimeMeshComponent = CreateDefaultSubobject<URuntimeMeshComponent>(TEXT("RuntimeMeshComponent0"));
22  RuntimeMeshComponent->SetCollisionProfileName(UCollisionProfile::BlockAll_ProfileName);
23  RuntimeMeshComponent->Mobility = EComponentMobility::Static;
24 
25 #if ENGINE_MAJOR_VERSION >= 4 && ENGINE_MINOR_VERSION >= 20
26  RuntimeMeshComponent->SetGenerateOverlapEvents(false);
27 #else
28  RuntimeMeshComponent->bGenerateOverlapEvents = false;
29 #endif
30  RootComponent = RuntimeMeshComponent;
31 }
32 
33 ERuntimeMeshMobility ARuntimeMeshActor::GetRuntimeMeshMobility()
34 {
35  if (RuntimeMeshComponent)
36  {
37  return RuntimeMeshComponent->GetRuntimeMeshMobility();
38  }
40 }
41 
42 void ARuntimeMeshActor::SetRuntimeMeshMobility(ERuntimeMeshMobility NewMobility)
43 {
44  if (RuntimeMeshComponent)
45  {
46  RuntimeMeshComponent->SetRuntimeMeshMobility(NewMobility);
47  }
48 }
49 
50 void ARuntimeMeshActor::SetMobility(EComponentMobility::Type InMobility)
51 {
52  if (RuntimeMeshComponent)
53  {
54  RuntimeMeshComponent->SetMobility(InMobility);
55  }
56 }
57 
58 EComponentMobility::Type ARuntimeMeshActor::GetMobility()
59 {
60  if (RuntimeMeshComponent)
61  {
62  return RuntimeMeshComponent->Mobility;
63  }
64  return EComponentMobility::Static;
65 }
66 
67 void ARuntimeMeshActor::OnConstruction(const FTransform& Transform)
68 {
69  Super::OnConstruction(Transform);
70 
71  if (bRunGenerateMeshesOnConstruction)
72  {
73  GenerateMeshes();
74  }
75 }
76 
77 void ARuntimeMeshActor::BeginPlay()
78 {
79  Super::BeginPlay();
80 
81  bool bIsGameWorld = GetWorld() && GetWorld()->IsGameWorld() && !GetWorld()->IsPreviewWorld() && !GetWorld()->IsEditorWorld();
82 
83  bool bHadSerializedMeshData = false;
84  if (RuntimeMeshComponent)
85  {
86  URuntimeMesh* Mesh = RuntimeMeshComponent->GetRuntimeMesh();
87  if (Mesh)
88  {
89  bHadSerializedMeshData = Mesh->ShouldSerializeMeshData();
90  }
91  }
92 
93  if ((bIsGameWorld && !bHadSerializedMeshData) || bRunGenerateMeshesOnBeginPlay)
94  {
95  GenerateMeshes();
96  }
97 }
98 
99 void ARuntimeMeshActor::GenerateMeshes_Implementation()
100 {
101 
102 }
103 
ERuntimeMeshMobility
bool ShouldSerializeMeshData()
Definition: RuntimeMesh.h:105
::geometry_msgs::Transform_< std::allocator< void > > Transform
Definition: Transform.h:54


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:41