diff --git a/Source/AnselCapture/Private/Ansel.cpp b/Source/AnselCapture/Private/Ansel.cpp index 3884494..56b4b58 100644 --- a/Source/AnselCapture/Private/Ansel.cpp +++ b/Source/AnselCapture/Private/Ansel.cpp @@ -17,6 +17,8 @@ #include "Widgets/SWindow.h" #include "Application/SlateApplicationBase.h" #include +#include "Runtime/Core/Public/Misc/OutputDeviceNull.h" +#include "AnselCaptureFunctionLibrary.h" #include DEFINE_LOG_CATEGORY_STATIC(LogAnselCapture, Log, All); @@ -90,6 +92,8 @@ namespace AnselCapture bool bAnselDLLLoaded = false; bool bAnselHonourRoll = false; bool bAnselHonourPitch = false; + FAnselCapturePauseDynamicDelegate PauseDelegate; + FAnselCaptureUnpauseDynamicDelegate UnpauseDelegate; } FNVAnselCaptureCameraPhotographyPrivate::FNVAnselCaptureCameraPhotographyPrivate() @@ -190,6 +194,7 @@ bool FNVAnselCaptureCameraPhotographyPrivate::UpdateCamera(FMinimalViewInfo& InO FMinimalViewToAnselCamera(AnselCamera, InOutPOV); ansel::updateCamera(AnselCamera); PCOwner->SetPause(true); + AnselCapture::PauseDelegate.ExecuteIfBound(); bTriggerNextCapture = true; bTriggerNextTick = false; return true; @@ -233,6 +238,7 @@ bool FNVAnselCaptureCameraPhotographyPrivate::UpdateCamera(FMinimalViewInfo& InO bAnselSessionIsRunning = true; // pause the world, we will capture only "paused" frames PCOwner->SetPause(true); + AnselCapture::PauseDelegate.ExecuteIfBound(); // here we call updateCamera to setup the capturing stuff OriginalView = InOutPOV; @@ -248,6 +254,7 @@ bool FNVAnselCaptureCameraPhotographyPrivate::UpdateCamera(FMinimalViewInfo& InO if (bAnselSessionEnded) { PCOwner->SetPause(false); + AnselCapture::UnpauseDelegate.ExecuteIfBound(); bAnselSessionEnded = false; bAnselSessionIsRunning = false; return false; @@ -277,6 +284,7 @@ bool FNVAnselCaptureCameraPhotographyPrivate::UpdateCamera(FMinimalViewInfo& InO PlatformApplication->Cursor->Show(PCOwner->ShouldShowMouseCursor()); } PCOwner->SetPause(false); + AnselCapture::UnpauseDelegate.ExecuteIfBound(); bTriggerNextTick = true; return false; } diff --git a/Source/AnselCapture/Private/AnselCaptureFunctionLibrary.cpp b/Source/AnselCapture/Private/AnselCaptureFunctionLibrary.cpp index 7140bdb..e8dcf88 100644 --- a/Source/AnselCapture/Private/AnselCaptureFunctionLibrary.cpp +++ b/Source/AnselCapture/Private/AnselCaptureFunctionLibrary.cpp @@ -1,18 +1,23 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "AnselCaptureFunctionLibrary.h" +#include "Runtime/CoreUObject/Public/UObject/WeakObjectPtr.h" #include "Camera/CameraPhotography.h" namespace AnselCapture { extern bool bAnselHonourRoll; extern bool bAnselHonourPitch; + extern FAnselCapturePauseDynamicDelegate PauseDelegate; + extern FAnselCaptureUnpauseDynamicDelegate UnpauseDelegate; } -void UAnselCaptureFunctionLibrary::StartAnselCapture(UObject* WorldContextObject, bool bHonourRoll, bool bHonourPitch) +void UAnselCaptureFunctionLibrary::StartAnselCapture(UObject* WorldContextObject, bool bHonourRoll, bool bHonourPitch, const FAnselCapturePauseDynamicDelegate& OnPause, const FAnselCaptureUnpauseDynamicDelegate& OnUnpause) { AnselCapture::bAnselHonourRoll = bHonourRoll; AnselCapture::bAnselHonourPitch = bHonourPitch; + AnselCapture::PauseDelegate = OnPause; + AnselCapture::UnpauseDelegate = OnUnpause; FCameraPhotographyManager::Get().StartSession(); } diff --git a/Source/AnselCapture/Public/AnselCaptureFunctionLibrary.h b/Source/AnselCapture/Public/AnselCaptureFunctionLibrary.h index 9293519..9f36b77 100644 --- a/Source/AnselCapture/Public/AnselCaptureFunctionLibrary.h +++ b/Source/AnselCapture/Public/AnselCaptureFunctionLibrary.h @@ -9,13 +9,18 @@ /** * */ + +DECLARE_DYNAMIC_DELEGATE(FAnselCapturePauseDynamicDelegate); +DECLARE_DYNAMIC_DELEGATE(FAnselCaptureUnpauseDynamicDelegate); + + UCLASS() class ANSELCAPTURE_API UAnselCaptureFunctionLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() - UFUNCTION(BlueprintCallable, Category = "Photography", meta = (WorldContext = WorldContextObject)) - static void StartAnselCapture(UObject* WorldContextObject, bool bHonourRoll, bool bHonourPitch); + UFUNCTION(BlueprintCallable, Category = "Photography", meta = (WorldContext = WorldContextObject, AutoCreateRefTerm="OnPause, OnUnpause")) + static void StartAnselCapture(UObject* WorldContextObject, bool bHonourRoll, bool bHonourPitch, const FAnselCapturePauseDynamicDelegate& OnPause, const FAnselCaptureUnpauseDynamicDelegate& OnUnpause); UFUNCTION(BlueprintCallable, Category = "Photography", meta = (WorldContext = WorldContextObject)) static void StopAnselCapture(UObject* WorldContextObject); diff --git a/Source/AnselCapture/Public/IAnselPlugin.h b/Source/AnselCapture/Public/IAnselPlugin.h index bce83d5..6df5d27 100644 --- a/Source/AnselCapture/Public/IAnselPlugin.h +++ b/Source/AnselCapture/Public/IAnselPlugin.h @@ -5,6 +5,7 @@ #include "Modules/ModuleManager.h" #include "CameraPhotographyModule.h" + /** * The public interface to this module. In most cases, this interface is only public to sibling modules * within this plugin.