Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ compile_commands.json
# Generated Ecsact files

Source/**/*.ecsact.*

# Distribution files
/Dist
4 changes: 3 additions & 1 deletion Ecsact.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"CanContainContent": true,
"IsBetaVersion": true,
"IsExperimentalVersion": false,
"Installed": false,
"Installed": true,
"EngineVersion": "5.5.0",
"EnabledByDefault": false,
"Modules":
[
{
Expand Down
39 changes: 0 additions & 39 deletions Source/Ecsact/Ecsact.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@ public Ecsact(ReadOnlyTargetRules Target) : base(Target) {
"SlateCore",
});

DynamicallyLoadedModuleNames.AddRange(new string[] {
"EcsactUnrealCodegenPlugin",
});
//

var EcsactUnrealCodegenPluginPath = Path.Combine(
ModuleDirectory,
"..",
"..",
"Binaries",
Target.Platform.ToString(),
"UnrealEditor-EcsactUnrealCodegenPlugin.dll"
);

if(Target.bBuildEditor) {
PrivateDependencyModuleNames.Add("UnrealEd");
}
Expand Down Expand Up @@ -78,31 +64,6 @@ public Ecsact(ReadOnlyTargetRules Target) : base(Target) {
"ECSACT_STATIC_API_EXPORT",
"ECSACT_SI_WASM_API_EXPORT",
});

var EcsactSources = GetEcsactSources();

if(EcsactSources.Length > 0) {
var CodegenArgs = new List<string>() {
"codegen",
"--format=json",
"--plugin=cpp_header",
// "--plugin=systems_header",
// "--plugin=cpp_systems_header",
// "--plugin=cpp_systems_source"
};

if(!File.Exists(EcsactUnrealCodegenPluginPath)) {
Console.WriteLine(
"warning: EcsactUnrealCodegenPlugin was not built. It should have " +
"been shipped with the Ecsact Unreal integration plugin."
);
} else {
CodegenArgs.Add($"--plugin={EcsactUnrealCodegenPluginPath}");
}

CodegenArgs.AddRange(EcsactSources);
ExecEcsactCli(CodegenArgs);
}
}

private string[] GetEcsactSources() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "ecsact/runtime/common.h"
#include "ecsact/runtime/async.h"
#include "EcsactAsyncRunnerEvents.generated.h"
Expand Down
1 change: 1 addition & 0 deletions Source/Ecsact/Public/EcsactUnreal/EcsactBlueprintLibrary.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "EcsactBlueprintLibrary.generated.h"

UCLASS()
Expand Down
2 changes: 1 addition & 1 deletion Source/Ecsact/Public/EcsactUnreal/EcsactRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ECSACT_API UEcsactRunner : public UObject, public FTickableGameObject {

virtual auto OnWorldChanged(UWorld* OldWorld, UWorld* NewWorld) -> void;

UFUNCTION(BlueprintPure)
UFUNCTION(BlueprintPure, Category = "Ecsact Runner")
bool HasAsyncEvents() const;

auto Tick(float DeltaTime) -> void override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public EcsactUnrealCodegenPlugin(ReadOnlyTargetRules Target) : base(Target) {
// Codegen plugins utilise the ecsact 'meta' module
PrivateDefinitions.AddRange(new string[] {
"ECSACT_META_API_LOAD_AT_RUNTIME",
"ECSACT_META_API_EXPORT",
});
}

Expand Down
12 changes: 12 additions & 0 deletions Tools/DevInstall.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use Package.nu package-plugin

def main [--ue-install-dir: string] {
let info = package-plugin --ue-install-dir $ue_install_dir;
let engine_plugins_dir = [$info.ue_install, "Engine", "Plugins", "Marketplace"] | path join;
let plugin_extract_dir = [$engine_plugins_dir, $info.plugin_name] | path join;

print $"Extracting ($info.plugin_name) to ($plugin_extract_dir)";
mkdir $plugin_extract_dir;
tar -xf $info.plugin_archive -C $plugin_extract_dir;
print $"(ansi green)Unreal ($info.plugin_name) successfully installed to ($engine_plugins_dir)(ansi reset)";
}
73 changes: 73 additions & 0 deletions Tools/Package.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
def get-ue-install-dirs [] {
if (sys host | get name) != "Windows" {
print "Automatic unreal detection only supported on Windows"
print "Please specify the --ue-install-dir option"
exit 1
}

let eng_reg_version_keys = ^reg.exe query 'HKLM\SOFTWARE\EpicGames\Unreal Engine' | str trim | lines;
$eng_reg_version_keys | each {|key|
^reg.exe query $key /v 'InstalledDirectory' | str trim | lines | get 1 | str trim | split column ' ' key type value | get value
} | flatten
}

def get-ue-os [] {
match (sys host | get name) {
"Windows" => "Win64",
"Ubuntu" => "Linux",
_ => {
print $"unhandled host (sys host)"
exit 1
}
}
}

def ue-tool-extension [] {
match (sys host | get name) {
"Windows" => "bat",
_ => "sh",
}
}

export def package-plugin [--ue-install-dir: string] {
let install_dirs = if $ue_install_dir != null { [$ue_install_dir] } else { get-ue-install-dirs };
let plugin_dir = $env.FILE_PWD | path join '..' | path expand;
let dist_dir = [$plugin_dir, 'Dist'] | path join;
mkdir $dist_dir;
cd $plugin_dir;
let plugin_descriptor_filename = (ls *.uplugin).0.name;
let plugin_name = $plugin_descriptor_filename | split row ".uplugin" | get 0;
let dist_archive = [$plugin_dir, 'Dist', $"($plugin_name)Unreal-(get-ue-os).zip"] | path join;
let plugin_descriptor = [$plugin_dir, $plugin_descriptor_filename] | path join;
let temp_package_dir = mktemp -d --suffix $"($plugin_name)UnrealPluginPackage";

if ($install_dirs | length) == 0 {
print "Could not find Unreal Engine installation on your system";
exit 1;
}

let install_dir = if ($install_dirs | length) > 1 {
$install_dirs | input list
} else {
$install_dirs | get 0
};

print $"using ($install_dir)";

let engine_dir = [$install_dir, 'Engine'] | path join;
let uat = [$engine_dir, 'Build', 'BatchFiles', $"RunUAT.(ue-tool-extension)"] | path join;
^$uat BuildPlugin $"-Plugin=($plugin_descriptor)" $"-Package=($temp_package_dir)";

tar -a -cf $dist_archive -C $temp_package_dir '*';
rm -rf $temp_package_dir;

return {
ue_install: $install_dir,
plugin_name: $plugin_name,
plugin_archive: $dist_archive,
};
}

def main [--ue-install-dir: string] {
package-plugin --ue-install-dir $ue_install_dir
}