From 10984be2ccd874e2fd2eade5d6b333a65ef0acac Mon Sep 17 00:00:00 2001 From: Wouter Jansen Date: Fri, 14 Jun 2024 13:53:02 +0200 Subject: [PATCH] merge of https://github.com/CodexLabsLLC/Colosseum/pull/84 --- Unreal/Environments/Blocks/Blocks.uproject | 2 +- .../Blocks/Source/Blocks.Target.cs | 2 +- .../Blocks/Source/BlocksEditor.Target.cs | 2 +- Unreal/Environments/Blocks/package.bat | 2 +- .../Plugins/AirSim/Source/AirBlueprintLib.cpp | 20 +++--- .../Plugins/AirSim/Source/AirBlueprintLib.h | 2 +- Unreal/Plugins/AirSim/Source/AirSim.Build.cs | 24 ++++--- ...aDirector.cpp => AirSimCameraDirector.cpp} | 6 +- ...ameraDirector.h => AirSimCameraDirector.h} | 26 +++---- .../AirSim/Source/DetectionComponent.cpp | 69 ++++++++++++------- Unreal/Plugins/AirSim/Source/ObjectFilter.cpp | 12 ++-- Unreal/Plugins/AirSim/Source/PIPCamera.cpp | 4 +- .../AirSim/Source/SimMode/SimModeBase.h | 2 +- .../AirSim/Source/Weather/WeatherLib.cpp | 1 - Unreal/Plugins/AirSim/Source/WorldSimApi.cpp | 2 +- UnrealPluginFiles.vcxproj | 4 +- UnrealPluginFiles.vcxproj.filters | 2 +- build.sh | 6 -- 18 files changed, 104 insertions(+), 84 deletions(-) rename Unreal/Plugins/AirSim/Source/{CameraDirector.cpp => AirSimCameraDirector.cpp} (99%) rename Unreal/Plugins/AirSim/Source/{CameraDirector.h => AirSimCameraDirector.h} (82%) diff --git a/Unreal/Environments/Blocks/Blocks.uproject b/Unreal/Environments/Blocks/Blocks.uproject index d78d1cd58..6d803f0f0 100644 --- a/Unreal/Environments/Blocks/Blocks.uproject +++ b/Unreal/Environments/Blocks/Blocks.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "5.2", + "EngineAssociation": "5.3", "Category": "", "Description": "", "Modules": [ diff --git a/Unreal/Environments/Blocks/Source/Blocks.Target.cs b/Unreal/Environments/Blocks/Source/Blocks.Target.cs index d7c26bac5..fa349d203 100644 --- a/Unreal/Environments/Blocks/Source/Blocks.Target.cs +++ b/Unreal/Environments/Blocks/Source/Blocks.Target.cs @@ -9,7 +9,7 @@ public BlocksTarget(TargetInfo Target) : base(Target) { Type = TargetType.Game; ExtraModuleNames.AddRange(new string[] { "Blocks" }); - + DefaultBuildSettings = BuildSettingsVersion.V4; //bUseUnityBuild = false; if (Target.Platform == UnrealTargetPlatform.Linux) bUsePCHFiles = false; diff --git a/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs b/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs index 79af1e041..a521c53a0 100644 --- a/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs +++ b/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs @@ -9,7 +9,7 @@ public BlocksEditorTarget(TargetInfo Target) : base(Target) { Type = TargetType.Editor; ExtraModuleNames.AddRange(new string[] { "Blocks" }); - DefaultBuildSettings = BuildSettingsVersion.V2; + DefaultBuildSettings = BuildSettingsVersion.V4; IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_2; //bUseUnityBuild = false; //bUsePCHFiles = false; diff --git a/Unreal/Environments/Blocks/package.bat b/Unreal/Environments/Blocks/package.bat index c90d8e037..edc7ea99b 100644 --- a/Unreal/Environments/Blocks/package.bat +++ b/Unreal/Environments/Blocks/package.bat @@ -7,7 +7,7 @@ set OutPath=%1 set ToolPath=%2 set UEVer=%3 -if "%UEVer%"=="" set "UEVer=5.2.1" +if "%UEVer%"=="" set "UEVer=5.3.2" set "_ToolPath=%PROGRAMFILES%\Epic Games\UE_%UEVer%\Engine\Build\BatchFiles" if "%ToolPath%"=="" set ToolPath=%_ToolPath% diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp index 671fb980d..e9b32be33 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp @@ -53,7 +53,7 @@ EAppReturnType::Type UAirBlueprintLib::ShowMessage(EAppMsgType::Type message_typ return FMessageDialog::Open(message_type, FText::FromString(message.c_str()), - &title_text); + title_text); } ULineBatchComponent* GetLineBatcher(const UWorld* InWorld, bool bPersistentLines, float LifeTime, bool bDepthIsForeground) @@ -732,9 +732,9 @@ std::vector UAirBlueprintLib::Ge ENQUEUE_RENDER_COMMAND(GetVertexBuffer) ( [vertex_buffer, data](FRHICommandListImmediate& RHICmdList) { - FVector* indices = (FVector*)RHILockBuffer(vertex_buffer->VertexBufferRHI, 0, vertex_buffer->VertexBufferRHI->GetSize(), RLM_ReadOnly); + FVector* indices = (FVector*)RHICmdList.LockBuffer(vertex_buffer->VertexBufferRHI, 0, vertex_buffer->VertexBufferRHI->GetSize(), RLM_ReadOnly); memcpy(data, indices, vertex_buffer->VertexBufferRHI->GetSize()); - RHIUnlockBuffer(vertex_buffer->VertexBufferRHI); + RHICmdList.UnlockBuffer(vertex_buffer->VertexBufferRHI); }); #if ((ENGINE_MAJOR_VERSION > 4) || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 27)) @@ -754,9 +754,9 @@ std::vector UAirBlueprintLib::Ge ENQUEUE_RENDER_COMMAND(GetIndexBuffer) ( [IndexBuffer, data_ptr](FRHICommandListImmediate& RHICmdList) { - uint16_t* indices = (uint16_t*)RHILockBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly); + uint16_t* indices = (uint16_t*)RHICmdList.LockBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly); memcpy(data_ptr, indices, IndexBuffer->IndexBufferRHI->GetSize()); - RHIUnlockBuffer(IndexBuffer->IndexBufferRHI); + RHICmdList.UnlockBuffer(IndexBuffer->IndexBufferRHI); }); //Need to force the render command to go through cause on the next iteration the buffer no longer exists @@ -777,9 +777,9 @@ std::vector UAirBlueprintLib::Ge ENQUEUE_RENDER_COMMAND(GetIndexBuffer) ( [IndexBuffer, data_ptr](FRHICommandListImmediate& RHICmdList) { - uint32_t* indices = (uint32_t*)RHILockBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly); + uint32_t* indices = (uint32_t*)RHICmdList.LockBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly); memcpy(data_ptr, indices, IndexBuffer->IndexBufferRHI->GetSize()); - RHIUnlockBuffer(IndexBuffer->IndexBufferRHI); + RHICmdList.UnlockBuffer(IndexBuffer->IndexBufferRHI); }); FlushRenderingCommands(); @@ -814,7 +814,8 @@ std::vector UAirBlueprintLib::Ge TArray UAirBlueprintLib::ListWorldsInRegistry() { FARFilter Filter; - Filter.ClassNames.Add(UWorld::StaticClass()->GetFName()); + FTopLevelAssetPath UPath(UWorld::StaticClass()->GetPathName()); + Filter.ClassPaths.Add(UPath); Filter.bRecursivePaths = true; TArray AssetData; @@ -830,7 +831,8 @@ TArray UAirBlueprintLib::ListWorldsInRegistry() UObject* UAirBlueprintLib::GetMeshFromRegistry(const std::string& load_object) { FARFilter Filter; - Filter.ClassNames.Add(UStaticMesh::StaticClass()->GetFName()); + FTopLevelAssetPath MPath(UStaticMesh::StaticClass()->GetPathName()); + Filter.ClassPaths.Add(MPath); Filter.bRecursivePaths = true; TArray AssetData; diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h index 5035d5ad9..d41579857 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h @@ -58,7 +58,7 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary FName name_n = FName(*name); for (TActorIterator It(context->GetWorld(), T::StaticClass()); It; ++It) { AActor* Actor = *It; - if (!Actor->IsPendingKill() && (Actor->ActorHasTag(name_n) || Actor->GetName().Compare(name) == 0)) { + if (IsValid(Actor) && (Actor->ActorHasTag(name_n) || Actor->GetName().Compare(name) == 0)) { return static_cast(Actor); } } diff --git a/Unreal/Plugins/AirSim/Source/AirSim.Build.cs b/Unreal/Plugins/AirSim/Source/AirSim.Build.cs index 5afd66487..ee5713837 100644 --- a/Unreal/Plugins/AirSim/Source/AirSim.Build.cs +++ b/Unreal/Plugins/AirSim/Source/AirSim.Build.cs @@ -22,7 +22,9 @@ private string AirSimPluginPath } private string ProjectBinariesPath { - get { return Path.Combine( + get + { + return Path.Combine( Directory.GetParent(AirSimPluginPath).Parent.FullName, "Binaries"); } } @@ -91,7 +93,7 @@ public AirSim(ReadOnlyTargetRules Target) : base(Target) PublicIncludePaths.Add(Path.Combine(AirLibPath, "deps", "eigen3")); AddOSLibDependencies(Target); - SetupCompileMode(CompileMode.HeaderOnlyWithRpc, Target); + SetupCompileMode(CompileMode.CppCompileWithRpc, Target); } private void AddOSLibDependencies(ReadOnlyTargetRules Target) @@ -106,12 +108,12 @@ private void AddOSLibDependencies(ReadOnlyTargetRules Target) PublicAdditionalLibraries.Add("dxguid.lib"); } - if (Target.Platform == UnrealTargetPlatform.Linux) - { - // needed when packaging - PublicAdditionalLibraries.Add("stdc++"); - PublicAdditionalLibraries.Add("supc++"); - } + if (Target.Platform == UnrealTargetPlatform.Linux) + { + // needed when packaging + PublicAdditionalLibraries.Add("stdc++"); + PublicAdditionalLibraries.Add("supc++"); + } } static void CopyFileIfNewer(string srcFilePath, string destFolder) @@ -143,7 +145,9 @@ private bool AddLibDependency(string LibName, string LibPath, string LibFileName isLibrarySupported = true; PublicAdditionalLibraries.Add(Path.Combine(LibPath, PlatformString, ConfigurationString, LibFileName + ".lib")); - } else if (Target.Platform == UnrealTargetPlatform.Linux || Target.Platform == UnrealTargetPlatform.Mac) { + } + else if (Target.Platform == UnrealTargetPlatform.Linux || Target.Platform == UnrealTargetPlatform.Mac) + { isLibrarySupported = true; PublicAdditionalLibraries.Add(Path.Combine(LibPath, "lib" + LibFileName + ".a")); } @@ -157,4 +161,4 @@ private bool AddLibDependency(string LibName, string LibPath, string LibFileName return isLibrarySupported; } -} +} \ No newline at end of file diff --git a/Unreal/Plugins/AirSim/Source/CameraDirector.cpp b/Unreal/Plugins/AirSim/Source/AirSimCameraDirector.cpp similarity index 99% rename from Unreal/Plugins/AirSim/Source/CameraDirector.cpp rename to Unreal/Plugins/AirSim/Source/AirSimCameraDirector.cpp index a9f83a9ff..e4150875d 100644 --- a/Unreal/Plugins/AirSim/Source/CameraDirector.cpp +++ b/Unreal/Plugins/AirSim/Source/AirSimCameraDirector.cpp @@ -1,4 +1,4 @@ -#include "CameraDirector.h" +#include "AirSimCameraDirector.h" #include "GameFramework/PlayerController.h" #include "AirBlueprintLib.h" @@ -321,7 +321,7 @@ void ACameraDirector::inputEventFpvView() if (fpv_camera_) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_FPV); fpv_camera_->showToScreen(); - disableCameras(false, true, true); + disableCameras(false, true, true, true); } else UAirBlueprintLib::LogMessageString("Camera is not available: ", "fpv_camera", LogDebugLevel::Failure); @@ -346,4 +346,4 @@ void ACameraDirector::notifyViewModeChanged() UWorld* world = GetWorld(); UGameViewportClient* gameViewport = world->GetGameViewport(); gameViewport->bDisableWorldRendering = nodisplay; -} +} \ No newline at end of file diff --git a/Unreal/Plugins/AirSim/Source/CameraDirector.h b/Unreal/Plugins/AirSim/Source/AirSimCameraDirector.h similarity index 82% rename from Unreal/Plugins/AirSim/Source/CameraDirector.h rename to Unreal/Plugins/AirSim/Source/AirSimCameraDirector.h index 895935a16..90d83b03a 100644 --- a/Unreal/Plugins/AirSim/Source/CameraDirector.h +++ b/Unreal/Plugins/AirSim/Source/AirSimCameraDirector.h @@ -7,7 +7,7 @@ #include "ManualPoseController.h" #include "common/common_utils/Utils.hpp" #include "GameFramework/SpringArmComponent.h" -#include "CameraDirector.generated.h" +#include "AirSimCameraDirector.generated.h" UENUM(BlueprintType) enum class ECameraDirectorMode : uint8 @@ -30,10 +30,10 @@ class AIRSIM_API ACameraDirector : public AActor public: /** Spring arm that will offset the camera */ UPROPERTY(Category = Camera, VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true")) - USpringArmComponent* SpringArm; + USpringArmComponent *SpringArm; UPROPERTY(Category = Camera, VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true")) - APIPCamera* ExternalCamera; + APIPCamera *ExternalCamera; public: void inputEventFpvView(); @@ -57,11 +57,11 @@ class AIRSIM_API ACameraDirector : public AActor void setMode(ECameraDirectorMode mode); void initializeForBeginPlay(ECameraDirectorMode view_mode, - AActor* follow_actor, APIPCamera* fpv_camera, APIPCamera* front_camera, APIPCamera* back_camera); + AActor *follow_actor, APIPCamera *fpv_camera, APIPCamera *front_camera, APIPCamera *back_camera); - APIPCamera* getFpvCamera() const; - APIPCamera* getExternalCamera() const; - APIPCamera* getBackupCamera() const; + APIPCamera *getFpvCamera() const; + APIPCamera *getExternalCamera() const; + APIPCamera *getBackupCamera() const; void setFollowDistance(const int follow_distance) { this->follow_distance_ = follow_distance; } void setCameraRotationLagEnabled(const bool lag_enabled) { this->camera_rotation_lag_enabled_ = lag_enabled; } @@ -74,16 +74,16 @@ class AIRSIM_API ACameraDirector : public AActor private: typedef common_utils::Utils Utils; - APIPCamera* fpv_camera_; - APIPCamera* backup_camera_; - APIPCamera* front_camera_; - AActor* follow_actor_; + APIPCamera *fpv_camera_; + APIPCamera *backup_camera_; + APIPCamera *front_camera_; + AActor *follow_actor_; - USceneComponent* last_parent_ = nullptr; + USceneComponent *last_parent_ = nullptr; ECameraDirectorMode mode_; UPROPERTY() - UManualPoseController* manual_pose_controller_; + UManualPoseController *manual_pose_controller_; FVector camera_start_location_; FVector initial_ground_obs_offset_; diff --git a/Unreal/Plugins/AirSim/Source/DetectionComponent.cpp b/Unreal/Plugins/AirSim/Source/DetectionComponent.cpp index a1fc1281f..ad1c4b631 100644 --- a/Unreal/Plugins/AirSim/Source/DetectionComponent.cpp +++ b/Unreal/Plugins/AirSim/Source/DetectionComponent.cpp @@ -26,25 +26,34 @@ UDetectionComponent::UDetectionComponent() void UDetectionComponent::BeginPlay() { Super::BeginPlay(); - scene_capture_component_2D_ = CastChecked(GetAttachParent()); + scene_capture_component_2D_ = Cast(GetAttachParent()); + if (!scene_capture_component_2D_) + { + // we get re-parented to USceneComponent when saving Take Recorder videos + this->Deactivate(); + } object_filter_ = FObjectFilter(); } -void UDetectionComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) +void UDetectionComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); } -const TArray& UDetectionComponent::getDetections() +const TArray &UDetectionComponent::getDetections() { cached_detections_.Empty(); - for (TActorIterator actor_itr(GetWorld()); actor_itr; ++actor_itr) { - AActor* actor = *actor_itr; - if (object_filter_.matchesActor(actor)) { - if (FVector::Distance(actor->GetActorLocation(), GetComponentLocation()) <= max_distance_to_camera_) { + for (TActorIterator actor_itr(GetWorld()); actor_itr; ++actor_itr) + { + AActor *actor = *actor_itr; + if (object_filter_.matchesActor(actor)) + { + if (FVector::Distance(actor->GetActorLocation(), GetComponentLocation()) <= max_distance_to_camera_) + { FBox2D box_2D_out; - if (texture_target_ && calcBoundingFromViewInfo(actor, box_2D_out)) { + if (texture_target_ && calcBoundingFromViewInfo(actor, box_2D_out)) + { FDetectionInfo detection; detection.Actor = actor; detection.Box2D = box_2D_out; @@ -63,7 +72,7 @@ const TArray& UDetectionComponent::getDetections() return cached_detections_; } -bool UDetectionComponent::calcBoundingFromViewInfo(AActor* actor, FBox2D& box_out) +bool UDetectionComponent::calcBoundingFromViewInfo(AActor *actor, FBox2D &box_out) { FVector origin; FVector extend; @@ -74,7 +83,7 @@ bool UDetectionComponent::calcBoundingFromViewInfo(AActor* actor, FBox2D& box_ou bool is_in_camera_view = false; // get render target for texture size - FRenderTarget* render_target = texture_target_->GameThread_GetRenderTargetResource(); + FRenderTarget *render_target = texture_target_->GameThread_GetRenderTargetResource(); // initialize viewinfo for projection matrix FMinimalViewInfo info; @@ -113,16 +122,19 @@ bool UDetectionComponent::calcBoundingFromViewInfo(AActor* actor, FBox2D& box_ou FPlane(0, 1, 0, 0), FPlane(0, 0, 0, 1)); - if (scene_capture_component_2D_->bUseCustomProjectionMatrix) { + if (scene_capture_component_2D_->bUseCustomProjectionMatrix) + { projection_data.ProjectionMatrix = scene_capture_component_2D_->CustomProjectionMatrix; } - else { + else + { projection_data.ProjectionMatrix = info.CalculateProjectionMatrix(); } projection_data.SetConstrainedViewRectangle(screen_rect); // Project Points to pixels and get the corner pixels - for (FVector& point : points) { + for (FVector &point : points) + { FVector2D Pixel(0, 0); FSceneView::ProjectWorldToScreen((point), screen_rect, projection_data.ComputeViewProjectionMatrix(), Pixel); is_in_camera_view |= (Pixel != screen_rect.Min) && (Pixel != screen_rect.Max) && screen_rect.Contains(FIntPoint(Pixel.X, Pixel.Y)); @@ -136,13 +148,17 @@ bool UDetectionComponent::calcBoundingFromViewInfo(AActor* actor, FBox2D& box_ou // If actor in camera view - check if it's actually visible or hidden // Check against 8 extend points bool is_visible = false; - if (is_in_camera_view) { + if (is_in_camera_view) + { FHitResult result; bool is_world_hit; - for (FVector& point : points) { + for (FVector &point : points) + { is_world_hit = GetWorld()->LineTraceSingleByChannel(result, GetComponentLocation(), point, ECC_WorldStatic); - if (is_world_hit) { - if (result.GetActor() == actor) { + if (is_world_hit) + { + if (result.GetActor() == actor) + { is_visible = true; break; } @@ -151,12 +167,16 @@ bool UDetectionComponent::calcBoundingFromViewInfo(AActor* actor, FBox2D& box_ou // If actor in camera view but didn't hit any point out of 8 extend points, // check against 10 random points - if (!is_visible) { - for (int i = 0; i < 10; i++) { + if (!is_visible) + { + for (int i = 0; i < 10; i++) + { FVector point = UKismetMathLibrary::RandomPointInBoundingBox(origin, extend); is_world_hit = GetWorld()->LineTraceSingleByChannel(result, GetComponentLocation(), point, ECC_WorldStatic); - if (is_world_hit) { - if (result.GetActor() == actor) { + if (is_world_hit) + { + if (result.GetActor() == actor) + { is_visible = true; break; } @@ -187,11 +207,12 @@ FRotator UDetectionComponent::getRelativeRotation(FVector in_location, FRotator return relative_object_transform.Rotator(); } -void UDetectionComponent::addMeshName(const std::string& mesh_name) +void UDetectionComponent::addMeshName(const std::string &mesh_name) { FString name(mesh_name.c_str()); - if (!object_filter_.wildcard_mesh_names_.Contains(name)) { + if (!object_filter_.wildcard_mesh_names_.Contains(name)) + { object_filter_.wildcard_mesh_names_.Add(name); } } @@ -204,4 +225,4 @@ void UDetectionComponent::setFilterRadius(const float radius_cm) void UDetectionComponent::clearMeshNames() { object_filter_.wildcard_mesh_names_.Empty(); -} +} \ No newline at end of file diff --git a/Unreal/Plugins/AirSim/Source/ObjectFilter.cpp b/Unreal/Plugins/AirSim/Source/ObjectFilter.cpp index 25c48b4f9..905e7f0ce 100644 --- a/Unreal/Plugins/AirSim/Source/ObjectFilter.cpp +++ b/Unreal/Plugins/AirSim/Source/ObjectFilter.cpp @@ -49,12 +49,12 @@ bool FObjectFilter::matchesActor(AActor* actor) const USkeletalMeshComponent* skeletal_mesh_component = Cast(actor_component); if (skeletal_mesh_component) { if (skeletal_mesh_ && - skeletal_mesh_component->SkeletalMesh == skeletal_mesh_) { + skeletal_mesh_component->GetSkeletalMeshAsset() == skeletal_mesh_) { return true; } if (wildcard_mesh_names_.Num() != 0 && - skeletal_mesh_component->SkeletalMesh && - isMatchAnyWildcard(skeletal_mesh_component->SkeletalMesh->GetName())) { + skeletal_mesh_component->GetSkeletalMeshAsset() && + isMatchAnyWildcard(skeletal_mesh_component->GetSkeletalMeshAsset()->GetName())) { return true; } } @@ -112,11 +112,11 @@ bool FObjectFilter::matchesComponent(UActorComponent* actor_component) const if (skeletal_mesh_ || wildcard_mesh_names_.Num() != 0) { USkeletalMeshComponent* SkeletalMeshComponent = Cast(actor_component); if (SkeletalMeshComponent) { - if (skeletal_mesh_ && SkeletalMeshComponent->SkeletalMesh == skeletal_mesh_) { + if (skeletal_mesh_ && SkeletalMeshComponent->GetSkeletalMeshAsset() == skeletal_mesh_) { bMatchesSkeletalMesh = true; } if (wildcard_mesh_names_.Num() != 0 && - isMatchAnyWildcard(SkeletalMeshComponent->SkeletalMesh->GetName())) { + isMatchAnyWildcard(SkeletalMeshComponent->GetSkeletalMeshAsset()->GetName())) { bMatchesWildcardMeshName = true; } } @@ -185,4 +185,4 @@ uint32 GetTypeHash(const FObjectFilter& key) // KeyHash = HashCombine(KeyHash, GetTypeHash(Key.WildcardMeshNames)); return key_hash; -} \ No newline at end of file +} diff --git a/Unreal/Plugins/AirSim/Source/PIPCamera.cpp b/Unreal/Plugins/AirSim/Source/PIPCamera.cpp index d0cbe2e74..fb349698e 100644 --- a/Unreal/Plugins/AirSim/Source/PIPCamera.cpp +++ b/Unreal/Plugins/AirSim/Source/PIPCamera.cpp @@ -858,7 +858,7 @@ void APIPCamera::onViewModeChanged(bool nodisplay) std::vector APIPCamera::getPresetLensSettings() const { std::vector vector; - const TArray lens_presets = camera_->GetLensPresets(); + const TArray lens_presets = UCineCameraSettings::GetLensPresets(); for (const FNamedLensPreset& preset : lens_presets) { std::ostringstream current_lens_string; std::string name = (TCHAR_TO_UTF8(*preset.Name)); @@ -900,7 +900,7 @@ void APIPCamera::setPresetLensSettings(std::string preset_string) std::vector APIPCamera::getPresetFilmbackSettings() const { std::vector vector_all_presets; - TArray lens_presets = camera_->GetFilmbackPresets(); + TArray lens_presets = UCineCameraSettings::GetFilmbackPresets(); for (const FNamedFilmbackPreset& preset : lens_presets) { std::ostringstream preset_string; std::string name = (TCHAR_TO_UTF8(*preset.Name)); diff --git a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h index 863b6b8e4..a1cc7cfb3 100644 --- a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h +++ b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h @@ -8,7 +8,7 @@ #include "ParticleDefinitions.h" #include "Annotation/ObjectAnnotator.h" #include -#include "CameraDirector.h" +#include "AirSimCameraDirector.h" #include "common/AirSimSettings.hpp" #include "common/ClockFactory.hpp" #include "api/ApiServerBase.hpp" diff --git a/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp b/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp index a9f1f130a..e0e4b6390 100644 --- a/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp +++ b/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp @@ -200,7 +200,6 @@ void UWeatherLib::hideWeatherMenu(UWorld* World) // hacky test to make sure we are getting the right class. for some reason cast above doesn't work, so we use this instead to test for class if (FoundWidgets[i] && FoundWidgets[i]->GetClass()->GetFName().ToString() == getWeatherMenuClassName()) { FoundWidgets[i]->RemoveFromParent(); - FoundWidgets[i]->RemoveFromViewport(); } } APlayerController* PC = UGameplayStatics::GetPlayerController(World, 0); diff --git a/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp b/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp index e7732e61f..bf2f70a5e 100644 --- a/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp +++ b/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp @@ -66,7 +66,7 @@ bool WorldSimApi::destroyObject(const std::string& object_name) AActor* actor = UAirBlueprintLib::FindActor(simmode_, FString(object_name.c_str())); if (actor) { actor->Destroy(); - result = actor->IsPendingKill(); + result = !IsValid(actor); } if (result) simmode_->scene_object_map.Remove(FString(object_name.c_str())); diff --git a/UnrealPluginFiles.vcxproj b/UnrealPluginFiles.vcxproj index ffd26050a..574933431 100644 --- a/UnrealPluginFiles.vcxproj +++ b/UnrealPluginFiles.vcxproj @@ -101,7 +101,7 @@ - + @@ -135,7 +135,7 @@ - + diff --git a/UnrealPluginFiles.vcxproj.filters b/UnrealPluginFiles.vcxproj.filters index b0516486a..822e7ab11 100644 --- a/UnrealPluginFiles.vcxproj.filters +++ b/UnrealPluginFiles.vcxproj.filters @@ -24,7 +24,7 @@ Source Files - + Source Files diff --git a/build.sh b/build.sh index 4b94a8eb0..91da1d802 100755 --- a/build.sh +++ b/build.sh @@ -94,12 +94,6 @@ if [[ ! -d $build_dir ]]; then mkdir -p $build_dir fi -# Fix for Unreal/Unity using x86_64 (Rosetta) on Apple Silicon hardware. -CMAKE_VARS= -if [ "$(uname)" == "Darwin" ]; then - CMAKE_VARS="-DCMAKE_APPLE_SILICON_PROCESSOR=x86_64" -fi - pushd $build_dir >/dev/null if $debug; then folder_name="Debug"