Skip to content

Commit a956c23

Browse files
committed
Merge branch 'sub-path'
2 parents 0053606 + daa22ea commit a956c23

10 files changed

+39
-31
lines changed

BLUI.uplugin

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"FileVersion": 3,
33
"FriendlyName": "BLUI",
44
"Version": 3,
5-
"VersionName": "4.3.0",
5+
"VersionName": "4.3.1",
66
"Description": "Chromium Embedded Framework (CEF) powered HTML UI and HUD for Unreal Engine 4",
77
"Category": "UI",
88
"CreatedBy": "Aaron M. Shea, Getnamo, & Contributors",

Content/BluiWidget.uasset

-25 KB
Binary file not shown.
16.5 KB
Binary file not shown.

Source/Blu/Blu.Build.cs

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public Blu(ReadOnlyTargetRules Target) : base(Target)
2626
"Core",
2727
"CoreUObject",
2828
"Engine",
29+
"Projects",
2930
"InputCore",
3031
"RenderCore",
3132
"RHI",

Source/Blu/Private/Blu.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "IBlu.h"
2+
#include "Interfaces/IPluginManager.h"
23
#include "BluManager.h"
34

45
class FBlu : public IBlu
@@ -8,7 +9,7 @@ class FBlu : public IBlu
89
virtual void StartupModule() override
910
{
1011
CefString GameDirCef = *FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "BluCache");
11-
FString ExecutablePath = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "Plugins/BLUI/ThirdParty/cef/");
12+
FString ExecutablePath = FPaths::ConvertRelativePathToFull(IPluginManager::Get().FindPlugin("BLUI")->GetBaseDir() + "/ThirdParty/cef/");
1213

1314
// Setup the default settings for BluManager
1415
BluManager::Settings.windowless_rendering_enabled = true;

Source/Blu/Private/BluEye.cpp

+24-20
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ FBluEyeSettings::FBluEyeSettings()
88
{
99
FrameRate = 60.f;
1010

11-
Width = 1280;
12-
Height = 720;
11+
ViewSize.X = 1280;
12+
ViewSize.Y = 720;
1313

1414
bIsTransparent = false;
1515
bEnableWebGL = true;
1616
bAudioMuted = false;
1717
bAutoPlayEnabled = true;
18+
bDebugLogTick = false;
1819
}
1920

2021
UBluEye::UBluEye(const class FObjectInitializer& PCIP)
@@ -41,7 +42,7 @@ void UBluEye::Init()
4142
}
4243
}
4344

44-
if (Settings.Width <= 0 || Settings.Height <= 0)
45+
if (Settings.ViewSize.X <= 0 || Settings.ViewSize.Y <= 0)
4546
{
4647
UE_LOG(LogBlu, Log, TEXT("Can't initialize when Width or Height are <= 0"));
4748
return;
@@ -53,8 +54,8 @@ void UBluEye::Init()
5354
//BrowserSettings.web_security = STATE_DISABLED;
5455
//BrowserSettings.fullscreen_enabled = true;
5556

56-
Info.width = Settings.Width;
57-
Info.height = Settings.Height;
57+
Info.width = (int32)Settings.ViewSize.X;
58+
Info.height = (int32)Settings.ViewSize.Y;
5859

5960
// Set transparant option
6061
Info.SetAsWindowless(0); //bIsTransparent
@@ -72,7 +73,7 @@ void UBluEye::Init()
7273
//NB: this setting will change it globally for all new instances
7374
BluManager::AutoPlay = Settings.bAutoPlayEnabled;
7475

75-
Renderer = new RenderHandler(Settings.Width, Settings.Height, this);
76+
Renderer = new RenderHandler(Settings.ViewSize.X, Settings.ViewSize.Y, this);
7677
ClientHandler = new BrowserClient(Renderer);
7778
Browser = CefBrowserHost::CreateBrowserSync(
7879
Info,
@@ -112,7 +113,7 @@ void UBluEye::ResetTexture()
112113

113114

114115
// init the new Texture2D
115-
Texture = UTexture2D::CreateTransient(Settings.Width, Settings.Height, PF_B8G8R8A8);
116+
Texture = UTexture2D::CreateTransient(Settings.ViewSize.X, Settings.ViewSize.Y, PF_B8G8R8A8);
116117
Texture->AddToRoot();
117118
Texture->UpdateResource();
118119

@@ -163,11 +164,11 @@ void UBluEye::TextureUpdate(const void *buffer, FUpdateTextureRegion2D *updateRe
163164
RegionData->Texture2DResource = (FTextureResource*)Texture->Resource;
164165
RegionData->NumRegions = regionCount;
165166
RegionData->SrcBpp = 4;
166-
RegionData->SrcPitch = Settings.Width * 4;
167+
RegionData->SrcPitch = int32(Settings.ViewSize.X) * 4;
167168
RegionData->Regions = updateRegions;
168169

169170
//We need to copy this memory or it might get uninitialized
170-
RegionData->SrcData.SetNumUninitialized(RegionData->SrcPitch * Settings.Height);
171+
RegionData->SrcData.SetNumUninitialized(RegionData->SrcPitch * int32(Settings.ViewSize.Y));
171172
FPlatformMemory::Memcpy(RegionData->SrcData.GetData(), buffer, RegionData->SrcData.Num());
172173

173174
ENQUEUE_RENDER_COMMAND(UpdateBLUICommand)(
@@ -329,16 +330,16 @@ UTexture2D* UBluEye::ResizeBrowser(const int32 NewWidth, const int32 NewHeight)
329330
bEnabled = false;
330331

331332
// Set our new Width and Height
332-
Settings.Width = NewWidth;
333-
Settings.Height = NewHeight;
333+
Settings.ViewSize.X = NewWidth;
334+
Settings.ViewSize.Y = NewHeight;
334335

335336
// Update our render handler
336337
Renderer->Width = NewWidth;
337338
Renderer->Height = NewHeight;
338339

339340
bValidTexture = false;
340341

341-
Texture = UTexture2D::CreateTransient(Settings.Width, Settings.Height, PF_B8G8R8A8);
342+
Texture = UTexture2D::CreateTransient(Settings.ViewSize.X, Settings.ViewSize.Y, PF_B8G8R8A8);
342343
Texture->AddToRoot();
343344
Texture->UpdateResource();
344345

@@ -363,16 +364,16 @@ UTexture2D* UBluEye::CropWindow(const int32 Y, const int32 X, const int32 NewWid
363364

364365

365366
// Set our new Width and Height
366-
Settings.Width = NewWidth;
367-
Settings.Height = NewHeight;
367+
Settings.ViewSize.X = NewWidth;
368+
Settings.ViewSize.Y = NewHeight;
368369

369370
// Update our render handler
370371
Renderer->Width = NewWidth;
371372
Renderer->Height = NewHeight;
372373

373374
bValidTexture = false;
374375

375-
Texture = UTexture2D::CreateTransient(Settings.Width, Settings.Height, PF_B8G8R8A8);
376+
Texture = UTexture2D::CreateTransient(Settings.ViewSize.X, Settings.ViewSize.Y, PF_B8G8R8A8);
376377
Texture->AddToRoot();
377378
Texture->UpdateResource();
378379

@@ -395,8 +396,8 @@ UBluEye* UBluEye::SetProperties(const int32 SetWidth,
395396
const FName& SetTextureParameterName,
396397
UMaterialInterface* SetBaseMaterial)
397398
{
398-
Settings.Width = SetWidth;
399-
Settings.Height = SetHeight;
399+
Settings.ViewSize.X = SetWidth;
400+
Settings.ViewSize.Y = SetHeight;
400401

401402
bEnabled = SetEnabled;
402403

@@ -626,11 +627,14 @@ void UBluEye::SpawnTickEventLoopIfNeeded()
626627
{
627628
if (!EventLoopData.DelegateHandle.IsValid())
628629
{
629-
EventLoopData.DelegateHandle = FTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateLambda([](float DeltaTime)
630+
EventLoopData.DelegateHandle = FTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateLambda([&](float DeltaTime)
630631
{
631632
if (EventLoopData.bShouldTickEventLoop)
632633
{
633-
//UE_LOG(LogTemp, Log, TEXT("Delta: %1.2f"), DeltaTime);
634+
if (Settings.bDebugLogTick)
635+
{
636+
UE_LOG(LogTemp, Log, TEXT("Delta: %1.2f"), DeltaTime);
637+
}
634638
BluManager::DoBluMessageLoop();
635639
}
636640

@@ -645,7 +649,7 @@ UTexture2D* UBluEye::GetTexture() const
645649
{
646650
if (!Texture)
647651
{
648-
return UTexture2D::CreateTransient(Settings.Width, Settings.Height, PF_B8G8R8A8);
652+
return UTexture2D::CreateTransient(Settings.ViewSize.X, Settings.ViewSize.Y, PF_B8G8R8A8);
649653
}
650654

651655
return Texture;

Source/Blu/Private/RenderHandler.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "RenderHandler.h"
2+
#include "Interfaces/IPluginManager.h"
23
#include "BluEye.h"
34

45
RenderHandler::RenderHandler(int32 Width, int32 Height, UBluEye* UI)
@@ -115,7 +116,7 @@ FString ReversePathSlashes(FString ForwardPath)
115116
}
116117
FString UtilityBLUIDownloadsFolder()
117118
{
118-
return ReversePathSlashes(FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "Plugins/BLUI/Downloads/"));
119+
return ReversePathSlashes(FPaths::ConvertRelativePathToFull(IPluginManager::Get().FindPlugin("BLUI")->GetBaseDir() + "/Downloads/"));
119120
}
120121

121122

Source/Blu/Public/BluTypes.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,9 @@ struct FBluEyeSettings
6969
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Blu")
7070
bool bIsTransparent;
7171

72-
/** Width of the view resolution */
72+
/** Width(X) and Height(Y) of the view resolution */
7373
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Blu")
74-
int32 Width;
75-
76-
/** Height of the view resolution */
77-
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Blu")
78-
int32 Height;
74+
FVector2D ViewSize;
7975

8076
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Blu")
8177
bool bEnableWebGL;
@@ -86,6 +82,9 @@ struct FBluEyeSettings
8682
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Blu")
8783
bool bAutoPlayEnabled;
8884

85+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Blu")
86+
bool bDebugLogTick;
87+
8988
FBluEyeSettings();
9089
};
9190

Source/BluLoader/BluLoader.Build.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public BluLoader(ReadOnlyTargetRules Target) : base(Target)
1111
{
1212
"Core",
1313
"CoreUObject",
14-
"Engine"
14+
"Engine",
15+
"Projects"
1516
});
1617
}
1718
}

Source/BluLoader/Private/BluLoader.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "IBluLoader.h"
2+
#include "Interfaces/IPluginManager.h"
23
#include "CoreMinimal.h"
34
#include "Misc/Paths.h"
45
#include <string>
@@ -13,7 +14,7 @@ class FBluLoader : public IBluLoader
1314
/** IModuleInterface implementation */
1415
virtual void StartupModule() override
1516
{
16-
FString LibPath = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "Plugins/BLUI/ThirdParty/cef/");
17+
FString LibPath = FPaths::ConvertRelativePathToFull(IPluginManager::Get().FindPlugin("BLUI")->GetBaseDir() + "/ThirdParty/cef/");
1718

1819
// If we're on Windows we need to load DLLs from our custom path
1920
#if PLATFORM_WINDOWS

0 commit comments

Comments
 (0)