Force complex collisions as simple when importing a new map
This commit is contained in:
parent
5f1b5e18e0
commit
9699673a46
|
@ -8,6 +8,11 @@
|
||||||
#include "Carla/Actor/CarlaBlueprintRegistry.h"
|
#include "Carla/Actor/CarlaBlueprintRegistry.h"
|
||||||
#include "Carla/Game/CarlaStatics.h"
|
#include "Carla/Game/CarlaStatics.h"
|
||||||
|
|
||||||
|
#include "Dom/JsonObject.h"
|
||||||
|
#include "Misc/FileHelper.h"
|
||||||
|
#include "Serialization/JsonReader.h"
|
||||||
|
#include "Serialization/JsonSerializer.h"
|
||||||
|
|
||||||
namespace CommonAttributes {
|
namespace CommonAttributes {
|
||||||
static const FString PATH = FPaths::ProjectContentDir();
|
static const FString PATH = FPaths::ProjectContentDir();
|
||||||
static const FString DEFAULT = TEXT("/Carla/Config/Default");
|
static const FString DEFAULT = TEXT("/Carla/Config/Default");
|
||||||
|
|
|
@ -42,6 +42,11 @@ public class Carla : ModuleRules
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (Target.Type == TargetType.Editor)
|
||||||
|
{
|
||||||
|
PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd" });
|
||||||
|
}
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(
|
PrivateDependencyModuleNames.AddRange(
|
||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
|
|
||||||
#include "PrepareAssetsForCookingCommandlet.h"
|
#include "PrepareAssetsForCookingCommandlet.h"
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
#include "FileHelpers.h"
|
||||||
|
#endif
|
||||||
#include "HAL/PlatformFilemanager.h"
|
#include "HAL/PlatformFilemanager.h"
|
||||||
|
#include "UObject/ConstructorHelpers.h"
|
||||||
|
|
||||||
UPrepareAssetsForCookingCommandlet::UPrepareAssetsForCookingCommandlet()
|
UPrepareAssetsForCookingCommandlet::UPrepareAssetsForCookingCommandlet()
|
||||||
{
|
{
|
||||||
|
@ -114,18 +118,12 @@ TArray<AStaticMeshActor *> UPrepareAssetsForCookingCommandlet::SpawnMeshesToWorl
|
||||||
}
|
}
|
||||||
MeshActor->SetActorLabel(AssetName, true);
|
MeshActor->SetActorLabel(AssetName, true);
|
||||||
|
|
||||||
// set complex collision as simple in actor
|
|
||||||
UBodySetup* BodySetup = MeshComponent->GetBodySetup();
|
|
||||||
if (BodySetup)
|
|
||||||
{
|
|
||||||
BodySetup->CollisionTraceFlag = CTF_UseComplexAsSimple;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set complex collision as simple in asset
|
// set complex collision as simple in asset
|
||||||
BodySetup = MeshAsset->BodySetup;
|
UBodySetup *BodySetup = MeshAsset->BodySetup;
|
||||||
if (BodySetup)
|
if (BodySetup)
|
||||||
{
|
{
|
||||||
BodySetup->CollisionTraceFlag = CTF_UseComplexAsSimple;
|
BodySetup->CollisionTraceFlag = CTF_UseComplexAsSimple;
|
||||||
|
MeshAsset->MarkPackageDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate all meshes 180 degrees to fit with OpenDRIVE info
|
// rotate all meshes 180 degrees to fit with OpenDRIVE info
|
||||||
|
@ -223,6 +221,11 @@ bool UPrepareAssetsForCookingCommandlet::SaveWorld(
|
||||||
{
|
{
|
||||||
SavePackage(PackagePath, Package);
|
SavePackage(PackagePath, Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
UEditorLoadingAndSavingUtils::SaveMap(World, PackagePath);
|
||||||
|
#endif
|
||||||
|
|
||||||
return bPackageSaved;
|
return bPackageSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,6 +455,10 @@ int32 UPrepareAssetsForCookingCommandlet::Main(const FString &Params)
|
||||||
GeneratePackagePathFile(PackageParams.Name);
|
GeneratePackagePathFile(PackageParams.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
UEditorLoadingAndSavingUtils::SaveDirtyPackages(true, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct CARLA_API FAssetsPaths
|
||||||
};
|
};
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UPrepareAssetsForCookingCommandlet
|
class CARLA_API UPrepareAssetsForCookingCommandlet
|
||||||
: public UCommandlet
|
: public UCommandlet
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "Carla/Sensor/ShaderBasedSensor.h"
|
#include "Carla/Sensor/ShaderBasedSensor.h"
|
||||||
|
|
||||||
#include "ConstructorHelpers.h"
|
#include "ConstructorHelpers.h"
|
||||||
|
#include "Materials/MaterialInstanceDynamic.h"
|
||||||
|
|
||||||
bool AShaderBasedSensor::AddPostProcessingMaterial(const FString &Path)
|
bool AShaderBasedSensor::AddPostProcessingMaterial(const FString &Path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,11 @@ public class CarlaUE4 : ModuleRules
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
||||||
|
|
||||||
|
if (Target.Type == TargetType.Editor)
|
||||||
|
{
|
||||||
|
PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd" });
|
||||||
|
}
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
|
|
||||||
// Uncomment if you are using Slate UI
|
// Uncomment if you are using Slate UI
|
||||||
|
|
Loading…
Reference in New Issue