From 668fc9f10f65c4805c6577d51c7bab22478f5d7b Mon Sep 17 00:00:00 2001 From: Joseff Date: Wed, 26 Apr 2023 18:28:24 +0200 Subject: [PATCH] Preparation for the submission of the plugin to marketplace, fixed a bug with the cmdlet path not being valid. --- .../hosts/unreal/hooks/pre_workfile_preparation.py | 3 +++ openpype/hosts/unreal/integration/README.md | 10 ++++++++++ .../Ayon/Source/Ayon/Private/AyonAssetContainer.cpp | 1 - .../integration/UE_4.27/Ayon/Source/Ayon/Public/Ayon.h | 2 -- .../UE_4.27/Ayon/Source/Ayon/Public/AyonLib.h | 1 - .../UE_4.27/Ayon/Source/Ayon/Public/AyonPythonBridge.h | 1 - .../Ayon/Source/Ayon/Public/OpenPypePublishInstance.h | 1 - .../unreal/integration/UE_4.27/BuildPlugin_4-27.bat | 1 + .../integration/UE_4.27/BuildPlugin_4-27_Window.bat | 1 + .../Ayon/Source/Ayon/Public/OpenPypePublishInstance.h | 1 - .../unreal/integration/UE_5.0/BuildPlugin_5-0.bat | 1 + .../integration/UE_5.0/BuildPlugin_5-0_Window.bat | 1 + .../Source/Ayon/Private/OpenPypePublishInstance.cpp | 2 +- .../Ayon/Source/Ayon/Public/OpenPypePublishInstance.h | 1 - .../unreal/integration/UE_5.1/BuildPlugin_5-1.bat | 1 + .../integration/UE_5.1/BuildPlugin_5-1_Window.bat | 1 + openpype/hosts/unreal/lib.py | 5 ++--- 17 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 openpype/hosts/unreal/integration/README.md create mode 100644 openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27.bat create mode 100644 openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27_Window.bat create mode 100644 openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0.bat create mode 100644 openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0_Window.bat create mode 100644 openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1.bat create mode 100644 openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1_Window.bat diff --git a/openpype/hosts/unreal/hooks/pre_workfile_preparation.py b/openpype/hosts/unreal/hooks/pre_workfile_preparation.py index f01609d314..085f80209d 100644 --- a/openpype/hosts/unreal/hooks/pre_workfile_preparation.py +++ b/openpype/hosts/unreal/hooks/pre_workfile_preparation.py @@ -107,6 +107,9 @@ class UnrealPrelaunchHook(PreLaunchHook): f"project [ {unreal_project_name} ]" )) + import openpype.hosts.unreal.lib as ue_lib + path = ue_lib.get_path_to_cmdlet_project(engine_version) + q_thread = QtCore.QThread() ue_project_worker = UEProjectGenerationWorker() ue_project_worker.setup( diff --git a/openpype/hosts/unreal/integration/README.md b/openpype/hosts/unreal/integration/README.md new file mode 100644 index 0000000000..961eea83e6 --- /dev/null +++ b/openpype/hosts/unreal/integration/README.md @@ -0,0 +1,10 @@ +# Building the plugin + +In order to successfully build the plugin, make sure that the path to the UnrealBuildTool.exe is specified correctly. +After the UBT path specify for which platform it will be compiled. in the -Project parameter, specify the path to the +CommandletProject.uproject file. Next the build type has to be specified (DebugGame, Development, Package, etc.) and then the -TargetType (Editor, Runtime, etc.) + +`BuildPlugin_[Ver].bat` runs the building process in the background. If you want to show the progress inside the +command prompt, use the `BuildPlugin_[Ver]_Window.bat` file. + + diff --git a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Private/AyonAssetContainer.cpp b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Private/AyonAssetContainer.cpp index 316c4015af..e3989eb03c 100644 --- a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Private/AyonAssetContainer.cpp +++ b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Private/AyonAssetContainer.cpp @@ -3,7 +3,6 @@ #include "AyonAssetContainer.h" #include "AssetRegistryModule.h" #include "Misc/PackageName.h" -#include "Engine.h" #include "Containers/UnrealString.h" UAyonAssetContainer::UAyonAssetContainer(const FObjectInitializer& ObjectInitializer) diff --git a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/Ayon.h b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/Ayon.h index 9535ff4b13..d11af70058 100644 --- a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/Ayon.h +++ b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/Ayon.h @@ -2,8 +2,6 @@ #pragma once -#include "Engine.h" - class FAyonModule : public IModuleInterface { diff --git a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonLib.h b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonLib.h index ed657a735c..da83b448fb 100644 --- a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonLib.h +++ b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonLib.h @@ -1,7 +1,6 @@ // Copyright 2023, Ayon, All rights reserved. #pragma once -#include "Engine.h" #include "AyonLib.generated.h" diff --git a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonPythonBridge.h b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonPythonBridge.h index 831ac022a5..3c429fd7d3 100644 --- a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonPythonBridge.h +++ b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/AyonPythonBridge.h @@ -1,6 +1,5 @@ // Copyright 2023, Ayon, All rights reserved. #pragma once -#include "Engine.h" #include "AyonPythonBridge.generated.h" UCLASS(Blueprintable) diff --git a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h index 2f3b6aa596..4a7a6a3a9f 100644 --- a/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h +++ b/openpype/hosts/unreal/integration/UE_4.27/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h @@ -3,7 +3,6 @@ // and will be removed in next versions of Ayon. #pragma once -#include "Engine.h" #include "OpenPypePublishInstance.generated.h" diff --git a/openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27.bat b/openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27.bat new file mode 100644 index 0000000000..96cdb96f8a --- /dev/null +++ b/openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27.bat @@ -0,0 +1 @@ +D:\UE4\UE_4.27\Engine\Build\BatchFiles\RunUAT.bat BuildPlugin -plugin="D:\OpenPype\openpype\hosts\unreal\integration\UE_4.27\Ayon\Ayon.uplugin" -Package="D:\BuiltPlugins\4.27" \ No newline at end of file diff --git a/openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27_Window.bat b/openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27_Window.bat new file mode 100644 index 0000000000..1343843a82 --- /dev/null +++ b/openpype/hosts/unreal/integration/UE_4.27/BuildPlugin_4-27_Window.bat @@ -0,0 +1 @@ +cmd /k "BuildPlugin_4-27.bat" \ No newline at end of file diff --git a/openpype/hosts/unreal/integration/UE_5.0/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h b/openpype/hosts/unreal/integration/UE_5.0/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h index 544cb6d915..9c0c4a69e5 100644 --- a/openpype/hosts/unreal/integration/UE_5.0/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h +++ b/openpype/hosts/unreal/integration/UE_5.0/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h @@ -3,7 +3,6 @@ // and will be removed in next versions of Ayon. #pragma once -#include "Engine.h" #include "OpenPypePublishInstance.generated.h" diff --git a/openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0.bat b/openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0.bat new file mode 100644 index 0000000000..473c248cbe --- /dev/null +++ b/openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0.bat @@ -0,0 +1 @@ +"C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin -plugin="D:\OpenPype\openpype\hosts\unreal\integration\UE_5.0\Ayon\Ayon.uplugin" -Package="D:\BuiltPlugins\5.0" \ No newline at end of file diff --git a/openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0_Window.bat b/openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0_Window.bat new file mode 100644 index 0000000000..b96de6d6c9 --- /dev/null +++ b/openpype/hosts/unreal/integration/UE_5.0/BuildPlugin_5-0_Window.bat @@ -0,0 +1 @@ +cmd /k "BuildPlugin_5-0.bat" \ No newline at end of file diff --git a/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Private/OpenPypePublishInstance.cpp b/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Private/OpenPypePublishInstance.cpp index 7a65fd0c98..02a8ac800a 100644 --- a/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Private/OpenPypePublishInstance.cpp +++ b/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Private/OpenPypePublishInstance.cpp @@ -58,7 +58,7 @@ void UOpenPypePublishInstance::OnAssetCreated(const FAssetData& InAssetData) if (!IsValid(Asset)) { UE_LOG(LogAssetData, Warning, TEXT("Asset \"%s\" is not valid! Skipping the addition."), - *InAssetData.ObjectPath.ToString()); + *InAssetData.GetSoftObjectPath().ToString()); return; } diff --git a/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h b/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h index 544cb6d915..9c0c4a69e5 100644 --- a/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h +++ b/openpype/hosts/unreal/integration/UE_5.1/Ayon/Source/Ayon/Public/OpenPypePublishInstance.h @@ -3,7 +3,6 @@ // and will be removed in next versions of Ayon. #pragma once -#include "Engine.h" #include "OpenPypePublishInstance.generated.h" diff --git a/openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1.bat b/openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1.bat new file mode 100644 index 0000000000..3cc82d54af --- /dev/null +++ b/openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1.bat @@ -0,0 +1 @@ +"D:\UE_5.1\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin -plugin="D:\OpenPype\openpype\hosts\unreal\integration\UE_5.1\Ayon\Ayon.uplugin" -Package="D:\BuiltPlugins\5.1" \ No newline at end of file diff --git a/openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1_Window.bat b/openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1_Window.bat new file mode 100644 index 0000000000..e10f2c7add --- /dev/null +++ b/openpype/hosts/unreal/integration/UE_5.1/BuildPlugin_5-1_Window.bat @@ -0,0 +1 @@ +cmd /k "BuildPlugin_5-1.bat" \ No newline at end of file diff --git a/openpype/hosts/unreal/lib.py b/openpype/hosts/unreal/lib.py index aa5b09fda8..840f79f3c8 100644 --- a/openpype/hosts/unreal/lib.py +++ b/openpype/hosts/unreal/lib.py @@ -323,12 +323,11 @@ def get_path_to_uat(engine_path: Path) -> Path: def get_path_to_cmdlet_project(ue_version: str) -> Path: - cmd_project = Path(os.path.dirname( - os.path.abspath(os.getenv("OPENPYPE_ROOT")))) + cmd_project = Path(os.getenv("OPENPYPE_ROOT")) # For now, only tested on Windows (For Linux and Mac # it has to be implemented) - cmd_project /= f"hosts/unreal/integration/UE_{ue_version}" + cmd_project /= f"openpype/hosts/unreal/integration/UE_{ue_version}" return cmd_project / "CommandletProject/CommandletProject.uproject"