From 6aed9a7544fa188ed33bfbfa3f16cb481bbb7c10 Mon Sep 17 00:00:00 2001 From: vanessa-rin Date: Mon, 7 Jun 2021 12:48:28 +0200 Subject: [PATCH 1/7] changes for UE 2.25 --- Source/URoboVision/Private/RGBDCamera.cpp | 2 +- Source/URoboVision/Private/SegmentationComponent.cpp | 2 +- Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h | 2 +- Source/URoboVision/Public/StaticSegmentationSceneProxy.h | 2 +- Source/URoboVision/Public/URoboVision.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/URoboVision/Private/RGBDCamera.cpp b/Source/URoboVision/Private/RGBDCamera.cpp index 126a2fb..c61b1e0 100644 --- a/Source/URoboVision/Private/RGBDCamera.cpp +++ b/Source/URoboVision/Private/RGBDCamera.cpp @@ -3,7 +3,7 @@ #include "RGBDCamera.h" #include "Components/SceneCaptureComponent2D.h" #include "Camera/CameraComponent.h" -#include "ConstructorHelpers.h" +#include "UObject/ConstructorHelpers.h" #include "EngineUtils.h" #include "StopTime.h" #include "Server.h" diff --git a/Source/URoboVision/Private/SegmentationComponent.cpp b/Source/URoboVision/Private/SegmentationComponent.cpp index 3653842..d40ec3b 100644 --- a/Source/URoboVision/Private/SegmentationComponent.cpp +++ b/Source/URoboVision/Private/SegmentationComponent.cpp @@ -7,7 +7,7 @@ #include #include "Components/SceneCaptureComponent2D.h" #include "Camera/CameraComponent.h" -#include "ConstructorHelpers.h" +#include "UObject/ConstructorHelpers.h" #include "EngineUtils.h" #include "StopTime.h" #include "Server.h" diff --git a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h index 5f68274..3d91957 100644 --- a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h @@ -9,7 +9,7 @@ #include "Runtime/Engine/Public/MaterialShared.h" #include "Runtime/Engine/Classes/Engine/Engine.h" #include "Runtime/Engine/Public/Rendering/SkeletalMeshRenderData.h" -#include "ConstructorHelpers.h" +#include "UObject/ConstructorHelpers.h" #include "EngineUtils.h" class FSkeletalSegmentationSceneProxy : public FSkeletalMeshSceneProxy diff --git a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h index 3550002..9041cb3 100644 --- a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h @@ -8,7 +8,7 @@ #include "Runtime/Engine/Public/MaterialShared.h" #include "Runtime/Engine/Classes/Engine/Engine.h" #include "Runtime/Engine/Public/Rendering/SkeletalMeshRenderData.h" -#include "ConstructorHelpers.h" +#include "UObject/ConstructorHelpers.h" #include "EngineUtils.h" diff --git a/Source/URoboVision/Public/URoboVision.h b/Source/URoboVision/Public/URoboVision.h index 8e538b7..83cc2b1 100644 --- a/Source/URoboVision/Public/URoboVision.h +++ b/Source/URoboVision/Public/URoboVision.h @@ -3,7 +3,7 @@ #pragma once #include "CoreMinimal.h" -#include "ModuleManager.h" +#include "Modules/ModuleManager.h" class FURoboVisionModule : public IModuleInterface { From 5da496b89c112b42447d9b3974818922d9c9736a Mon Sep 17 00:00:00 2001 From: Sanic Date: Tue, 20 Jul 2021 17:16:41 +0200 Subject: [PATCH 2/7] added version macros to be backwards compatible --- Source/URoboVision/Private/RGBDCamera.cpp | 6 ++++++ Source/URoboVision/Private/SegmentationComponent.cpp | 6 ++++++ Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h | 4 ++++ Source/URoboVision/Public/StaticSegmentationSceneProxy.h | 6 ++++++ Source/URoboVision/Public/URoboVision.h | 4 ++++ 5 files changed, 26 insertions(+) diff --git a/Source/URoboVision/Private/RGBDCamera.cpp b/Source/URoboVision/Private/RGBDCamera.cpp index a7d22fb..40dfa6c 100644 --- a/Source/URoboVision/Private/RGBDCamera.cpp +++ b/Source/URoboVision/Private/RGBDCamera.cpp @@ -3,7 +3,13 @@ #include "RGBDCamera.h" #include "Components/SceneCaptureComponent2D.h" #include "Camera/CameraComponent.h" + +#if ENGINE_MINOR_VERSION > 23 || ENGINE_MAJOR_VERSION >4 #include "UObject/ConstructorHelpers.h" +#else +#include "ConstructorHelpers.h" +#endif + #include "EngineUtils.h" #include "StopTime.h" #include "Server.h" diff --git a/Source/URoboVision/Private/SegmentationComponent.cpp b/Source/URoboVision/Private/SegmentationComponent.cpp index d40ec3b..c98dcc2 100644 --- a/Source/URoboVision/Private/SegmentationComponent.cpp +++ b/Source/URoboVision/Private/SegmentationComponent.cpp @@ -7,7 +7,13 @@ #include #include "Components/SceneCaptureComponent2D.h" #include "Camera/CameraComponent.h" + +#if ENGINE_MINOR_VERSION > 23 || ENGINE_MAJOR_VERSION >4 #include "UObject/ConstructorHelpers.h" +#else +#include "ConstructorHelpers.h" +#endif + #include "EngineUtils.h" #include "StopTime.h" #include "Server.h" diff --git a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h index 3d91957..db75513 100644 --- a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h @@ -9,7 +9,11 @@ #include "Runtime/Engine/Public/MaterialShared.h" #include "Runtime/Engine/Classes/Engine/Engine.h" #include "Runtime/Engine/Public/Rendering/SkeletalMeshRenderData.h" +#if ENGINE_MINOR_VERSION > 23 || ENGINE_MAJOR_VERSION >4 #include "UObject/ConstructorHelpers.h" +#else +#include "ConstructorHelpers.h" +#endif #include "EngineUtils.h" class FSkeletalSegmentationSceneProxy : public FSkeletalMeshSceneProxy diff --git a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h index 9041cb3..c517998 100644 --- a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h @@ -8,7 +8,13 @@ #include "Runtime/Engine/Public/MaterialShared.h" #include "Runtime/Engine/Classes/Engine/Engine.h" #include "Runtime/Engine/Public/Rendering/SkeletalMeshRenderData.h" + +#if ENGINE_MINOR_VERSION > 23 || ENGINE_MAJOR_VERSION >4 #include "UObject/ConstructorHelpers.h" +#else +#include "ConstructorHelpers.h" +#endif + #include "EngineUtils.h" diff --git a/Source/URoboVision/Public/URoboVision.h b/Source/URoboVision/Public/URoboVision.h index 83cc2b1..a8a798b 100644 --- a/Source/URoboVision/Public/URoboVision.h +++ b/Source/URoboVision/Public/URoboVision.h @@ -3,7 +3,11 @@ #pragma once #include "CoreMinimal.h" +#if ENGINE_MINOR_VERSION > 23 || ENGINE_MAJOR_VERSION >4 #include "Modules/ModuleManager.h" +#else +#include "ModuleManager.h" +#endif class FURoboVisionModule : public IModuleInterface { From 4bf931ae6344a47e85c1953377ceb937c3114d1a Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Tue, 14 Jun 2022 10:30:39 +0200 Subject: [PATCH 3/7] add check for major version --- Source/URoboVision/Private/StaticSegmentationSceneProxy.cpp | 6 +++--- Source/URoboVision/Public/StaticSegmentationSceneProxy.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/URoboVision/Private/StaticSegmentationSceneProxy.cpp b/Source/URoboVision/Private/StaticSegmentationSceneProxy.cpp index 66e111e..4608c51 100644 --- a/Source/URoboVision/Private/StaticSegmentationSceneProxy.cpp +++ b/Source/URoboVision/Private/StaticSegmentationSceneProxy.cpp @@ -5,7 +5,7 @@ FStaticSegmentationSceneProxy::FStaticSegmentationSceneProxy(UStaticMeshComponent* Component, bool bForceLODsShareStaticLighting, UMaterialInterface* SegmentationMID) : FStaticMeshSceneProxy(Component, bForceLODsShareStaticLighting) { - #if (ENGINE_MINOR_VERSION >= 22) + #if (ENGINE_MINOR_VERSION >= 22) || (ENGINE_MAJOR_VERSION >= 5) MaterialRenderProxy = SegmentationMID->GetRenderProxy(); #else MaterialRenderProxy = SegmentationMID->GetRenderProxy(false, false); @@ -44,7 +44,7 @@ bool FStaticSegmentationSceneProxy::GetMeshElement( int32 BatchIndex, int32 ElementIndex, uint8 InDepthPriorityGroup, -#if (ENGINE_MINOR_VERSION >= 22) +#if (ENGINE_MINOR_VERSION >= 22)|| (ENGINE_MAJOR_VERSION >= 5) bool bUseSelectionOutline, #else bool bUseSelectedMaterial, @@ -54,7 +54,7 @@ bool FStaticSegmentationSceneProxy::GetMeshElement( FMeshBatch & OutMeshBatch) const { bool Ret = FStaticMeshSceneProxy::GetMeshElement(LODIndex, BatchIndex, ElementIndex, InDepthPriorityGroup, -#if (ENGINE_MINOR_VERSION >= 22) +#if (ENGINE_MINOR_VERSION >= 22) || (ENGINE_MAJOR_VERSION >= 5) bUseSelectionOutline, #else bUseSelectedMaterial, diff --git a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h index c517998..55f42bd 100644 --- a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h @@ -36,7 +36,7 @@ class FStaticSegmentationSceneProxy : public FStaticMeshSceneProxy int32 BatchIndex, int32 ElementIndex, uint8 InDepthPriorityGroup, - #if (ENGINE_MINOR_VERSION >= 22) + #if (ENGINE_MINOR_VERSION >= 22) || (ENGINE_MAJOR_VERSION >= 5) bool bUseSelectionOutline, #else bool bUseSelectedMaterial, From 9873415b9f52b28c408b2848e6cd723c8d9d137e Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Thu, 23 Jun 2022 12:53:28 +0200 Subject: [PATCH 4/7] compiles for 5.0 --- Source/URoboVision/Private/SegmentationComponent.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/URoboVision/Private/SegmentationComponent.cpp b/Source/URoboVision/Private/SegmentationComponent.cpp index c98dcc2..0c0f36c 100644 --- a/Source/URoboVision/Private/SegmentationComponent.cpp +++ b/Source/URoboVision/Private/SegmentationComponent.cpp @@ -82,8 +82,13 @@ FPrimitiveSceneProxy* USegmentationComponent::CreateSceneProxy(UStaticMeshCompon UMaterialInterface* ProxyMaterial = SegmentationMID; UStaticMesh* ParentStaticMesh = StaticMeshComponent->GetStaticMesh(); if(ParentStaticMesh == NULL + #if ENGINE_MINOR_VERSION < 27 && ENGINE_MAJOR_VERSION < 5 || ParentStaticMesh->RenderData == NULL || ParentStaticMesh->RenderData->LODResources.Num() == 0) + #else + || ParentStaticMesh->GetRenderData() == NULL + || ParentStaticMesh->GetRenderData()->LODResources.Num() == 0) + #endif //Version { OUT_INFO(TEXT("ParentStaticMesh is invalid.")); return NULL; From 925673f800417768afd1d45f085e0c988e2a2c58 Mon Sep 17 00:00:00 2001 From: monaAK Date: Thu, 24 Aug 2023 15:14:15 +0200 Subject: [PATCH 5/7] add header files for static and skeletal sceneproxy --- Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h | 1 + Source/URoboVision/Public/StaticSegmentationSceneProxy.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h index db75513..76f4feb 100644 --- a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h @@ -15,6 +15,7 @@ #include "ConstructorHelpers.h" #endif #include "EngineUtils.h" +#include "SkeletalMeshSceneProxy.h" class FSkeletalSegmentationSceneProxy : public FSkeletalMeshSceneProxy { diff --git a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h index 55f42bd..ce56464 100644 --- a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h @@ -16,7 +16,7 @@ #endif #include "EngineUtils.h" - +#include "StaticMeshSceneProxy.h" class FStaticSegmentationSceneProxy : public FStaticMeshSceneProxy From 0aaef8ccab169608aed886d2d293824bf884184a Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Thu, 15 Feb 2024 10:38:48 +0100 Subject: [PATCH 6/7] compiles on Ubuntu and UE 4.27, 5.2, 5.3.2 --- Source/URoboVision/Private/PacketBuffer.cpp | 4 +++- Source/URoboVision/Private/RGBDCamera.cpp | 17 ++++++++--------- .../Private/SegmentationComponent.cpp | 6 +++++- .../Public/SkeletalSegmentationSceneProxy.h | 4 ++++ .../Public/StaticSegmentationSceneProxy.h | 4 +++- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Source/URoboVision/Private/PacketBuffer.cpp b/Source/URoboVision/Private/PacketBuffer.cpp index 9fccf76..9c77cf4 100644 --- a/Source/URoboVision/Private/PacketBuffer.cpp +++ b/Source/URoboVision/Private/PacketBuffer.cpp @@ -74,7 +74,9 @@ void PacketBuffer::StartWriting(const TMap &ObjectToColor, cons Entry->B = ObjectColor.B; // Convert name to ANSI and copy it to the packet (no trailing '\0', length is indirectly given by the entry size) - const char *Name = TCHAR_TO_ANSI(*Elem.Key); + + auto NamePtr = StringCast(*Elem.Key); + const char *Name = NamePtr.Get(); memcpy(&Entry->FirstChar, Name, NameSize); It += ElemSize; diff --git a/Source/URoboVision/Private/RGBDCamera.cpp b/Source/URoboVision/Private/RGBDCamera.cpp index ed7a9d4..877032f 100644 --- a/Source/URoboVision/Private/RGBDCamera.cpp +++ b/Source/URoboVision/Private/RGBDCamera.cpp @@ -84,7 +84,7 @@ ARGBDCamera::ARGBDCamera() /*: ACameraActor(), Width(960), Height(540), Framerat bCaptureColorImage = true; bCaptureDepthImage = true; bCaptureObjectMaskImage = true; - + // TCP IP communication server port ServerPort = 10000; bBindToAnyIP = true; @@ -235,8 +235,7 @@ void ARGBDCamera::EndPlay(const EEndPlayReason::Type EndPlayReason) void ARGBDCamera::Tick(float DeltaTime) { Super::Tick(DeltaTime); - - // Check if paused + // Check if paused if(Paused) { return; @@ -250,7 +249,7 @@ void ARGBDCamera::Tick(float DeltaTime) } TimePassed -= 1.0f / Framerate; //MEASURE_TIME("Tick"); - //OUT_INFO(TEXT("FRAME_RATE: %f"),Framerate) + // OUT_INFO(TEXT("FRAME_RATE: %f"),Framerate) if(bColorAllObjectsOnEveryTick) { @@ -331,11 +330,11 @@ void ARGBDCamera::Pause(const bool _Pause) DepthImgCaptureComp->Deactivate(); ObjectMaskImgCaptureComp->SetHiddenInGame(true); ObjectMaskImgCaptureComp->Deactivate(); - bCompActive = false; + bCompActive = false; } else { - // Enable capture + // Enable capture if (bCaptureColorImage) { ColorImgCaptureComp->SetHiddenInGame(false); @@ -633,7 +632,7 @@ bool ARGBDCamera::ColorObject(AActor *Actor, const FString &name) USegmentationComponent* SegmentationComponent = NewObject(MeshComponent); SegmentationComponent->SetupAttachment(MeshComponent); SegmentationComponent->RegisterComponent(); - SegmentationComponent->SetSegmentationColor(SegmentationColor); + SegmentationComponent->SetSegmentationColor(SegmentationColor); SegmentationComponent->MarkRenderStateDirty(); } return true; @@ -654,7 +653,7 @@ bool ARGBDCamera::ColorAllObjects() if(bColoringObjectsIsVerbose) OUT_INFO(TEXT("Actor with name: %s."), *ActorName); } - + if(bColoringObjectsIsVerbose) { OUT_INFO(TEXT("Found %d Actors."), NumberOfActors); @@ -772,7 +771,7 @@ void ARGBDCamera::ProcessObject() Priv->CVObject.wait(WaitLock, [this] {return Priv->DoObject; }); Priv->DoObject = false; if(!this->Running) break; - ToColorImage(ImageObject, Priv->Buffer->Object); + ToColorImage(ImageObject, Priv->Buffer->Object); Priv->DoneObject = true; Priv->CVDone.notify_one(); } diff --git a/Source/URoboVision/Private/SegmentationComponent.cpp b/Source/URoboVision/Private/SegmentationComponent.cpp index 4806277..c698a54 100644 --- a/Source/URoboVision/Private/SegmentationComponent.cpp +++ b/Source/URoboVision/Private/SegmentationComponent.cpp @@ -25,6 +25,10 @@ #include #include +#if ENGINE_MINOR_VERSION >= 2 && ENGINE_MAJOR_VERSION == 5 +#include "SkeletalMeshSceneProxy.h" +#endif + USegmentationComponent::USegmentationComponent(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { @@ -104,7 +108,7 @@ FPrimitiveSceneProxy* USegmentationComponent::CreateSceneProxy(USkeletalMeshComp FSkeletalMeshRenderData* SkelMeshRenderData = SkeletalMeshComponent->GetSkeletalMeshRenderData(); if (SkelMeshRenderData && SkelMeshRenderData->LODRenderData.IsValidIndex(SkeletalMeshComponent->GetPredictedLODLevel()) && - SkeletalMeshComponent->MeshObject) + SkeletalMeshComponent->MeshObject) { return new FSkeletalSegmentationSceneProxy(SkeletalMeshComponent, SkelMeshRenderData, ProxyMaterial); } diff --git a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h index db75513..eff1701 100644 --- a/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/SkeletalSegmentationSceneProxy.h @@ -16,6 +16,10 @@ #endif #include "EngineUtils.h" +#if ENGINE_MINOR_VERSION >= 2 && ENGINE_MAJOR_VERSION == 5 +#include "SkeletalMeshSceneProxy.h" +#endif + class FSkeletalSegmentationSceneProxy : public FSkeletalMeshSceneProxy { public: diff --git a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h index 55f42bd..a6af2b5 100644 --- a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h @@ -17,7 +17,9 @@ #include "EngineUtils.h" - +#if ENGINE_MINOR_VERSION >= 2 && ENGINE_MAJOR_VERSION == 5 +#include "StaticMeshSceneProxy.h" +#endif class FStaticSegmentationSceneProxy : public FStaticMeshSceneProxy { From e64e6f010720a7682e69d0adedbd8c77a93c7b77 Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Thu, 15 Feb 2024 10:41:33 +0100 Subject: [PATCH 7/7] fix merge conflict --- Source/URoboVision/Public/StaticSegmentationSceneProxy.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h index c2502e0..a6af2b5 100644 --- a/Source/URoboVision/Public/StaticSegmentationSceneProxy.h +++ b/Source/URoboVision/Public/StaticSegmentationSceneProxy.h @@ -16,15 +16,10 @@ #endif #include "EngineUtils.h" -<<<<<<< HEAD #if ENGINE_MINOR_VERSION >= 2 && ENGINE_MAJOR_VERSION == 5 #include "StaticMeshSceneProxy.h" #endif -======= -#include "StaticMeshSceneProxy.h" - ->>>>>>> cf04a4b78a1e69255f76c96aad9712b41f4a23a4 class FStaticSegmentationSceneProxy : public FStaticMeshSceneProxy {