From c08c447484e8c97f9e14958443f10365d6611a51 Mon Sep 17 00:00:00 2001 From: Trim Bresilla Date: Mon, 25 Nov 2024 01:28:41 +0100 Subject: [PATCH] feat: add conditional rendering in scene capture logic (#336) - Add a `Render` bool property to control scene capture execution. - Wrap the scene capture logic in a conditional check on `Render` to allow for selective rendering. --- .../Private/Sensors/RRROS2CameraComponent.cpp | 6 ++++-- .../Public/Sensors/RRROS2CameraComponent.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp b/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp index fc1d0a18..e0f4d62f 100644 --- a/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp +++ b/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp @@ -49,8 +49,10 @@ void URRROS2CameraComponent::PreInitializePublisher(UROS2NodeComponent* InROS2No void URRROS2CameraComponent::SensorUpdate() { - SceneCaptureComponent->CaptureScene(); - CaptureNonBlocking(); + if (Render) { + SceneCaptureComponent->CaptureScene(); + CaptureNonBlocking(); + } } // reference https://github.com/TimmHess/UnrealImageCapture diff --git a/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h b/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h index 566c3cdd..89420d82 100644 --- a/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h +++ b/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h @@ -114,6 +114,9 @@ class RAPYUTASIMULATIONPLUGINS_API URRROS2CameraComponent : public URRROS2BaseSe UPROPERTY(EditAnywhere, BlueprintReadWrite) EROS2CameraType CameraType = EROS2CameraType::RGB; + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool Render = true; + // ROS /** * @brief Update ROS 2 Msg structure from #RenderRequestQueue