You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Having only one Append overload with a single argument makes for clearer error messages. Otherwise, a failure to match Append(CharRangeType) leads to an error that ArgType cannot be converted to CharType. #rb Zousar.Shaker #preflight 61d72f3f6511bc498e54c250 #ROBOMERGE-OWNER: devin.doucette #ROBOMERGE-AUTHOR: devin.doucette #ROBOMERGE-SOURCE: CL 18533638 in //UE5/Release-5.0/... via CL 18534325 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669) [CL 18534364 by devin doucette in ue5-release-engine-test branch]
96 lines
2.6 KiB
C++
96 lines
2.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "MovieSceneSpawnable.h"
|
|
#include "UObject/UObjectAnnotation.h"
|
|
#include "MovieSceneSequence.h"
|
|
#include "MovieScene.h"
|
|
#include "IMovieScenePlayer.h"
|
|
#include "Misc/StringBuilder.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "Components/StaticMeshComponent.h"
|
|
|
|
struct FIsSpawnable
|
|
{
|
|
FIsSpawnable() : bIsSpawnable(false) {}
|
|
explicit FIsSpawnable(bool bInIsSpawnable) : bIsSpawnable(bInIsSpawnable) {}
|
|
|
|
bool IsDefault() const { return !bIsSpawnable; }
|
|
|
|
bool bIsSpawnable;
|
|
};
|
|
|
|
static FUObjectAnnotationSparse<FIsSpawnable,true> SpawnablesAnnotation;
|
|
|
|
bool FMovieSceneSpawnable::IsSpawnableTemplate(const UObject& InObject)
|
|
{
|
|
return !SpawnablesAnnotation.GetAnnotation(&InObject).IsDefault();
|
|
}
|
|
|
|
void FMovieSceneSpawnable::MarkSpawnableTemplate(const UObject& InObject)
|
|
{
|
|
SpawnablesAnnotation.AddAnnotation(&InObject, FIsSpawnable(true));
|
|
}
|
|
|
|
void FMovieSceneSpawnable::CopyObjectTemplate(UObject& InSourceObject, UMovieSceneSequence& MovieSceneSequence)
|
|
{
|
|
const FName ObjectName = ObjectTemplate ? ObjectTemplate->GetFName() : InSourceObject.GetFName();
|
|
|
|
if (ObjectTemplate)
|
|
{
|
|
ObjectTemplate->Rename(*MakeUniqueObjectName(MovieSceneSequence.GetMovieScene(), ObjectTemplate->GetClass(), "ExpiredSpawnable").ToString());
|
|
ObjectTemplate->MarkAsGarbage();
|
|
ObjectTemplate = nullptr;
|
|
}
|
|
|
|
ObjectTemplate = MovieSceneSequence.MakeSpawnableTemplateFromInstance(InSourceObject, ObjectName);
|
|
|
|
check(ObjectTemplate);
|
|
|
|
MarkSpawnableTemplate(*ObjectTemplate);
|
|
MovieSceneSequence.MarkPackageDirty();
|
|
}
|
|
|
|
FName FMovieSceneSpawnable::GetNetAddressableName(IMovieScenePlayer& Player, FMovieSceneSequenceID SequenceID) const
|
|
{
|
|
UObject* PlayerObject = Player.AsUObject();
|
|
if (!PlayerObject)
|
|
{
|
|
return NAME_None;
|
|
}
|
|
|
|
TStringBuilder<128> AddressableName;
|
|
|
|
// Spawnable name
|
|
AddressableName.Append(*Name, Name.Len());
|
|
|
|
// SequenceID
|
|
AddressableName.Appendf(TEXT("_0x%08X"), SequenceID.GetInternalValue());
|
|
|
|
// Spawnable GUID
|
|
AddressableName.Appendf(TEXT("_%08X%08X%08X%08X"), Guid.A, Guid.B, Guid.C, Guid.D);
|
|
|
|
// Actor / player Name
|
|
if (AActor* OuterActor = PlayerObject->GetTypedOuter<AActor>())
|
|
{
|
|
AddressableName.AppendChar(TEXT('_'));
|
|
OuterActor->GetFName().AppendString(AddressableName);
|
|
}
|
|
else
|
|
{
|
|
AddressableName.AppendChar(TEXT('_'));
|
|
PlayerObject->GetFName().AppendString(AddressableName);
|
|
}
|
|
|
|
return FName(AddressableName.Len(), AddressableName.GetData());
|
|
}
|
|
|
|
void FMovieSceneSpawnable::AutoSetNetAddressableName()
|
|
{
|
|
bNetAddressableName = false;
|
|
|
|
AActor* Actor = Cast<AActor>(ObjectTemplate);
|
|
if (Actor && Actor->FindComponentByClass<UStaticMeshComponent>() != nullptr)
|
|
{
|
|
bNetAddressableName = true;
|
|
}
|
|
} |