antithing
(antithing)
December 13, 2016, 11:57am
1
I am trying to script some sequencer functions, with varying success.
What parameters does the AddTrack
function need?
ULevelSequence *LevelSequence;
LevelSequence->MovieScene->AddTrack(???);
the header file is:
UMovieSceneTrack * AddTrack
(
TSubclassOf < UMovieSceneTrack > TrackClass,
const FGuid & ObjectGuid
)
Thanks!
First one is type of track you want to create, look up “Inheritance Hierarchy” in UMovieSceneTrack, you will find list of all track classes. Same as in SpawnActor you use StaticClass() static function to get class of track
2nd (i guess, im not 100% sure) is guid of object that track will relate to, you can get it using this function:
FUniqueObjectGuid::GetOrCreateIDForObject(YourObject).GetGuid();
So for example:
FGuid MyGuid = FUniqueObjectGuid::GetOrCreateIDForObject(YourObject).GetGuid();
LevelSequence->MovieScene->AddTrack(UMovieSceneAudioTrack::StaticClass(), MyGuid);
Will create audio track for YourObject object (which is UObject or AActor pointer)
antithing
(antithing)
December 13, 2016, 1:22pm
3
Thanks! That gets me closer. I have:
LevelSequence->MovieScene->AddTrack(UMovieScene3DTransformTrack::StaticClass(),Guid);
but intelsense copmplains at UMovieScene3DTransformTrack::StaticClass
, giving:
incomplete type is not allowed
You mean UMovieScene3DTransformTrack::StaticClass()
you used ()? If yes then include header file containing the class
antithing
(antithing)
December 13, 2016, 1:44pm
5
ah yes! I had the TrackInstances
header, instead of the track
header. Thank you again!
antithing
(antithing)
December 13, 2016, 1:50pm
6
Sorry… one last thing… for LevelSequence->MovieScene->FindTrack
template<typename TrackClass>
TrackClass * FindTrack
(
const FGuid & ObjectGuid,
const FName & TrackName
)
What should I pass for the Guid
?
SasMaster
(SasMaster)
February 18, 2021, 8:33pm
7
Could you give more info how you finally added the tracks from C++? I am trying to use AddTrack() and AddMasterTrack() and it returns nullptr