38 #include "Coherent/UIGT/View.h" 40 #include "CoherentUIGTMeshData.h" 41 #include "CoherentUIGTSystem.h" 42 #include "CoherentUIGTEventHelpers.h" 43 #include "CoherentUIGTViewListener.h" 44 #include "CoherentUIGTRenderWrapper.h" 45 #include "CoherentUIGTAudioWrapper.h" 46 #include "CoherentUIGTDataBinding.h" 48 #if !defined(COHERENT_UI_GT_UE4_413_SUPPORT) 49 #include "Runtime/Core/Public/HAL/ThreadSafeBool.h" 52 #include "CoherentUIGTBaseComponent.generated.h" 58 class UISystemRenderer;
66 GENERATED_UCLASS_BODY()
69 typedef TSharedPtr<TCoherentUIGTViewListener<UCoherentUIGTBaseComponent>> ListenerPtr;
70 typedef TSharedPtr<FCoherentUIGTRenderWrapper> RenderWrapperPtr;
73 UPROPERTY(BlueprintAssignable)
74 FUIGTReadyForBindingsSignature ReadyForBindings;
77 UPROPERTY(BlueprintAssignable)
78 FUIGTBindingsReleasedSignature BindingsReleased;
81 UPROPERTY(BlueprintAssignable)
82 FUIGTFinishLoadSignature FinishLoad;
85 UPROPERTY(BlueprintAssignable)
86 FUIGTFailLoadSignature FailLoad;
89 UPROPERTY(BlueprintAssignable)
90 FUIGTStartLoadingSignature StartLoading;
93 UPROPERTY(BlueprintAssignable)
94 FUIGTNavigateToSignature NavigateTo;
97 UPROPERTY(BlueprintAssignable)
98 FUIGTOnJavaScriptEvent JavaScriptEvent;
101 UPROPERTY(BlueprintAssignable)
102 FUIGTScriptingReady UIGTScriptingReady;
107 FUIGTOnLiveViewSizeRequest LiveViewSizeRequested;
110 FUIGTOnPerformanceAuditSignature OnPerformanceAudit;
113 UFUNCTION(BlueprintCallable, Category = "View")
114 virtual
void Resize( int32 width, int32 height);
117 UFUNCTION(BlueprintCallable, Category = "View")
118 bool IsReadyToCreateView() const;
121 UFUNCTION(BlueprintCallable, Category = "View")
122 bool IsReadyForBindings() const;
125 UFUNCTION(BlueprintCallable, Category = "View")
126 bool HasRequestedView() const;
129 UFUNCTION(BlueprintCallable, Category = "View")
130 bool IsTransparent() const;
133 UFUNCTION(BlueprintCallable, Category = "View")
134 void ShowPaintRects(
bool show);
137 UFUNCTION(BlueprintCallable, Category = "View")
141 UFUNCTION(BlueprintCallable, Category = "View")
142 void Load(const FString& path);
145 UFUNCTION(BlueprintCallable, Category = "View")
149 UFUNCTION(BlueprintCallable, Category = "View")
150 bool IsDocumentReady() const;
153 UFUNCTION(BlueprintCallable, Category = "View")
154 void DebugSaveNextFrame();
157 UFUNCTION(BlueprintCallable, Category = "View")
158 void BeginDebugFrameSave();
161 UFUNCTION(BlueprintCallable, Category = "View")
162 void EndDebugFrameSave();
165 UPROPERTY(BlueprintReadOnly, Category = "View")
166 UTextureRenderTarget2D* Texture;
168 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View", AdvancedDisplay)
169 TEnumAsByte<enum TextureFilter> Filter;
172 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View")
177 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View")
178 bool bReceiveInputWhenTransparent;
181 UFUNCTION(BlueprintCallable, Category = "View")
182 void SetClickThroughAlphaThreshold(
float threshold);
185 UFUNCTION(BlueprintCallable, Category = "View")
186 float GetClickThroughAlphaThreshold() const;
189 UFUNCTION(BlueprintCallable, Category = "View")
190 void EnableDelayedUpdate(
bool bEnabled);
193 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
197 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
201 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
202 void CreateDataModelFromObject(const FString& Name, UObject* Model);
206 UFUNCTION(BlueprintCallable, CustomThunk, meta = (CustomStructureParam = "Arg"), Category = "ViewScripting")
207 void CreateDataModelFromStruct(const FString& Name, const TFieldPath<FStructProperty> Arg);
211 UFUNCTION(BlueprintCallable, CustomThunk, meta = (CustomStructureParam = "Arg"), Category = "ViewScripting")
212 void UpdateWholeDataModelFromStruct(const TFieldPath<FStructProperty> Arg) const;
217 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
218 void UpdateWholeDataModelFromObject(UObject* Model) const;
221 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
222 void SynchronizeModels() const;
228 void SetSoundAttenuation(const FAttenuationSettingsClass& settings);
230 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings")
231 bool AllowPerformanceWarnings;
233 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings", meta = (ClampMin = "0", UIMin = "0", UIMax = "100"))
234 float ExecuteJSTimersThresholdMs;
236 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings", meta = (ClampMin = "0", UIMin = "0", UIMax = "100"))
237 float UpdateStylesAndLayoutThresholdMs;
239 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings", meta = (ClampMin = "0", UIMin = "0", UIMax = "100"))
240 float RecordRenderingCommandsThresholdMs;
242 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings", meta = (ClampMin = "0", UIMin = "0", UIMax = "100"))
243 float PaintWarningThresholdMs;
245 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings", meta = (ClampMin = "0", UIMin = "0", UIMax = "200"))
246 int32 LayersCountThreshold;
248 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings", meta = (ClampMin = "0", UIMin = "128", UIMax = "8192"))
249 int32 LayerWidthThreshold;
251 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ViewWarnings", meta = (ClampMin = "0", UIMin = "128", UIMax = "8192"))
252 int32 LayerHeightThreshold;
256 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View")
257 bool bEnableAdditionalDefaultStyles;
261 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View")
268 FOnViewStateAdoption OnViewStateAdoption;
274 FOnViewStatePostAdoption OnViewStatePostAdoption;
280 FOnViewStatePutForAdoption OnViewStatePutForAdoption;
282 EMouseCursor::Type CurrentMouseCursor;
284 Coherent::UIGT::View* GetView() const;
285 static
void CreateSystemIfNecessary(UWorld* World);
289 virtual
void InitializeComponent() override;
290 virtual
void BeginDestroy() override;
291 virtual
bool IsReadyForFinishDestroy() override;
292 virtual
void FinishDestroy() override;
294 virtual
void TickComponent(
float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
295 void IssueMouseOnUIQuery(
float normX,
float normY);
297 bool EnsureMeshData();
301 void SetCaretRect(
int x,
int y,
unsigned width,
unsigned height);
304 static WeakCoherentUIGTComponentsArray::TIterator GetUCoherentUIGTBaseComponentIterator(UWorld* world);
306 Coherent::UIGT::ViewRenderer* GetViewRenderer() const;
308 bool bWasMouseOnUILastFrame;
311 void CreateView(const
Coherent::UIGT::ViewInfo& info, const FString& url,
bool PaintToBackBuffer = false);
312 ListenerPtr Listener;
313 RenderWrapperPtr RenderWrapper;
318 void SetReadyForBindings();
319 void OnCallback(const
char* eventName, const
Coherent::UIGT::EventArguments& arguments);
321 void OnLiveViewSizeRequested(const FString& name, int32& width, int32& height);
322 void OnLiveViewActivate(const FString& name,
bool active);
323 void OnCursorChanged(
Coherent::UIGT::CursorType Cursor);
325 void OnAudioStreamCreated(
int id,
int bitDepth,
int channels,
327 void OnAudioStreamClosed(
int id);
328 void OnAudioStreamPlay(
int id);
329 void OnAudioStreamPause(
int id);
330 void OnAudioDataReceived(
int id,
int samples,
float** pcm,
332 void OnAudioStreamEnded(
int id);
339 Coherent::UIGT::UISystemRenderer* SystemRenderer;
341 bool bIsLoadingMeshData;
343 #if defined(COHERENT_UI_GT_UE4_413_SUPPORT) 346 FThreadSafeBool bHasMeshData;
349 void LoadMeshData(
const TArray<TWeakObjectPtr<UStaticMeshComponent>>& Meshes);
351 unsigned PendingLayout;
354 #if defined(COHERENT_UI_GT_UE4_418_SUPPORT) 355 DECLARE_FUNCTION(execCreateDataModelFromStruct)
357 if (!IsReadyForBindings())
361 P_GET_PROPERTY(UStrProperty, Name);
363 Stack.StepCompiledIn<UStructProperty>(NULL);
364 void* ArgAddress = Stack.MostRecentPropertyAddress;
365 UStructProperty* Prop = Cast<UStructProperty>(Stack.MostRecentProperty);
369 CoherentUIGTDataBindingHelpers::CreateModel(GetView(), Name, ArgAddress, Prop->Struct);
374 DECLARE_FUNCTION(execUpdateWholeDataModelFromStruct)
376 if (!IsReadyForBindings())
381 Stack.StepCompiledIn<UStructProperty>(NULL);
382 void* ArgAddress = Stack.MostRecentPropertyAddress;
383 UStructProperty* Prop = Cast<UStructProperty>(Stack.MostRecentProperty);
384 CoherentUIGTDataBindingHelpers::UpdateWholeModel(GetView(), ArgAddress, Prop->Struct);
389 DECLARE_FUNCTION(execCreateDataModelFromStruct);
390 DECLARE_FUNCTION(execUpdateWholeDataModelFromStruct);
396 typedef UCoherentUIGTBaseComponent::ListenerPtr ListenerPtr;
397 typedef UCoherentUIGTBaseComponent::RenderWrapperPtr RenderWrapperPtr;
399 ListenerPtr Listener;
400 RenderWrapperPtr RenderWrapper;
406 : Listener(InListener)
407 , RenderWrapper(InRenderWrapper)
410 Coherent::UIGT::View* GetView()
412 return RenderWrapper->GetView();
415 void DestroyRenderWrapper()
417 if (RenderWrapper.IsValid())
419 RenderWrapper->BeginDestroy();
420 RenderWrapper->WaitForFinishDestroy();
421 RenderWrapper->FinishDestroy();
Definition: CoherentUIGTAudioWrapper.h:66
Definition: CoherentUIGTBaseComponent.h:394
Definition: CoherentUIGTMeshData.h:52
Definition: CoherentUIGTBaseComponent.h:64
Definition: CoherentUIGTEventHelpers.h:73
Definition: CoherentUIGTSystem.h:52
Definition: CoherentUIGTViewListener.h:44
Definition: CoherentUIGTJSEvent.h:52
Definition: CoherentUIGTFColorBinder.h:40