I want to make use of UMovieSceneCapture, which needs me to call UMovieSceneCapture::Initialize.
UMovieSceneCapture::Initialize wants a TSharedPtr < FSceneViewport >. I get the FSceneViewport from my Actor with GetWorld()->GetGameViewport()->GetGameViewport().
Unfortunately that returns me a RawPointer to FSceneViewport. Using MakeShareable I can convert the RawPointer to TSharedPointer and pass it to UMovieSceneCapture::Initialize.
That works well until the destruction of my UMovieSceneCapture instance as it destroyes its TSharedPtr<FSceneViewport> that counts down the reference count which is now 0 -> The viewport gets destroyed.
One way to go would be to never destroy the UMovieSceneCapture instance, but that is no go.
Another way would be to make another TSharedPtr<FSceneViewport> and store it somewhere just so the viewport stays alive (NOPE NOPE NOPE).
The UMovieSceneCapture does what it should, the only issue is the destruction problem.
Solved it.
Unreal provides an overloaded function of MakeShareable that takes a deleter as second argument. Passed it a class that does nothing, so the shared object will not get deleted, even if it should.
class TDeleterNot
{
public:
void operator()(void*) {}
};
Hi, Rumbleball, I’m trying to do the same thing right now, but I can’t find much things related to this except some APIs, do you mind sharing some code, just how to get the recording to work?
Thank you very much!
I am trying to record gameplay at runtime, and save as a video file, just want get it to work.
Now I’m able to create a file on my desktop, but it’s not working properly.
Okay…
You said you made it work in that post, so I just want know how you did it, am I on the right track?
I don’t really mind if the gameplay is getting stuck or anything, help me with this code, please?
Sorry I have no code anymore, nor the time.
It took me about 3 weeks to get something out of it.
You basically want to open the capture dialog of the Sequencer, search the code for the title of the window (I don’t know the class anymore). Then look for the code executed on press of the capurebutton and continue from their.
This will get you in contact with Slate code, and you will need wo wrap your head around that stuff.