38 #include "cohtml/View.h" 40 #include "HummingbirdMeshData.h" 41 #include "HummingbirdSystem.h" 42 #include "HummingbirdEventHelpers.h" 43 #include "HummingbirdViewListener.h" 44 #include "HummingbirdRenderWrapper.h" 45 #include "HummingbirdAudioWrapper.h" 46 #include "HummingbirdDataBinding.h" 47 #include "HummingbirdBaseComponent.generated.h" 54 class FHummingbirdGesturePolicy;
57 class HUMMINGBIRDPLUGIN_API UHummingbirdBaseComponent :
public UActorComponent
59 GENERATED_UCLASS_BODY()
64 UFUNCTION(BlueprintCallable, Category = "Audio")
65 void SetSoundAttenuation(const FSoundAttenuationSettings& Settings);
68 UPROPERTY(BlueprintAssignable)
69 FHBReadyForBindingsSignature ReadyForBindings;
72 UPROPERTY(BlueprintAssignable)
73 FHBBindingsReleasedSignature BindingsReleased;
76 UPROPERTY(BlueprintAssignable)
77 FHBScriptingReady HBScriptingReady;
80 UFUNCTION(BlueprintCallable, Category = "View")
81 virtual
void Resize( int32 width, int32 height);
84 UFUNCTION(BlueprintCallable, Category = "View")
85 bool IsReadyToCreateView() const;
88 UFUNCTION(BlueprintCallable, Category = "View")
89 bool IsReadyForBindings() const;
92 UFUNCTION(BlueprintCallable, Category = "View")
93 bool HasRequestedView() const;
96 UFUNCTION(BlueprintCallable, Category = "View")
97 void ShowPaintRects(
bool show);
100 UFUNCTION(BlueprintCallable, Category = "View")
101 void Load(const FString& path);
104 UFUNCTION(BlueprintCallable, Category = "View")
108 UFUNCTION(BlueprintCallable, Category = "View")
109 void DebugSaveNextFrame();
112 UFUNCTION(BlueprintCallable, Category = "View")
113 void BeginDebugFrameSave();
116 UFUNCTION(BlueprintCallable, Category = "View")
117 void EndDebugFrameSave();
120 UFUNCTION(BlueprintCallable, Category = "View")
121 void EnableDelayedUpdate(
bool bEnabled);
124 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
128 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
132 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
133 void CreateDataModelFromObject(const FString& Name, UObject* Model);
136 UFUNCTION(BlueprintCallable, CustomThunk, meta = (CustomStructureParam = "Arg"), Category = "ViewScripting")
137 void CreateDataModelFromStruct(const FString& Name, const UStructProperty* Arg);
142 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
143 void UpdateWholeDataModelFromObject(UObject* Model) const;
148 UFUNCTION(BlueprintCallable, CustomThunk, meta = (CustomStructureParam = "Struct"), Category = "ViewScripting")
149 void UpdateWholeDataModelFromStruct(const UStructProperty* Struct) const;
152 UFUNCTION(BlueprintCallable, Category = "ViewScripting")
153 void SynchronizeModels() const;
156 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View", DisplayName = "Enable Complex CSS Selector Support")
157 bool bEnableComplexCSSSupport;
160 UPROPERTY(BlueprintReadOnly, Category = "View")
161 UTextureRenderTarget2D* Texture;
163 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View", AdvancedDisplay)
164 TEnumAsByte<enum TextureFilter> Filter;
167 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View")
172 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View")
175 static
void CreateSystemIfNecessary(UWorld* World);
176 static class AHummingbirdSystem* GetSystemActor(UWorld* World);
178 virtual ~UHummingbirdBaseComponent();
179 virtual
void InitializeComponent() override;
180 virtual
void BeginDestroy() override;
181 virtual
bool IsReadyForFinishDestroy() override;
182 virtual
void FinishDestroy() override;
184 virtual
void TickComponent(
float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
186 bool EnsureMeshData();
187 TArray<FHummingbirdMeshData> MeshData;
189 typedef TArray<TWeakObjectPtr<UHummingbirdBaseComponent>> WeakHummingbirdComponentsArray;
190 static WeakHummingbirdComponentsArray::TIterator GetUHummingbirdBaseComponentIterator(UWorld* world);
192 cohtml::View* GetView() const;
193 cohtml::ViewRenderer* GetViewRenderer() const;
194 FHummingbirdGesturePolicy* GetGesturePolicy();
197 void CreateView(const
cohtml::ViewSettings& info, const FString& url);
199 virtual
void SendRenderDynamicData_Concurrent() override;
200 virtual
bool RequiresGameThreadEndOfFrameUpdates()
const override {
return true; }
203 friend class THummingbirdViewListener<UHummingbirdBaseComponent>;
205 void OnAudioStreamCreated(
int Id,
int BitDepth,
int Channels,
207 void OnAudioStreamClosed(
int Id);
208 void OnAudioStreamPlay(
int Id);
209 void OnAudioStreamPause(
int Id);
210 void OnAudioDataReceived(
int Id,
int Samples,
float** Pcm,
212 void OnAudioStreamEnded(
int Id);
213 void OnAudioStreamVolumeChanged(
int Id,
float Volume);
215 THummingbirdAudioWrapper<UHummingbirdBaseComponent> AudioWrapper;
217 void SetReadyForBindings();
219 FCaretRect CaretRect;
220 TUniquePtr<THummingbirdViewListener<UHummingbirdBaseComponent>> Listener;
221 TUniquePtr<FHummingbirdRenderWrapper> RenderWrapper;
224 struct GesturePolicyDeleter
226 void operator()(FHummingbirdGesturePolicy* Ptr)
const;
228 TUniquePtr<FHummingbirdGesturePolicy, GesturePolicyDeleter> GesturePolicy;
230 AHummingbirdSystem* SystemActor;
231 cohtml::SystemRenderer* SystemRenderer;
233 bool bIsReadyForBindings;
235 bool bIsLoadingMeshData;
238 void LoadMeshData(
const TArray<TWeakObjectPtr<UStaticMeshComponent>>& Meshes);
240 unsigned PendingLayout;
243 #if defined(HUMMINGBIRD_UE4_418_SUPPORT) 244 DECLARE_FUNCTION(execCreateDataModelFromStruct)
246 if (!bIsReadyForBindings)
250 P_GET_PROPERTY(UStrProperty, Name);
252 Stack.StepCompiledIn<UStructProperty>(NULL);
253 void* ArgAddress = Stack.MostRecentPropertyAddress;
254 UStructProperty* Prop = Cast<UStructProperty>(Stack.MostRecentProperty);
258 HummingbirdDataBindingHelpers::CreateModel(GetView(), Name, ArgAddress, Prop->Struct);
263 DECLARE_FUNCTION(execUpdateWholeDataModelFromStruct)
265 if (!bIsReadyForBindings)
270 Stack.StepCompiledIn<UStructProperty>(NULL);
271 void* ArgAddress = Stack.MostRecentPropertyAddress;
272 UStructProperty* Prop = Cast<UStructProperty>(Stack.MostRecentProperty);
273 HummingbirdDataBindingHelpers::UpdateWholeModel(GetView(), ArgAddress, Prop->Struct);
278 DECLARE_FUNCTION(execCreateDataModelFromStruct);
279 DECLARE_FUNCTION(execUpdateWholeDataModelFromStruct);
Definition: HummingbirdJSEvent.h:51
Definition: HummingbirdFColorBinder.h:41