I3DHInteractiveSplatDrawing.h Source File

instant3Dhub: I3DHInteractiveSplatDrawing.h Source File
instant3Dhub
I3DHInteractiveSplatDrawing.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "CoreMinimal.h"
9
10#include "I3DHError.h"
11#include "I3DHVersion.h"
12
13#include "Components/InstancedStaticMeshComponent.h"
14#include "GameFramework/Actor.h"
15#include "Templates/RefCounting.h"
16
17#include "I3DHInteractiveSplatDrawing.generated.h"
18
19class AI3DHConnector;
20
21DECLARE_DYNAMIC_DELEGATE_TwoParams(FSplatDrawingCreatedDelegate, const FI3DHDrawingResult&, DrawingResult, const FI3DHDrawingProperties&, DrawingProperties);
22
23class INSTANT3DHUB_EXPERIMENTAL(0.0.27, "The instant3Dhub Drawings feature is available as a preview and is actively under development.") AI3DHInteractiveSplatDrawing;
24
45UCLASS(Experimental, Abstract, NotPlaceable, meta = (DisplayName = "I3DH Interactive SplatDrawing (Experimental)"))
46class INSTANT3DHUBDRAWINGS_API AI3DHInteractiveSplatDrawing : public AActor
47{
48 GENERATED_BODY()
49
50public:
51 // Sets default values for this actor's properties
53
60 UFUNCTION(BlueprintCallable, meta = (DefaultToSelf = "HubConnector", DeterminesOutputType = "DrawingClass"), Category = "{instant3DhubDrawings}")
61 static AI3DHInteractiveSplatDrawing* CreateInteractiveSplatDrawing(AI3DHConnector* HubConnector, TSubclassOf<AI3DHInteractiveSplatDrawing> DrawingClass = nullptr);
62
67 void InitializePreSpawn(AI3DHConnector* ParentHubConnector);
68
73 UFUNCTION(BlueprintPure, Category = "{instant3DhubDrawings}")
74 AI3DHConnector* GetHubConnector() const { return HubConnector; }
75
80 UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "Color"), Category = "{instant3DhubDrawings}")
81 void SetBrushAndEraserColor(const FLinearColor& Color);
82
87 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3DhubDrawings}")
88 FLinearColor GetBrushAndEraserColor() const;
89
94 UFUNCTION(BlueprintCallable, Category = "{instant3DhubDrawings}")
95 void SetBrushHiddenInGame(bool bIsHiddenInGame);
96
104 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3DhubDrawings}")
105 void MoveBrushTo(const FVector& Location, const FVector& Normal, const FVector& Scale) const;
106
111 UFUNCTION(BlueprintCallable, Category = "{instant3DhubDrawings}")
112 void DrawAtBrush();
113
119 UFUNCTION(BlueprintCallable, Category = "{instant3DhubDrawings}")
120 void EraseAtBrush(bool bEraseAllColors = false);
121
126 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3DhubDrawings}")
127 bool IsEmpty() const;
128
130 UFUNCTION(BlueprintCallable, Category = "{instant3DhubDrawings}")
131 void Clear();
132
139 void FinalizeDrawing(TUniqueFunction<void(FI3DHDrawingResult)> OnComplete);
140
151 void CreateHubDrawingAndDestroy(const FString& Name, TUniqueFunction<void(int DrawingHandle, EI3DHErrorCode ErrorCode)> OnComplete);
152
154 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3DhubDrawings}")
155 double MinBrushDist = 0.25;
156
158 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3DhubDrawings}")
159 double EraserRelativeSize = 0.75;
160
165 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3DhubDrawings}")
166 double DrawingNormalOffset = 0.01;
167
169 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3DhubDrawings}")
170 FString ThumbnailBase64DataURI;
171
172protected:
173 // Called when the game starts or when spawned
174 virtual void BeginPlay() override;
175
176 virtual bool IsReadyForFinishDestroy() override { return Super::IsReadyForFinishDestroy() && (!AsyncTaskFence.IsValid() || AsyncTaskFence.GetRefCount() <= 1); }
177
178private:
179 UPROPERTY()
180 AI3DHConnector* HubConnector;
181
182 UPROPERTY(EditDefaultsOnly, Category = "{instant3DhubDrawings}")
183 UStaticMeshComponent* BrushMesh;
184
185 UPROPERTY(EditDefaultsOnly, Category = "{instant3DhubDrawings}")
186 FLinearColor DefaultColor = FLinearColor::Yellow;
187
188 UPROPERTY()
189 TMap<UMaterialInterface*, UInstancedStaticMeshComponent*> MaterialToInstancedStaticMesh;
190
191 UPROPERTY()
192 bool bIsFinalized{ false };
193
194 // Keeps track how many instances are drawn.
195 int NumRenderInstances = 0;
196
197 TRefCountPtr<FThreadSafeRefCountedObject> AsyncTaskFence{nullptr};
198};
The HubConnector is the central actor for communication with an instant3Dhub instance in your network...
Definition I3DHConnector.h:98
A helper for creating splat-based drawings in the scene that are synced to the session when finished.
Definition I3DHInteractiveSplatDrawing.h:47
#define INSTANT3DHUB_EXPERIMENTAL(Version, Message)
Macro for marking up experimental code, functions and types.
Definition I3DHVersion.h:212
instant3Dhub drawing properties.
Definition I3DHDataTypes.h:1750
Encapsulates the result of an instant3Dhub drawing.
Definition I3DHDataTypes.h:1811