diff --git a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneCapturerActor.cpp b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneCapturerActor.cpp index d93bed1d7d6..39a5d657796 100644 --- a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneCapturerActor.cpp +++ b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneCapturerActor.cpp @@ -613,6 +613,20 @@ float ANVSceneCapturerActor::GetCapturedDuration() const return CapturedDuration; } +int32 ANVSceneCapturerActor::GetExportedFrameCount() const +{ + UNVSceneDataExporter* CurrentSceneDataExporter = Cast(SceneDataHandler); + if (CurrentSceneDataExporter) + { + uint32 PendingToExportImagesCount = CurrentSceneDataExporter->GetPendingToExportImagesCount(); + uint32 PendingToExportFrameCount = (ImageToCapturePerFrame > 0) ? FMath::CeilToFloat(float(PendingToExportImagesCount) / ImageToCapturePerFrame) : PendingToExportImagesCount; + uint32 CapturedFrameCount = GetCapturedFrameCounter().GetTotalFrameCount(); + return (PendingToExportFrameCount <= CapturedFrameCount) ? (CapturedFrameCount - PendingToExportFrameCount) : 0; + } + + return 0; +} + TArray const& ANVSceneCapturerActor::GetImageSizePresets() { return GetDefault()->ImageSizePresets; @@ -660,6 +674,23 @@ void ANVSceneCapturerActor::UpdateViewpointList() return A.GetDisplayName() < B.GetDisplayName(); }); } + + // Count the number of images we need to capture and export every frame + ImageToCapturePerFrame = 0; + for (const auto& CheckViewpointComp : ViewpointList) + { + if (CheckViewpointComp) + { + for (const auto& CheckSceneFeatureExtractor : CheckViewpointComp->FeatureExtractorList) + { + const UNVSceneFeatureExtractor_PixelData* FeatureExtractorScenePixels = Cast(CheckSceneFeatureExtractor); + if (FeatureExtractorScenePixels && FeatureExtractorScenePixels->IsEnabled()) + { + ImageToCapturePerFrame++; + } + } + } + } } bool ANVSceneCapturerActor::CanHandleMoreSceneData() const diff --git a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneDataHandler.cpp b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneDataHandler.cpp index 0452e22c322..d543e159bfb 100644 --- a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneDataHandler.cpp +++ b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Private/NVSceneDataHandler.cpp @@ -288,10 +288,10 @@ void UNVSceneDataExporter::ExportCapturerSettings() void UNVSceneDataExporter::OnStopCapturingSceneData() { - if (ImageExporterThread.IsValid()) - { - ImageExporterThread->Stop(); - } + if (ImageExporterThread.IsValid()) + { + ImageExporterThread->Stop(); + } } void UNVSceneDataExporter::OnCapturingCompleted() @@ -392,6 +392,15 @@ FString UNVSceneDataExporter::GetExportFilePath(UNVSceneFeatureExtractor* Captur return ExportFilePath; } +uint32 UNVSceneDataExporter::GetPendingToExportImagesCount() const +{ + if (ImageExporterThread.IsValid()) + { + return ImageExporterThread->GetPendingImagesCount(); + } + return 0; +} + //=================================== UNVSceneDataVisualizer =================================== UNVSceneDataVisualizer::UNVSceneDataVisualizer() { diff --git a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneCapturerActor.h b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneCapturerActor.h index a3bb5bc38d2..cc959bc51f1 100644 --- a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneCapturerActor.h +++ b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneCapturerActor.h @@ -180,6 +180,8 @@ class NVSCENECAPTURER_API ANVSceneCapturerActor : public AActor float GetCaptureProgressFraction() const; UFUNCTION(BlueprintCallable, Category = "Capturer") float GetCapturedDuration() const; + UFUNCTION(BlueprintCallable, Category = "Capturer") + int32 GetExportedFrameCount() const; UFUNCTION(BlueprintCallable, Category = "Capturer") TArray GetViewpointList(); @@ -311,4 +313,7 @@ class NVSCENECAPTURER_API ANVSceneCapturerActor : public AActor UPROPERTY(Transient) TArray ViewpointList; + + UPROPERTY(Transient) + int32 ImageToCapturePerFrame; }; \ No newline at end of file diff --git a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneDataHandler.h b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneDataHandler.h index 85e1dfaf64d..c74069bcb91 100644 --- a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneDataHandler.h +++ b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturer/Public/NVSceneDataHandler.h @@ -133,6 +133,8 @@ class NVSCENECAPTURER_API UNVSceneDataExporter : public UNVSceneDataHandler int32 FrameIndex, const FString& FileExtension) const; + uint32 GetPendingToExportImagesCount() const; + protected: void ExportCapturerSettings(); diff --git a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturerGame/Private/HUD/NVSceneCapturerHUD_ExporterControlPanel.cpp b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturerGame/Private/HUD/NVSceneCapturerHUD_ExporterControlPanel.cpp index 8f8502faad2..a963597e85a 100644 --- a/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturerGame/Private/HUD/NVSceneCapturerHUD_ExporterControlPanel.cpp +++ b/Source/Plugins/NVSceneCapturer/Source/NVSceneCapturerGame/Private/HUD/NVSceneCapturerHUD_ExporterControlPanel.cpp @@ -128,8 +128,7 @@ void UNVSceneCapturerHUD_ExporterControlPanel::Update() const FString ExportedFolderPath = SceneDataExporter ? SceneDataExporter->GetConfiguredOutputDirectoryName(): TEXT(""); const uint64 CapturerCounter = ActiveCapturerActor->GetCapturedFrameCounter().GetTotalFrameCount(); - // TODO: Get the exported frame count from the UNVSceneDataExporter - const int32 ExportedFrameCount = 0; + const int32 ExportedFrameCount = ActiveCapturerActor->GetExportedFrameCount(); const int32 NumberOfScenesToExport = ActiveCapturerActor->GetNumberOfFramesToCapture(); const ENVSceneCapturerState ExporterState = ActiveCapturerActor->GetCurrentState(); const float CapturedFPS = ActiveCapturerActor->GetCapturedFPS();