void Update(float DeltaSeconds) { bool bShouldUpdate = true; const float CaptureFrequency = 1.0f/(float)GEngine->MatineeScreenshotOptions.MatineeCaptureFPS; if (CaptureFrequency > 0.f) { CurrentAccumSeconds += DeltaSeconds; if (CurrentAccumSeconds > CaptureFrequency) { while (CurrentAccumSeconds > CaptureFrequency) { CurrentAccumSeconds -= CaptureFrequency; } } else { bShouldUpdate = false; } } if (GIsRequestingExit || !bShouldUpdate || CaptureSlateRenderer) { return; } if (bMatineeFinished) { if (GEngine->MatineeScreenshotOptions.MatineeCaptureType == 0) { if (CaptureViewport) { CaptureViewport->GetClient()->CloseRequested(CaptureViewport); } } else { FViewport* ViewportUsed = GEngine->GameViewport != NULL ? GEngine->GameViewport->Viewport : NULL; if (ViewportUsed) { ViewportUsed->GetClient()->CloseRequested(ViewportUsed); } } StopCapture(); } else if (bCapturing) { // Wait for the directshow thread to finish encoding the last data GCaptureSyncEvent->Wait(); CaptureViewport->ReadPixels(ViewportColorBuffer, FReadSurfaceDataFlags()); // Allow the directshow thread to encode more data if the event is still available if ( GCaptureSyncEvent ) { GCaptureSyncEvent->Trigger(); UE_LOG(LogMovieCapture, Log, TEXT("-----------------START------------------")); UE_LOG(LogMovieCapture, Log, TEXT(" INCREASE FrameNumber from %d "), FrameNumber); FrameNumber++; } } else if (bReadyForCapture) { CaptureViewport->ReadPixels(ViewportColorBuffer, FReadSurfaceDataFlags()); // Allow the directshow thread to process the pixels we just read GCaptureSyncEvent->Trigger(); Control->Run(); bReadyForCapture = false; bCapturing = true; UE_LOG(LogMovieCapture, Log, TEXT("-----------------START------------------")); UE_LOG(LogMovieCapture, Log, TEXT(" INCREASE FrameNumber from %d "), FrameNumber); FrameNumber++; } }