本文整理汇总了C++中UMovieScene类的典型用法代码示例。如果您正苦于以下问题:C++ UMovieScene类的具体用法?C++ UMovieScene怎么用?C++ UMovieScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UMovieScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindObject
UObject* FMovieSceneSequenceInstance::FindObject(const FGuid& ObjectId, const IMovieScenePlayer& Player) const
{
if(MovieSceneSequence.IsValid())
{
// Attempt to find a possessable first
UMovieScene* MovieScene = MovieSceneSequence->GetMovieScene();
if (MovieScene != nullptr)
{
FMovieScenePossessable* Possessable = MovieScene->FindPossessable(ObjectId);
if (Possessable)
{
UObject* ParentObject = Player.GetPlaybackContext();
if (Possessable->GetParent().IsValid())
{
ParentObject = FindObject(Possessable->GetParent(), Player);
}
return MovieSceneSequence->FindPossessableObject(ObjectId, ParentObject);
}
else
{
return FindSpawnedObject(ObjectId);
}
}
}
return nullptr;
}
示例2: InitSequencePlayer
void UUMGSequencePlayer::InitSequencePlayer( const UWidgetAnimation& InAnimation, UUserWidget& UserWidget )
{
Animation = &InAnimation;
UMovieScene* MovieScene = Animation->MovieScene;
// Cache the time range of the sequence to determine when we stop
TimeRange = MovieScene->GetTimeRange();
RuntimeBindings = NewObject<UMovieSceneBindings>(this);
RuntimeBindings->SetRootMovieScene( MovieScene );
UWidgetTree* WidgetTree = UserWidget.WidgetTree;
TMap<FGuid, TArray<UObject*> > GuidToRuntimeObjectMap;
// Bind to Runtime Objects
for (const FWidgetAnimationBinding& Binding : InAnimation.AnimationBindings)
{
UObject* FoundObject = Binding.FindRuntimeObject( *WidgetTree );
if( FoundObject )
{
TArray<UObject*>& Objects = GuidToRuntimeObjectMap.FindOrAdd(Binding.AnimationGuid);
Objects.Add(FoundObject);
}
}
for( auto It = GuidToRuntimeObjectMap.CreateConstIterator(); It; ++It )
{
RuntimeBindings->AddBinding( It.Key(), It.Value() );
}
}
示例3: Empty
void FSequencerNodeTree::Update()
{
// @todo Sequencer - This update pass is too aggressive. Some nodes may still be valid
Empty();
UMovieScene* MovieScene = Sequencer.GetFocusedMovieScene();
// Get the master tracks so we can get sections from them
const TArray<UMovieSceneTrack*>& MasterTracks = MovieScene->GetMasterTracks();
for( int32 TrackIndex = 0; TrackIndex < MasterTracks.Num(); ++TrackIndex )
{
UMovieSceneTrack& Track = *MasterTracks[TrackIndex];
TSharedRef<FTrackNode> SectionNode = MakeShareable( new FTrackNode( Track.GetTrackName(), Track, NULL, *this ) );
RootNodes.Add( SectionNode );
MakeSectionInterfaces( Track, SectionNode );
SectionNode->PinNode();
}
const TArray<FMovieSceneObjectBinding>& ObjectBindings = MovieScene->GetObjectBindings();
// Make nodes for all object bindings
for( int32 BindingIndex = 0; BindingIndex < ObjectBindings.Num(); ++BindingIndex )
{
TSharedRef<FObjectBindingNode> ObjectBindingNode = AddObjectBinding( ObjectBindings[BindingIndex].GetDisplayName(), ObjectBindings[BindingIndex].GetObjectGuid() );
const TArray<UMovieSceneTrack*>& Tracks = ObjectBindings[BindingIndex].GetTracks();
for( int32 TrackIndex = 0; TrackIndex < Tracks.Num(); ++TrackIndex )
{
UMovieSceneTrack& Track = *Tracks[TrackIndex];
FName SectionName = Track.GetTrackName();
check( SectionName != NAME_None );
TSharedRef<FTrackNode> SectionAreaNode = ObjectBindingNode->AddSectionAreaNode( SectionName, Track );
MakeSectionInterfaces( Track, SectionAreaNode );
}
}
struct FRootNodeSorter
{
bool operator()( const TSharedRef<FSequencerDisplayNode>& A, const TSharedRef<FSequencerDisplayNode>& B ) const
{
return A->GetType() == ESequencerNode::Object ? false : true;
}
};
// Sort so that master tracks appear before object tracks
RootNodes.Sort( FRootNodeSorter() );
// Re-filter the tree after updating
// @todo Sequencer - Newly added sections may need to be visible even when there is a filter
FilterNodes( FilterString );
}
示例4: StopRecording
bool UActorRecording::StopRecording(ULevelSequence* CurrentSequence)
{
FString ActorName;
if(CurrentSequence)
{
UMovieScene* MovieScene = CurrentSequence->GetMovieScene();
check(MovieScene);
FMovieSceneSpawnable* Spawnable = MovieScene->FindSpawnable(Guid);
if(Spawnable)
{
ActorName = Spawnable->GetName();
}
}
FScopedSlowTask SlowTask((float)SectionRecorders.Num() + 1.0f, FText::Format(NSLOCTEXT("SequenceRecorder", "ProcessingActor", "Processing Actor {0}"), FText::FromString(ActorName)));
// stop property recorders
for(auto& SectionRecorder : SectionRecorders)
{
SlowTask.EnterProgressFrame();
SectionRecorder->FinalizeSection();
}
SlowTask.EnterProgressFrame();
SectionRecorders.Empty();
return true;
}
示例5: FindEndTimeForShot
float UMovieSceneShotTrack::FindEndTimeForShot( float StartTime )
{
float EndTime = 0;
bool bFoundEndTime = false;
for( UMovieSceneSection* Section : SubMovieSceneSections )
{
if( Section->GetStartTime() >= StartTime )
{
EndTime = Section->GetStartTime();
bFoundEndTime = true;
break;
}
}
if( !bFoundEndTime )
{
UMovieScene* OwnerScene = GetTypedOuter<UMovieScene>();
// End time should just end where the movie scene ends. Ensure it is at least the same as start time (this should only happen when the movie scene has an initial time range smaller than the start time
EndTime = FMath::Max( OwnerScene->GetTimeRange().GetUpperBoundValue(), StartTime );
}
if( StartTime == EndTime )
{
// Give the shot a reasonable length of time to start out with. A 0 time shot is not usable
EndTime = StartTime + .5f;
}
return EndTime;
}
示例6: GetSectionSnapTimes
void FSequencerDragOperation::GetSectionSnapTimes(TArray<float>& OutSnapTimes, UMovieSceneSection* Section, TSharedPtr<FTrackNode> SequencerNode, bool bIgnoreOurSectionCustomSnaps)
{
// @todo Sequencer handle dilation snapping better
// Collect all the potential snap times from other section borders
const TArray< TSharedRef<ISequencerSection> >& Sections = SequencerNode->GetSections();
for (int32 SectionIndex = 0; SectionIndex < Sections.Num(); ++SectionIndex)
{
const UMovieSceneSection* InSection = Sections[SectionIndex]->GetSectionObject();
bool bIsThisSection = Section == InSection;
if (!bIgnoreOurSectionCustomSnaps || !bIsThisSection)
{
InSection->GetSnapTimes(OutSnapTimes, Section != InSection);
}
}
// snap to director track if it exists, and we are not the director track
UMovieSceneTrack* OuterTrack = Cast<UMovieSceneTrack>(Section->GetOuter());
UMovieScene* MovieScene = Cast<UMovieScene>(OuterTrack->GetOuter());
UMovieSceneTrack* ShotTrack = MovieScene->FindMasterTrack(UMovieSceneShotTrack::StaticClass());
if (ShotTrack && OuterTrack != ShotTrack)
{
const TArray<UMovieSceneSection*>& ShotSections = ShotTrack->GetAllSections();
for (int32 SectionIndex = 0; SectionIndex < ShotSections.Num(); ++SectionIndex)
{
auto Shot = ShotSections[SectionIndex];
Shot->GetSnapTimes(OutSnapTimes, true);
}
}
}
示例7: SpawnActorsForMovie
void UActorAnimationPlayer::SpawnActorsForMovie(TSharedRef<FMovieSceneSequenceInstance> MovieSceneInstance)
{
UWorld* WorldPtr = World.Get();
if (WorldPtr == nullptr)
{
return;
}
UMovieScene* MovieScene = MovieSceneInstance->GetSequence()->GetMovieScene();
if (MovieScene == nullptr)
{
return;
}
TArray<FSpawnedActorInfo>* FoundSpawnedActors = InstanceToSpawnedActorMap.Find(MovieSceneInstance);
if (FoundSpawnedActors != nullptr)
{
// Remove existing spawned actors for this movie
DestroyActorsForMovie( MovieSceneInstance );
}
TArray<FSpawnedActorInfo>& SpawnedActorList = InstanceToSpawnedActorMap.Add(MovieSceneInstance, TArray<FSpawnedActorInfo>());
for (auto SpawnableIndex = 0; SpawnableIndex < MovieScene->GetSpawnableCount(); ++SpawnableIndex)
{
auto& Spawnable = MovieScene->GetSpawnable(SpawnableIndex);
UClass* GeneratedClass = Spawnable.GetClass();
if ((GeneratedClass == nullptr) || !GeneratedClass->IsChildOf(AActor::StaticClass()))
{
continue;
}
AActor* ActorCDO = CastChecked<AActor>(GeneratedClass->ClassDefaultObject);
const FVector SpawnLocation = ActorCDO->GetRootComponent()->RelativeLocation;
const FRotator SpawnRotation = ActorCDO->GetRootComponent()->RelativeRotation;
FActorSpawnParameters SpawnInfo;
{
SpawnInfo.ObjectFlags = RF_NoFlags;
}
AActor* NewActor = WorldPtr->SpawnActor(GeneratedClass, &SpawnLocation, &SpawnRotation, SpawnInfo);
if (NewActor)
{
// Actor was spawned OK!
FSpawnedActorInfo NewInfo;
{
NewInfo.RuntimeGuid = Spawnable.GetGuid();
NewInfo.SpawnedActor = NewActor;
}
SpawnedActorList.Add(NewInfo);
}
}
}
示例8: GetFocusedMovieScene
void FSlomoTrackEditor::HandleAddSlomoTrackMenuEntryExecute()
{
UMovieScene* MovieScene = GetFocusedMovieScene();
if (MovieScene == nullptr)
{
return;
}
UMovieSceneTrack* SlomoTrack = MovieScene->FindMasterTrack<UMovieSceneSlomoTrack>();
if (SlomoTrack != nullptr)
{
return;
}
const FScopedTransaction Transaction(NSLOCTEXT("Sequencer", "AddSlomoTrack_Transaction", "Add Play Rate Track"));
MovieScene->Modify();
SlomoTrack = FindOrCreateMasterTrack<UMovieSceneSlomoTrack>().Track;
ensure(SlomoTrack);
UMovieSceneSection* NewSection = SlomoTrack->CreateNewSection();
ensure(NewSection);
SlomoTrack->AddSection(*NewSection);
GetSequencer()->NotifyMovieSceneDataChanged();
}
示例9: GetSequencer
void FSequencerObjectBindingNode::SetDisplayName(const FText& NewDisplayName)
{
UMovieScene* MovieScene = GetSequencer().GetFocusedMovieSceneSequence()->GetMovieScene();
if (MovieScene != nullptr)
{
MovieScene->SetObjectDisplayName(ObjectBinding, NewDisplayName);
}
}
示例10: SaveExpansionState
void FSequencerNodeTree::SaveExpansionState( const FSequencerDisplayNode& Node, bool bExpanded )
{
// @todo Sequencer - This should be moved to the sequence level
UMovieScene* MovieScene = Sequencer.GetFocusedMovieSceneSequence()->GetMovieScene();
FMovieSceneEditorData& EditorData = MovieScene->GetEditorData();
EditorData.ExpansionStates.Add( Node.GetPathName(), FMovieSceneExpansionState(bExpanded) );
}
示例11: GetSavedExpansionState
bool FSequencerNodeTree::GetSavedExpansionState( const FSequencerDisplayNode& Node ) const
{
// @todo Sequencer - This should be moved to the sequence level
UMovieScene* MovieScene = Sequencer.GetFocusedMovieSceneSequence()->GetMovieScene();
FMovieSceneEditorData& EditorData = MovieScene->GetEditorData();
FMovieSceneExpansionState* ExpansionState = EditorData.ExpansionStates.Find( Node.GetPathName() );
return ExpansionState ? ExpansionState->bExpanded : GetDefaultExpansionState(Node);
}
示例12: GetFocusedMovieSceneInstance
FGuid FSequencer::GetHandleToObject( UObject* Object )
{
TSharedRef<FMovieSceneInstance> FocusedMovieSceneInstance = GetFocusedMovieSceneInstance();
UMovieScene* FocusedMovieScene = FocusedMovieSceneInstance->GetMovieScene();
FGuid ObjectGuid = ObjectBindingManager->FindGuidForObject( *FocusedMovieScene, *Object );
if (ObjectGuid.IsValid())
{
// Make sure that the possessable is still valid, if it's not remove the binding so new one
// can be created. This can happen due to undo.
FMovieScenePossessable* Possessable = FocusedMovieScene->FindPossessable(ObjectGuid);
if (Possessable == nullptr )
{
ObjectBindingManager->UnbindPossessableObjects(ObjectGuid);
ObjectGuid.Invalidate();
}
}
bool bPossessableAdded = false;
// If the object guid was not found attempt to add it
// Note: Only possessed actors can be added like this
if( !ObjectGuid.IsValid() && ObjectBindingManager->CanPossessObject( *Object ) )
{
// @todo sequencer: Undo doesn't seem to be working at all
const FScopedTransaction Transaction( LOCTEXT("UndoPossessingObject", "Possess Object with MovieScene") );
// Possess the object!
{
// Create a new possessable
FocusedMovieScene->Modify();
ObjectGuid = FocusedMovieScene->AddPossessable( Object->GetName(), Object->GetClass() );
if ( IsShotFilteringOn() )
{
AddUnfilterableObject(ObjectGuid);
}
ObjectBindingManager->BindPossessableObject( ObjectGuid, *Object );
bPossessableAdded = true;
}
}
if( bPossessableAdded )
{
SpawnOrDestroyPuppetObjects( GetFocusedMovieSceneInstance() );
NotifyMovieSceneDataChanged();
}
return ObjectGuid;
}
示例13: GetSavedExpansionState
bool FSequencerNodeTree::GetSavedExpansionState( const FSequencerDisplayNode& Node ) const
{
UMovieScene* MovieScene = Sequencer.GetFocusedMovieScene();
FMovieSceneEditorData& EditorData = MovieScene->GetEditorData();
// Collapsed nodes are stored instead of expanded so that new nodes are expanded by default
bool bCollapsed = EditorData.CollapsedSequencerNodes.Contains( Node.GetPathName() );
return !bCollapsed;
}
示例14: SpawnActorsForMovie
void URuntimeMovieScenePlayer::SpawnActorsForMovie( TSharedRef<FMovieSceneInstance> MovieSceneInstance )
{
UWorld* WorldPtr = World.Get();
if( WorldPtr != NULL && MovieSceneBindings != NULL )
{
UMovieScene* MovieScene = MovieSceneInstance->GetMovieScene();
if( MovieScene != NULL )
{
TArray<FSpawnedActorInfo>* FoundSpawnedActors = InstanceToSpawnedActorMap.Find( MovieSceneInstance );
if( FoundSpawnedActors )
{
// Remove existing spawned actors for this movie
DestroyActorsForMovie( MovieSceneInstance );
}
TArray<FSpawnedActorInfo>& SpawnedActorList = InstanceToSpawnedActorMap.Add( MovieSceneInstance, TArray<FSpawnedActorInfo>() );
for( auto SpawnableIndex = 0; SpawnableIndex < MovieScene->GetSpawnableCount(); ++SpawnableIndex )
{
auto& Spawnable = MovieScene->GetSpawnable( SpawnableIndex );
UClass* GeneratedClass = Spawnable.GetClass();
if ( GeneratedClass != NULL )
{
const bool bIsActorBlueprint = GeneratedClass->IsChildOf( AActor::StaticClass() );
if ( bIsActorBlueprint )
{
AActor* ActorCDO = CastChecked< AActor >( GeneratedClass->ClassDefaultObject );
const FVector SpawnLocation = ActorCDO->GetRootComponent()->RelativeLocation;
const FRotator SpawnRotation = ActorCDO->GetRootComponent()->RelativeRotation;
FActorSpawnParameters SpawnInfo;
SpawnInfo.ObjectFlags = RF_NoFlags;
AActor* NewActor = WorldPtr->SpawnActor( GeneratedClass, &SpawnLocation, &SpawnRotation, SpawnInfo );
if( NewActor )
{
// Actor was spawned OK!
FSpawnedActorInfo NewInfo;
NewInfo.RuntimeGuid = Spawnable.GetGuid();
NewInfo.SpawnedActor = NewActor;
SpawnedActorList.Add( NewInfo );
}
}
}
}
}
}
}
示例15: GetFocusedMovieScene
UMovieSceneCameraCutTrack* FCameraCutTrackEditor::FindOrCreateCameraCutTrack()
{
UMovieScene* FocusedMovieScene = GetFocusedMovieScene();
UMovieSceneTrack* CameraCutTrack = FocusedMovieScene->GetCameraCutTrack();
if (CameraCutTrack == nullptr)
{
const FScopedTransaction Transaction(LOCTEXT("AddCameraCutTrack_Transaction", "Add Camera Cut Track"));
FocusedMovieScene->Modify();
CameraCutTrack = FocusedMovieScene->AddCameraCutTrack(UMovieSceneCameraCutTrack::StaticClass());
}
return CastChecked<UMovieSceneCameraCutTrack>(CameraCutTrack);
}