Added patch for omniverse importer

This commit is contained in:
Axel 2023-03-09 14:17:41 +01:00 committed by bernat
parent 5b600ed16b
commit 98c0145120
5 changed files with 32 additions and 9 deletions

View File

@ -1,7 +1,7 @@
// 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 "USDAlternateImporter.h"
#include "USDCARLAInterface.h"
#include "Kismet/GameplayStatics.h"
#include "Modules/ModuleManager.h"
#include "IMeshMergeUtilities.h"
@ -12,7 +12,7 @@
void UUSDImporterWidget::ImportUSDProp(
const FString& USDPath, const FString& DestinationAssetPath, bool bAsBlueprint)
{
FUSDAlternateImporter::ImportUSD(USDPath, DestinationAssetPath, false, bAsBlueprint);
FUSDCARLAInterface::ImportUSD(USDPath, DestinationAssetPath, false, bAsBlueprint);
}
void UUSDImporterWidget::ImportUSDVehicle(
@ -61,8 +61,3 @@ bool UUSDImporterWidget::MergeStaticMeshComponents(
MeshUtilities.MergeComponentsToStaticMesh(ComponentsToMerge, World, MeshMergeSettings, nullptr, nullptr, DestMesh, AssetsToSync, NewLocation, ScreenAreaSize, true);
return true;
}
FString UUSDImporterWidget::GetFileName(FString& FullPath)
{
return FPaths::GetBaseFilename(FullPath, true);
}

View File

@ -22,6 +22,4 @@ class CARLATOOLS_API UUSDImporterWidget : public UUserWidget
static AActor* GetGeneratedBlueprint(UWorld* World, const FString& USDPath);
UFUNCTION(BlueprintCallable, Category="USD Importer")
static bool MergeStaticMeshComponents(TArray<AActor*> Actors, const FString& DestMesh);
UFUNCTION(BlueprintPure, Category="USD Importer")
static FString GetFileName(const FString& FullPath);
};

View File

@ -141,6 +141,12 @@ if %USE_CHRONO% == true (
set OPTIONAL_MODULES_TEXT=%CARSIM_STATE% %CHRONO_STATE%
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...

View File

@ -0,0 +1,14 @@
#include "USDCARLAInterface.h"
#include "OmniverseUSDImporter.h"
bool FUSDCARLAInterface::ImportUSD(
const FString& Path, const FString& Dest,
bool bImportUnusedReferences, bool bImportAsBlueprint)
{
FOmniverseImportSettings Settings;
Settings.bImportUnusedReferences = bImportUnusedReferences;
Settings.bImportAsBlueprint = bImportAsBlueprint;
return FOmniverseUSDImporter::LoadUSD(Path, Dest, Settings);
}

View File

@ -0,0 +1,10 @@
#pragma once
#include "CoreMinimal.h"
class OMNIVERSEUSD_API FUSDCARLAInterface
{
public:
static bool ImportUSD(const FString& Path, const FString& Dest, bool bImportUnusedReferences, bool bImportAsBlueprint);
};