diff --git a/.gitignore b/.gitignore index 589de76..f6ee9c8 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,6 @@ compile_commands.json # Generated Ecsact files Source/**/*.ecsact.* + +# Distribution files +/Dist diff --git a/Ecsact.uplugin b/Ecsact.uplugin index 75d5228..2b25668 100644 --- a/Ecsact.uplugin +++ b/Ecsact.uplugin @@ -13,7 +13,9 @@ "CanContainContent": true, "IsBetaVersion": true, "IsExperimentalVersion": false, - "Installed": false, + "Installed": true, + "EngineVersion": "5.5.0", + "EnabledByDefault": false, "Modules": [ { diff --git a/Source/Ecsact/Ecsact.Build.cs b/Source/Ecsact/Ecsact.Build.cs index a061578..013a1a2 100644 --- a/Source/Ecsact/Ecsact.Build.cs +++ b/Source/Ecsact/Ecsact.Build.cs @@ -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"); } @@ -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() { - "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() { diff --git a/Source/Ecsact/Public/EcsactUnreal/EcsactAsyncRunnerEvents.h b/Source/Ecsact/Public/EcsactUnreal/EcsactAsyncRunnerEvents.h index f520c87..42d158a 100644 --- a/Source/Ecsact/Public/EcsactUnreal/EcsactAsyncRunnerEvents.h +++ b/Source/Ecsact/Public/EcsactUnreal/EcsactAsyncRunnerEvents.h @@ -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" diff --git a/Source/Ecsact/Public/EcsactUnreal/EcsactBlueprintLibrary.h b/Source/Ecsact/Public/EcsactUnreal/EcsactBlueprintLibrary.h index cdf04cd..f0aa7b5 100644 --- a/Source/Ecsact/Public/EcsactUnreal/EcsactBlueprintLibrary.h +++ b/Source/Ecsact/Public/EcsactUnreal/EcsactBlueprintLibrary.h @@ -1,5 +1,6 @@ #pragma once +#include "Kismet/BlueprintFunctionLibrary.h" #include "EcsactBlueprintLibrary.generated.h" UCLASS() diff --git a/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.h b/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.h index e4cbe4e..a7e5df8 100644 --- a/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.h +++ b/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.h @@ -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; diff --git a/Source/EcsactUnrealCodegenPlugin/EcsactUnrealCodegenPlugin.Build.cs b/Source/EcsactUnrealCodegenPlugin/EcsactUnrealCodegenPlugin.Build.cs index c7e6142..6d95a52 100644 --- a/Source/EcsactUnrealCodegenPlugin/EcsactUnrealCodegenPlugin.Build.cs +++ b/Source/EcsactUnrealCodegenPlugin/EcsactUnrealCodegenPlugin.Build.cs @@ -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", }); } diff --git a/Tools/DevInstall.nu b/Tools/DevInstall.nu new file mode 100644 index 0000000..b1460b2 --- /dev/null +++ b/Tools/DevInstall.nu @@ -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)"; +} diff --git a/Tools/Package.nu b/Tools/Package.nu new file mode 100644 index 0000000..a07ca6a --- /dev/null +++ b/Tools/Package.nu @@ -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 +}