35 #include "RRMeshActor.generated.h"
106 virtual bool HasInitialized(
bool bIsLogged =
false)
const override;
118 virtual void Reset()
override;
120 void DrawTransform();
144 int32 CreatedMeshesNum = 0;
155 int32 ToBeCreatedMeshesNum = 0;
166 TObjectPtr<UMeshComponent> BaseMeshComp =
nullptr;
182 return BaseMeshComp ? BaseMeshComp->GetMaterial(InMaterialIndex) :
nullptr;
198 virtual void DeclareFullCreation(
bool bInCreationResult);
211 FIntVector CellIdx = FIntVector::ZeroValue;
223 UMeshComponent* GetMeshComponent(int32 Index = 0)
const;
243 template<
typename TMeshComp>
247 const TArray<FString>& InMeshUniqueNameList,
249 const TArray<FTransform>& InMeshRelTransf = TArray<FTransform>(),
251 const TArray<FString>& InMaterialNameList = TArray<FString>())
257 TArray<TMeshComp*> addedMeshCompList;
259 if (InMeshRelTransf.Num() > 0)
263 verify(InMeshRelTransf.Num() == InMeshUniqueNameList.Num());
267 if (InMaterialNameList.Num() > 0)
271 verify(InMaterialNameList.Num() == InMeshUniqueNameList.Num());
277 TMeshComp* meshComp =
nullptr;
279 for (
auto i = 0; i < InMeshUniqueNameList.Num(); ++i)
283 const FString& meshUniqueName = InMeshUniqueNameList[i];
289 if ((
false == FPaths::IsRelative(meshUniqueName)) && (
false == FPaths::FileExists(meshUniqueName)))
293 UE_LOG_WITH_INFO(LogTemp, Error, TEXT(
"Mesh invalid [%s] is non-existent"), *meshUniqueName);
305 meshComp = URRUObjectUtils::CreateMeshComponent<TMeshComp>(
311 FString::Printf(TEXT(
"%s_MeshComp_%u"), *ActorInfo->UniqueName, MeshCompList.Num()),
313 InMeshRelTransf.IsValidIndex(i) ? InMeshRelTransf[i] : FTransform::Identity,
315 ActorInfo->bIsStationary,
317 ActorInfo->bIsPhysicsEnabled,
319 ActorInfo->bIsCollisionEnabled,
321 ActorInfo->bIsOverlapEventEnabled,
333 if (meshComp->InitializeMesh(meshUniqueName))
337 addedMeshCompList.AddUnique(meshComp);
345 UE_LOG_WITH_INFO_NAMED(LogTemp, Error, TEXT(
"Failed initializing mesh comp[%s]"), *meshUniqueName);
355 UE_LOG_WITH_INFO(LogTemp,
359 TEXT(
"[%s:%d] - Failed creating child Mesh Component [%s]!"),
361 *ActorInfo->UniqueName,
373 MeshCompList.Append(addedMeshCompList);
381 if ((
nullptr == BaseMeshComp) && (MeshCompList.Num() > 0))
385 BaseMeshComp = MeshCompList[0];
389 if (BaseMeshComp->GetRelativeTransform().Equals(FTransform::Identity))
401 USceneComponent* oldRoot = RootComponent;
403 SetRootComponent(BaseMeshComp);
409 oldRoot->DestroyComponent();
419 return addedMeshCompList;
435 virtual void OnBodyComponentMeshCreationDone(
bool bInCreationResult, UObject* InMeshBodyComponent);
447 void SetCustomDepthEnabled(
bool bIsCustomDepthEnabled);
461 void SetCustomDepthStencilValue(int32 InCustomDepthStencilValue);
477 bool IsCustomDepthEnabled()
const;
489 TArray<int32> GetCustomDepthStencilValueList()
const;
513 #if RAPYUTA_SIM_VISUAL_DEBUG
517 SetActorHiddenInGame(!bInIsActivated);
527 if (
false == bInIsActivated)
531 CellIdx = FIntVector::NoneValue;
533 SetActorLocation(FVector(0.f, 0.f, -5000.f));
535 OnDeactivated.ExecuteIfBound(
this);
539 else if (CellIdx == FIntVector::NoneValue)
543 CellIdx = FIntVector::ZeroValue;
551 SetCustomDepthEnabled(bInIsActivated);
567 return (CellIdx != FIntVector::NoneValue);