Making Omniverse code optional
This commit is contained in:
parent
98c0145120
commit
5487e17f60
|
@ -7,6 +7,7 @@ using UnrealBuildTool;
|
|||
public class CarlaTools : ModuleRules
|
||||
{
|
||||
bool UsingHoudini = true;
|
||||
bool bUsingOmniverseConnector = false;
|
||||
private bool IsWindows(ReadOnlyTargetRules Target)
|
||||
{
|
||||
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32);
|
||||
|
@ -23,6 +24,21 @@ public class CarlaTools : ModuleRules
|
|||
bEnableExceptions = true;
|
||||
}
|
||||
|
||||
string CarlaPluginPath = Path.GetFullPath( ModuleDirectory );
|
||||
string ConfigDir = Path.GetFullPath(Path.Combine(CarlaPluginPath, "../../../../Config/"));
|
||||
string OptionalModulesFile = Path.Combine(ConfigDir, "OptionalModules.ini");
|
||||
string[] text = System.IO.File.ReadAllLines(OptionalModulesFile);
|
||||
foreach (string line in text)
|
||||
{
|
||||
if (line.Contains("Omniverse ON"))
|
||||
{
|
||||
Console.WriteLine("Enabling OmniverseConnector");
|
||||
bUsingOmniverseConnector = true;
|
||||
PublicDefinitions.Add("WITH_OMNIVERSE");
|
||||
PrivateDefinitions.Add("WITH_OMNIVERSE");
|
||||
}
|
||||
}
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add public include paths required here ...
|
||||
|
@ -58,8 +74,6 @@ public class CarlaTools : ModuleRules
|
|||
"Slate",
|
||||
"SlateCore",
|
||||
"UnrealEd",
|
||||
"OmniverseUSD",
|
||||
"OmniverseRuntime",
|
||||
"Blutility",
|
||||
"UMG",
|
||||
"EditorScriptingUtilities",
|
||||
|
@ -88,8 +102,16 @@ public class CarlaTools : ModuleRules
|
|||
"HoudiniEngineRuntime"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if(bUsingOmniverseConnector)
|
||||
{
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"OmniverseUSD",
|
||||
"OmniverseRuntime"
|
||||
});
|
||||
}
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB). This work is licensed under the terms of the MIT license. For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#include "USDImporterWidget.h"
|
||||
#include "USDCARLAInterface.h"
|
||||
#ifdef WITH_OMNIVERSE
|
||||
#include "USDCARLAInterface.h"
|
||||
#endif
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "IMeshMergeUtilities.h"
|
||||
|
@ -12,7 +14,12 @@
|
|||
void UUSDImporterWidget::ImportUSDProp(
|
||||
const FString& USDPath, const FString& DestinationAssetPath, bool bAsBlueprint)
|
||||
{
|
||||
#ifdef WITH_OMNIVERSE
|
||||
FUSDCARLAInterface::ImportUSD(USDPath, DestinationAssetPath, false, bAsBlueprint);
|
||||
#else
|
||||
UE_LOG(LogCarlaTools, Error, TEXT("Omniverse Plugin is not enabled"));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void UUSDImporterWidget::ImportUSDVehicle(
|
||||
|
|
|
@ -125,6 +125,15 @@ if not exist "%HOUDINI_PLUGIN_PATH%" (
|
|||
|
||||
rem Build Carla Editor
|
||||
rem
|
||||
set OMNIVERSE_PATCH_FOLDER=%ROOT_PATH%Util\Patches\omniverse_4.26\
|
||||
set OMNIVERSE_PLUGIN_FOLDER=%UE4_ROOT%Engine\Plugins\Marketplace\NVIDIA\Omniverse\
|
||||
if exist %OMNIVERSE_PLUGIN_FOLDER% (
|
||||
set OMNIVERSE_PLUGIN_INSTALLED="Omniverse ON"
|
||||
xcopy /Y /S /I "%OMNIVERSE_PATCH_FOLDER%USDCARLAInterface.h" "%OMNIVERSE_PLUGIN_FOLDER%Source\OmniverseUSD\Public\" > NUL
|
||||
xcopy /Y /S /I "%OMNIVERSE_PATCH_FOLDER%USDCARLAInterface.cpp" "%OMNIVERSE_PLUGIN_FOLDER%Source\OmniverseUSD\Private\" > NUL
|
||||
) else (
|
||||
set OMNIVERSE_PLUGIN_INSTALLED="Omniverse OFF"
|
||||
)
|
||||
|
||||
if %USE_CARSIM% == true (
|
||||
py -3 %ROOT_PATH%Util/BuildTools/enable_carsim_to_uproject.py -f="%ROOT_PATH%Unreal/CarlaUE4/CarlaUE4.uproject" -e
|
||||
|
@ -138,14 +147,10 @@ if %USE_CHRONO% == true (
|
|||
) else (
|
||||
set CHRONO_STATE="Chrono OFF"
|
||||
)
|
||||
set OPTIONAL_MODULES_TEXT=%CARSIM_STATE% %CHRONO_STATE%
|
||||
|
||||
set OPTIONAL_MODULES_TEXT=%CARSIM_STATE% %CHRONO_STATE% %OMNIVERSE_PLUGIN_INSTALLED%
|
||||
echo %OPTIONAL_MODULES_TEXT% > "%ROOT_PATH%Unreal/CarlaUE4/Config/OptionalModules.ini"
|
||||
|
||||
set OMNIVERSE_PATCH_FOLDER=%ROOT_PATH%Util\Patches\omniverse_4.26\
|
||||
set OMNIVERSE_PLUGIN_FOLDER=%UE4_ROOT%Engine\Plugins\Marketplace\NVIDIA\Omniverse\
|
||||
|
||||
xcopy /Y /S /I "%OMNIVERSE_PATCH_FOLDER%USDCARLAInterface.h" "%OMNIVERSE_PLUGIN_FOLDER%Source\OmniverseUSD\Public\" > NUL
|
||||
xcopy /Y /S /I "%OMNIVERSE_PATCH_FOLDER%USDCARLAInterface.cpp" "%OMNIVERSE_PLUGIN_FOLDER%Source\OmniverseUSD\Private\" > NUL
|
||||
|
||||
if %BUILD_UE4_EDITOR% == true (
|
||||
echo %FILE_N% Building Unreal Editor...
|
||||
|
|
Loading…
Reference in New Issue