Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
getnamo committed Mar 13, 2020
1 parent 167b1d0 commit 264055a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
Binary file modified Content/BluiWidget.uasset
Binary file not shown.
Binary file modified Content/BluiWorldWidgetActorExample.uasset
Binary file not shown.
Binary file added Content/InteractableBluiWidgetActor.uasset
Binary file not shown.
20 changes: 16 additions & 4 deletions Source/Blu/Private/BluEye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ void UBluEye::init()
browserSettings.universal_access_from_file_urls = STATE_ENABLED;
browserSettings.file_access_from_file_urls = STATE_ENABLED;

browserSettings.web_security = STATE_DISABLED;

info.width = Width;
info.height = Height;

Expand Down Expand Up @@ -99,11 +101,12 @@ void UBluEye::ResetTexture()

ResetMatInstance();

bValidTexture = true;
}

void UBluEye::DestroyTexture()
{
// Here we destory the texture and its resource
// Here we destroy the texture and its resource
if (Texture)
{
Texture->RemoveFromRoot();
Expand All @@ -116,6 +119,7 @@ void UBluEye::DestroyTexture()

Texture->MarkPendingKill();
Texture = nullptr;
bValidTexture = false;
}
}

Expand All @@ -128,7 +132,7 @@ void UBluEye::TextureUpdate(const void *buffer, FUpdateTextureRegion2D *updateRe
}

//todo: remove debug address hack
if (Texture && (int64)Texture != 0xdddddddddddddddd && Texture->IsValidLowLevel() && Texture->Resource)
if (bValidTexture)
{

if (buffer == nullptr)
Expand Down Expand Up @@ -320,10 +324,14 @@ UTexture2D* UBluEye::ResizeBrowser(const int32 NewWidth, const int32 NewHeight)
renderer->Width = NewWidth;
renderer->Height = NewHeight;

bValidTexture = false;

Texture = UTexture2D::CreateTransient(Width, Height, PF_B8G8R8A8);
Texture->AddToRoot();
Texture->UpdateResource();

bValidTexture = true;

// Let the browser's host know we resized it
browser->GetHost()->WasResized();

Expand All @@ -350,10 +358,14 @@ UTexture2D* UBluEye::CropWindow(const int32 Y, const int32 X, const int32 NewWid
renderer->Width = NewWidth;
renderer->Height = NewHeight;

bValidTexture = false;

Texture = UTexture2D::CreateTransient(Width, Height, PF_B8G8R8A8);
Texture->AddToRoot();
Texture->UpdateResource();

bValidTexture = true;

// Now we can keep going
bEnabled = true;

Expand Down Expand Up @@ -582,7 +594,7 @@ UTexture2D* UBluEye::GetTexture() const
{
if (!Texture)
{
return UTexture2D::CreateTransient(Width, Height);
return UTexture2D::CreateTransient(Width, Height, PF_B8G8R8A8);
}

return Texture;
Expand Down Expand Up @@ -621,7 +633,7 @@ void UBluEye::ResetMatInstance()
return;
}

MaterialInstance->SetTextureParameterValue(TextureParameterName, GetTexture());
MaterialInstance->SetTextureParameterValue(TextureParameterName, Texture);
}

void UBluEye::CloseBrowser()
Expand Down
2 changes: 2 additions & 0 deletions Source/Blu/Public/BluEye.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,6 @@ class BLU_API UBluEye : public UObject

FBluTextureParams RenderParams;

FThreadSafeBool bValidTexture;

};

0 comments on commit 264055a

Please sign in to comment.