Files
UnrealEngineUWP/Engine/Source/Runtime/GeometryFramework/Public/DynamicMeshActor.h
ryan schmidt 21cd57289b GeometryScript: automatically clear mesh before rebuild in GeneratedDynamicMeshActor. Expose ADynamicMeshActor members. Bump up size of "empty" mesh bounding box in DynamicMeshComponent to prevent log spam.
#rb none
#rnx
#preflight 615b2a842554620001ff5546

#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 17724133 in //UE5/Release-5.0/... via CL 17724136
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v879-17706426)
#ROBOMERGE[STARSHIP]: UE5-Main

[CL 17724146 by ryan schmidt in ue5-release-engine-test branch]
2021-10-05 13:22:31 -04:00

69 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UDynamicMesh.h"
#include "Components/DynamicMeshComponent.h"
#include "DynamicMeshActor.generated.h"
/**
* ADynamicMeshActor is an Actor that has a USimpleDynamicMeshComponent as it's RootObject.
*/
UCLASS(ConversionRoot, ComponentWrapperClass, ClassGroup=DynamicMesh, meta = (ChildCanTick))
class GEOMETRYFRAMEWORK_API ADynamicMeshActor : public AActor
{
GENERATED_UCLASS_BODY()
protected:
UPROPERTY(Category = DynamicMeshActor, VisibleAnywhere, BlueprintReadOnly, meta = (ExposeFunctionCategories = "Mesh,Rendering,Physics,Components|StaticMesh", AllowPrivateAccess = "true"))
TObjectPtr<class UDynamicMeshComponent> DynamicMeshComponent;
public:
UFUNCTION(BlueprintCallable, Category = DynamicMeshActor)
UDynamicMeshComponent* GetDynamicMeshComponent() const { return DynamicMeshComponent; }
//
// Mesh Pool support. Meshes can be locally allocated from the Mesh Pool
// in Blueprints, and then released back to the Pool and re-used. This
// avoids generating temporary UDynamicMesh instances that need to be
// garbage-collected. See UDynamicMeshPool for more details.
//
public:
/** Control whether the DynamicMeshPool will be created when requested via GetComputeMeshPool() */
UPROPERTY(Category = DynamicMeshActor, EditAnywhere, BlueprintReadWrite)
bool bEnableComputeMeshPool = true;
protected:
/** The internal Mesh Pool, for use in DynamicMeshActor BPs. Use GetComputeMeshPool() to access this, as it will only be created on-demand if bEnableComputeMeshPool = true */
UPROPERTY(Transient)
TObjectPtr<UDynamicMeshPool> DynamicMeshPool;
public:
/** Access the compute mesh pool */
UFUNCTION(BlueprintCallable, Category = DynamicMeshActor)
UDynamicMeshPool* GetComputeMeshPool();
/** Request a compute mesh from the Pool, which will return a previously-allocated mesh or add and return a new one. If the Pool is disabled, a new UDynamicMesh will be allocated and returned. */
UFUNCTION(BlueprintCallable, Category = DynamicMeshActor)
UDynamicMesh* AllocateComputeMesh();
/** Release a compute mesh back to the Pool */
UFUNCTION(BlueprintCallable, Category = DynamicMeshActor)
bool ReleaseComputeMesh(UDynamicMesh* Mesh);
/** Release all compute meshes that the Pool has allocated */
UFUNCTION(BlueprintCallable, Category = DynamicMeshActor)
void ReleaseAllComputeMeshes();
/** Release all compute meshes that the Pool has allocated, and then release them from the Pool, so that they will be garbage-collected */
UFUNCTION(BlueprintCallable, Category = DynamicMeshActor)
void FreeAllComputeMeshes();
};