Skip to content

Commit

Permalink
Merge branch 'master' into feature-UE5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
getnamo committed Dec 14, 2021
2 parents 509aa1d + b7ae842 commit 9aeda95
Show file tree
Hide file tree
Showing 29 changed files with 884 additions and 718 deletions.
52 changes: 26 additions & 26 deletions BLUI.uplugin
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"FileVersion": 3,
"FriendlyName": "BLUI",
"Version": 3,
"VersionName": "3.2.4",
"Description": "Chromium Embedded Framework (CEF) powered HTML UI and HUD for Unreal Engine 4",
"Category": "UI",
"CreatedBy": "Aaron M. Shea",
"CreatedByURL": "http://aaronshea.me",
"DocsURL": "https://github.com/getnamo/BLUI",
"EnabledByDefault" : true,
"CanContainContent": "true",
"Modules":
[
{
"Name" : "BluLoader",
"Type" : "Runtime",
"LoadingPhase" : "PreDefault",
"BlacklistPlatforms" : [ "HTML5", "Android", "iOS"]
},
{
"Name": "Blu",
"Type": "Runtime",
"LoadingPhase": "PreDefault",
"BlacklistPlatforms": [ "HTML5", "Android", "iOS" ]
}
]
"FileVersion": 3,
"FriendlyName": "BLUI",
"Version": 3,
"VersionName": "4.2.0",
"Description": "Chromium Embedded Framework (CEF) powered HTML UI and HUD for Unreal Engine 4",
"Category": "UI",
"CreatedBy": "Aaron M. Shea, Getnamo, & Contributors",
"CreatedByURL": "github.com/aaronShea",
"DocsURL": "https://github.com/getnamo/BLUI",
"EnabledByDefault" : true,
"CanContainContent": "true",
"Modules":
[
{
"Name" : "BluLoader",
"Type" : "Runtime",
"LoadingPhase" : "PreDefault",
"BlacklistPlatforms" : ["Android", "iOS"]
},
{
"Name": "Blu",
"Type": "Runtime",
"LoadingPhase": "PreDefault",
"BlacklistPlatforms": ["Android", "iOS" ]
}
]
}
Binary file removed Content/BluTickActor.uasset
Binary file not shown.
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.
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2014 Aaron M. Shea (AaronShea)
Copyright (c) 2016-present, Jan Kaniewski (Getnamo) & Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
37 changes: 17 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[![release](https://img.shields.io/github/release/getnamo/BLUI.svg?style=flat-square)](https://github.com/getnamo/BLUI/releases)
![BLUI-logo](https://cloud.githubusercontent.com/assets/1334174/5969395/201a1202-a7f1-11e4-98a4-12bc6793f830.png)
[![Github All Releases](https://img.shields.io/github/downloads/getnamo/BLUI/total.svg)](https://github.com/getnamo/BLUI/releases)

## Getnamo Fork Notes

Fork made to support small additions and changes for certain use cases.
A fork of BLUI that is kept relatively up to date.

To install check out the latest releases https://github.com/getnamo/BLUI/releases and drag and drop *Plugins* folder into your project root folder

### Download and Fullscreen Support
Latest release is updated to [CEF 80.0.3987.132](https://github.com/chromiumembedded/cef/tree/3987).

Contains changes to allow downloading of files via the inbuilt browser.
To install check out the latest releases https://github.com/getnamo/BLUI/releases and drag and drop *Plugins* folder into your project root folder

Updated CEF build to 3.2556 to support fullscreen videos.
Unreal thread: https://forums.unrealengine.com/community/released-projects/29036-blui-open-source-html5-js-css-hud-ui

### Convenience Blueprints

Expand Down Expand Up @@ -63,16 +62,21 @@ By default the actor has a BLUI resolution of 1000x1000, you can change this by

### BluTickActor

Since 4.0.0 - This actor is no longer needed. Ticking happens internally.

Older verions:
Instead of ticking in your level bp, I prefer to use a simple actor to do the ticking. Other convenience blueprints may spawn this as necessary so if you use those, you don't ever need to use this directly.

## //End Fork Notes
## Demo Project

Thanks to @oivio we have the Demo project updated to the latest release. See https://github.com/getnamo/BLUI/releases/tag/3.4.0 for the 4.22 Demo project release ([BLUI-v3.4.0-UE4.22-DemoExamples.7z](https://github.com/getnamo/BLUI/releases/download/3.4.0/BLUI-v3.4.0-UE4.22-DemoExamples.7z))

## HTML powered UI and HUD for Unreal Engine 4
(Hit up the wiki for a quick start guide!)
### Video of Demo project

Do you use BLUI in your project? I'd really love it if you credit me and it! You can even use the [logo right here!](https://res.cloudinary.com/aaronshea/image/upload/v1423576170/BLUI-Transparent_eu582n.png)
[![Demo Project](https://img.youtube.com/vi/PRxO0yCO3Kk/0.jpg)](https://youtu.be/PRxO0yCO3Kk)

Click on image to take you to video.

License: MIT

What is it?
---------------------------------------
Expand All @@ -97,21 +101,14 @@ Re-generate your project's Visual Studio file and load up the editor. Then check

Updating the CEF event loop
---------------------------------------
~~You must call the `BluManager::doBluMessageLoop();` method every tick in order for the CEF process to update properly. To do this, override the default GameMode's Tick function and include the `Blu/Public/BluManager.h` header file. You can then call the appropriate method.~~

As of now, you no longer need to do this. You can simply call a blueprint node to Tick the CEF loop every tick of the level blueprint.
Some actor or level blueprint needs to call [RunBluEventLoop](https://github.com/getnamo/BLUI/blob/master/Source/Blu/Public/BluBlueprintFunctionLibrary.h#L18).


Loading Local Files
---------------------------------------
Set your default URL or use the "Load URL" node/method to load a URL that starts with `blui://` this will point to the directory root of the project or the game (if packaged). So if you wanted to load an HTML file from `YourProject/UI/file.html`, set the URL to `blui://UI/file.html`
Set your default URL or use the "Load URL" node/method to load a URL that starts with `blui://` (or `local://`) this will point to the directory root of the project or the game (if packaged). So if you wanted to load an HTML file from `YourProject/UI/file.html`, set the URL to `blui://UI/file.html`


HUD Example Blueprint
---------------------------------------
Within the release, you'll find an ExampleHUD blueprint file, place this into your project's blueprints directory to try it out! (It's a simple UMG widget pre-configures to accept keyboard and mouse input, with a BluEye instance hooked up to a canvas)


Shipping Your Game (Linux)
---------------------------------------
Copy all contents of the Linux shipping files into your packaged game's `GameName/Binaries/{Linux}`, these are the required files for the Chromium process.
55 changes: 26 additions & 29 deletions Source/Blu/Blu.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,33 @@ private string ThirdPartyPath
get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../../ThirdParty/")); }
}

private void stageFiles(String[] filesToStage)
private void stageFiles(String[] FilesToStage)
{
foreach (var f in filesToStage)
foreach (var File in FilesToStage)
{
RuntimeDependencies.Add(new RuntimeDependency(f));
RuntimeDependencies.Add(File);
}
}

public Blu(ReadOnlyTargetRules Target) : base(Target)
{

PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"InputCore",
"RenderCore",
"RHI",
"Slate",
"SlateCore",
"UMG",
"Json"
});
PublicDependencyModuleNames.AddRange(
new string[] {
"Core",
"CoreUObject",
"Engine",
"InputCore",
"RenderCore",
"RHI",
"Slate",
"SlateCore",
"UMG",
"Json"
});

PrivateIncludePaths.AddRange(
new string[] {
"Blu/Private",
Path.Combine(ModuleDirectory, "Private"),
});

if(Target.Platform == UnrealTargetPlatform.Win64)
Expand All @@ -61,8 +59,8 @@ public Blu(ReadOnlyTargetRules Target) : base(Target)
});

// Add our runtime dependencies
var filesToStage = Directory.GetFiles(Path.Combine(ThirdPartyPath, "cef/Win/shipping"), "*", SearchOption.AllDirectories);
stageFiles(filesToStage);
var FilesToStage = Directory.GetFiles(Path.Combine(ThirdPartyPath, "cef/Win/shipping"), "*", SearchOption.AllDirectories);
stageFiles(FilesToStage);

} else if(Target.Platform == UnrealTargetPlatform.Linux)
{
Expand All @@ -78,27 +76,26 @@ public Blu(ReadOnlyTargetRules Target) : base(Target)
} else if(Target.Platform == UnrealTargetPlatform.Mac)
{

var frameworkPath = Path.Combine(ThirdPartyPath, "cef/Mac/lib", "Chromium Embedded Framework.framework");
var FrameworkPath = Path.Combine(ThirdPartyPath, "cef/Mac/lib", "Chromium Embedded Framework.framework");

PublicFrameworks.Add(frameworkPath);
PublicFrameworks.Add(FrameworkPath);
PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "cef/Mac/lib", "libcef_dll_wrapper.a"));

PublicIncludePaths.AddRange(
new string[] {
Path.Combine(ThirdPartyPath, "cef", "Mac")
});

var filesToStage = Directory.GetFiles(Path.Combine(ThirdPartyPath, "cef/Mac/shipping"), "*", SearchOption.AllDirectories);
stageFiles(filesToStage);
var FilesToStage = Directory.GetFiles(Path.Combine(ThirdPartyPath, "cef/Mac/shipping"), "*", SearchOption.AllDirectories);
stageFiles(FilesToStage);

filesToStage = Directory.GetFiles(Path.Combine(ThirdPartyPath, "cef/Mac/lib"), "*", SearchOption.AllDirectories);
stageFiles(filesToStage);
FilesToStage = Directory.GetFiles(Path.Combine(ThirdPartyPath, "cef/Mac/lib"), "*", SearchOption.AllDirectories);
stageFiles(FilesToStage);

if(!Target.bBuildEditor)
{
AdditionalBundleResources.Add(new UEBuildBundleResource(Path.Combine(frameworkPath, "Chromium Embedded Framework"), "MacOS", false));
AdditionalBundleResources.Add(new BundleResource(Path.Combine(FrameworkPath, "Chromium Embedded Framework"), "MacOS", false));
}

}
else
{
Expand Down
18 changes: 10 additions & 8 deletions Source/Blu/Private/Blu.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "BluPrivatePCH.h"
#include "IBlu.h"
#include "BluManager.h"

class FBlu : public IBlu
{
Expand All @@ -10,9 +11,10 @@ class FBlu : public IBlu
FString ExecutablePath = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + "Plugins/BLUI/ThirdParty/cef/");

// Setup the default settings for BluManager
BluManager::settings.windowless_rendering_enabled = true;
BluManager::settings.no_sandbox = true;
BluManager::settings.remote_debugging_port = 7777;
BluManager::Settings.windowless_rendering_enabled = true;
BluManager::Settings.no_sandbox = true;
BluManager::Settings.remote_debugging_port = 7777;
BluManager::Settings.uncaught_exception_stack_size = 5;

#if PLATFORM_LINUX
ExecutablePath = "./blu_ue4_process";
Expand All @@ -27,24 +29,24 @@ class FBlu : public IBlu
CefString realExePath = *ExecutablePath;

// Set the sub-process path
CefString(&BluManager::settings.browser_subprocess_path).FromString(realExePath);
CefString(&BluManager::Settings.browser_subprocess_path).FromString(realExePath);

// Set the cache path
CefString(&BluManager::settings.cache_path).FromString(GameDirCef);
CefString(&BluManager::Settings.cache_path).FromString(GameDirCef);

// Make a new manager instance
CefRefPtr<BluManager> BluApp = new BluManager();

//CefExecuteProcess(BluManager::main_args, BluApp, NULL);
CefInitialize(BluManager::main_args, BluManager::settings, BluApp, NULL);
CefInitialize(BluManager::MainArgs, BluManager::Settings, BluApp, NULL);

UE_LOG(LogBlu, Log, TEXT(" STATUS: Loaded"));
}

virtual void ShutdownModule() override
{
UE_LOG(LogBlu, Log, TEXT(" STATUS: Shutdown"));
CefShutdown();
//CefShutdown();
}

};
Expand Down
42 changes: 26 additions & 16 deletions Source/Blu/Private/BluBluprintFunctionLibrary.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "BluPrivatePCH.h"
#include "BluManager.h"
#include "Json.h"
#include "BluBlueprintFunctionLibrary.h"
#include "BluJsonObj.h"


UBluBlueprintFunctionLibrary::UBluBlueprintFunctionLibrary(const class FObjectInitializer& PCIP)
: Super(PCIP)
Expand All @@ -12,51 +12,61 @@ UBluEye* UBluBlueprintFunctionLibrary::NewBluEye(UObject* WorldContextObject)
{

UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
UBluEye* tempObject = Cast<UBluEye>(StaticConstructObject_Internal(UBluEye::StaticClass()));
UBluEye* Eye = NewObject<UBluEye>(WorldContextObject);

return tempObject;
return Eye;

}

UBluJsonObj* UBluBlueprintFunctionLibrary::NewBluJSONObj(UObject* WorldContextObject)
{

UBluJsonObj* tempObj = NewObject<UBluJsonObj>(GetTransientPackage(), UBluJsonObj::StaticClass());
tempObj->init("{}");
UBluJsonObj* JsonObj = NewObject<UBluJsonObj>(GetTransientPackage(), UBluJsonObj::StaticClass());
JsonObj->Init("{}");

return tempObj;
return JsonObj;

}

void UBluBlueprintFunctionLibrary::RunBluEventLoop()
{
BluManager::doBluMessageLoop();
BluManager::DoBluMessageLoop();
}

UBluJsonObj* UBluBlueprintFunctionLibrary::ParseJSON(const FString& JSONString)
{

UBluJsonObj* tempObj = NewObject<UBluJsonObj>(GetTransientPackage(), UBluJsonObj::StaticClass());
tempObj->init(JSONString);
UBluJsonObj* JsonObj = NewObject<UBluJsonObj>(GetTransientPackage(), UBluJsonObj::StaticClass());
JsonObj->Init(JSONString);

return tempObj;
return JsonObj;

}

FString UBluBlueprintFunctionLibrary::JSONToString(UBluJsonObj *ObjectToParse)
{

// Create the JSON reader
FString returnString;
TSharedRef<TJsonWriter<TCHAR>> writer = TJsonWriterFactory<TCHAR>::Create(&returnString);
FString ReturnString;
TSharedRef<TJsonWriter<TCHAR>> writer = TJsonWriterFactory<TCHAR>::Create(&ReturnString);

// Convert the JSON object to an FString
FJsonSerializer::Serialize(ObjectToParse->getJsonObj().ToSharedRef(), writer);
FJsonSerializer::Serialize(ObjectToParse->GetJsonObj().ToSharedRef(), writer);

return returnString;
return ReturnString;

}

FCharacterEvent UBluBlueprintFunctionLibrary::ToKeyEvent(FKey Key)
{
FModifierKeysState KeyState;

FCharacterEvent CharEvent = FCharacterEvent(Key.GetFName().ToString().ToUpper().GetCharArray()[0], KeyState, 0, 0);

return CharEvent;
}



FString UBluBlueprintFunctionLibrary::GameRootDirectory()
{
Expand Down
Loading

0 comments on commit 9aeda95

Please sign in to comment.