Is there something similar for C++? A C++ function that gets called whenever a sequencer/matinee starts / ends? And if so, is it in Actor.h or is it in some other .h file?
In Unreal Engine 4, with the introduction of the Sequencer (which replaces Matinee), the event system has also changed. The new system doesn’t directly have an InterpolationStarted event in C++ as it was in Unrealscript, but you can bind to delegate events provided by the Sequencer.
If you want to detect when a Sequencer starts or ends, you can use the MovieScene’s delegates. Specifically, UMovieSceneSequencePlayer class provides the following delegates:
OnPlay
OnStop
OnPause
To bind a function to these events, you’ll use:
cpp
Copy code
YourSequencePlayer->OnPlay.AddDynamic(this, &YourClass::YourFunction);
Here’s a more detailed example:
Header File (.h)
cpp
Copy code
UCLASS()
class YOURPROJECT_API AYourActor : public AActor
{
GENERATED_BODY()
public:
AYourActor();
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Cinematic")
ULevelSequencePlayer* YourSequencePlayer; // Assuming you have a reference to your sequence player.
// Functions to be called when sequence starts or stops.
UFUNCTION()
void OnSequencePlay();
UFUNCTION()
void OnSequenceStop();
};
Source File (.cpp)
cpp
Copy code include “YourActor.h”
void AYourActor::OnSequenceStop()
{
UE_LOG(LogTemp, Warning, TEXT(“Sequence Stopped!”));
}
Make sure to replace YOURPROJECT, YourActor, and other placeholders with the appropriate names from your project.
This is a basic example, and there’s more you can do depending on your specific needs. Also, if you’re manipulating sequences or sequence players during runtime, you might need to adjust where and when you bind these events.
Finally, always ensure that the SequencePlayer is valid (i.e., not null) before trying to bind events or call functions on it.