本文整理汇总了C++中UMovieScene::GetSpawnableCount方法的典型用法代码示例。如果您正苦于以下问题:C++ UMovieScene::GetSpawnableCount方法的具体用法?C++ UMovieScene::GetSpawnableCount怎么用?C++ UMovieScene::GetSpawnableCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMovieScene
的用法示例。
在下文中一共展示了UMovieScene::GetSpawnableCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
示例2: 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 );
}
}
}
}
}
}
}
示例3: SpawnOrDestroyObjectsForInstance
void FSequencerActorBindingManager::SpawnOrDestroyObjectsForInstance( TSharedRef<FMovieSceneInstance> MovieSceneInstance, const bool bDestroyAll )
{
bool bAnyLevelActorsChanged = false;
// Get the list of puppet objects for the movie scene
TArray< TSharedRef<FPuppetActorInfo> >& PuppetObjects = InstanceToPuppetObjectsMap.FindOrAdd( MovieSceneInstance );
UMovieScene* MovieScene = MovieSceneInstance->GetMovieScene();
// Remove any puppet objects that we no longer need
{
for( auto PuppetObjectIndex = 0; PuppetObjectIndex < PuppetObjects.Num(); ++PuppetObjectIndex )
{
if( PuppetObjects[ PuppetObjectIndex ]->GetType() == EPuppetObjectType::Actor )
{
TSharedRef< FPuppetActorInfo > PuppetActorInfo = StaticCastSharedRef< FPuppetActorInfo >( PuppetObjects[ PuppetObjectIndex ] );
// Figure out if we still need this puppet actor
bool bShouldDestroyActor = true;
if( !bDestroyAll )
{
for( auto SpawnableIndex = 0; SpawnableIndex < MovieScene->GetSpawnableCount(); ++SpawnableIndex )
{
auto& Spawnable = MovieScene->GetSpawnable( SpawnableIndex );
if( Spawnable.GetGuid() == PuppetActorInfo->SpawnableGuid )
{
bShouldDestroyActor = false;
break;
}
}
}
if( bShouldDestroyActor )
{
AActor* PuppetActor = PuppetActorInfo->PuppetActor.Get();
if( PuppetActor != NULL )
{
UWorld* PuppetWorld = PuppetActor->GetWorld();
if( ensure( PuppetWorld != NULL ) )
{
// Destroy this actor
{
// Ignored unless called while game is running
const bool bNetForce = false;
// We don't want to dirty the level for puppet actor changes
const bool bShouldModifyLevel = false;
if( !bAnyLevelActorsChanged )
{
DeselectAllPuppetObjects();
}
// Actor should never be selected in the editor at this point. We took care of that up above.
ensure( !PuppetActor->IsSelected() );
const bool bWasDestroyed = PuppetWorld->DestroyActor( PuppetActor, bNetForce, bShouldModifyLevel );
if( bWasDestroyed )
{
bAnyLevelActorsChanged = true;
PuppetObjects.RemoveAt( PuppetObjectIndex-- );
}
else
{
// @todo sequencer: At least one puppet couldn't be cleaned up!
}
}
}
}
else
{
// Actor is no longer valid (probably the world was destroyed)
}
}
}
else
{
check(0); // Unhandled type
}
}
}
if( !bDestroyAll )
{
for( auto SpawnableIndex = 0; SpawnableIndex < MovieScene->GetSpawnableCount(); ++SpawnableIndex )
{
FMovieSceneSpawnable& Spawnable = MovieScene->GetSpawnable( SpawnableIndex );
// Must have a valid world for us to be able to do this
if( ActorWorld != NULL )
{
// Do we already have a puppet for this spawnable?
bool bIsAlreadySpawned = false;
for( auto PuppetIndex = 0; PuppetIndex < PuppetObjects.Num(); ++PuppetIndex )
{
auto& PuppetObject = PuppetObjects[ PuppetIndex ];
if( PuppetObject->SpawnableGuid == Spawnable.GetGuid() )
{
bIsAlreadySpawned = true;
//.........这里部分代码省略.........