本文整理汇总了C++中FName::SetNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ FName::SetNumber方法的具体用法?C++ FName::SetNumber怎么用?C++ FName::SetNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FName
的用法示例。
在下文中一共展示了FName::SetNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartRecordingNewComponents
void UActorRecording::StartRecordingNewComponents(ULevelSequence* CurrentSequence, float CurrentSequenceTime)
{
if (GetActorToRecord() != nullptr)
{
// find the new component(s)
TInlineComponentArray<USceneComponent*> NewComponents;
TArray<USceneComponent*> SceneComponents;
GetSceneComponents(SceneComponents);
for(USceneComponent* SceneComponent : SceneComponents)
{
if(ValidComponent(SceneComponent))
{
TWeakObjectPtr<USceneComponent> WeakSceneComponent(SceneComponent);
int32 FoundIndex = TrackedComponents.Find(WeakSceneComponent);
if(FoundIndex == INDEX_NONE)
{
// new component!
NewComponents.Add(SceneComponent);
}
}
}
ProcessNewComponentArray(NewComponents);
UMovieScene* MovieScene = CurrentSequence->GetMovieScene();
check(MovieScene);
FAnimationRecordingSettings ComponentAnimationSettings = AnimationSettings;
ComponentAnimationSettings.bRemoveRootAnimation = false;
ComponentAnimationSettings.bRecordInWorldSpace = false;
const USequenceRecorderSettings* Settings = GetDefault<USequenceRecorderSettings>();
if (!bRecordToPossessable)
{
FMovieSceneSpawnable* Spawnable = MovieScene->FindSpawnable(Guid);
check(Spawnable);
AActor* ObjectTemplate = CastChecked<AActor>(Spawnable->GetObjectTemplate());
for (USceneComponent* SceneComponent : NewComponents)
{
// new component, so we need to add this to our BP if it didn't come from SCS
FName NewName;
if (SceneComponent->CreationMethod != EComponentCreationMethod::SimpleConstructionScript)
{
// Give this component a unique name within its parent
NewName = *FString::Printf(TEXT("Dynamic%s"), *SceneComponent->GetFName().GetPlainNameString());
NewName.SetNumber(1);
while (FindObjectFast<UObject>(ObjectTemplate, NewName))
{
NewName.SetNumber(NewName.GetNumber() + 1);
}
USceneComponent* TemplateRoot = ObjectTemplate->GetRootComponent();
USceneComponent* AttachToComponent = nullptr;
// look for a similar attach parent in the current structure
USceneComponent* AttachParent = SceneComponent->GetAttachParent();
if(AttachParent != nullptr)
{
// First off, check if we're attached to a component that has already been duplicated into this object
// If so, the name lookup will fail, so we use a direct reference
if (TWeakObjectPtr<USceneComponent>* DuplicatedComponent = DuplicatedDynamicComponents.Find(AttachParent))
{
AttachToComponent = DuplicatedComponent->Get();
}
// If we don't have an attachment parent duplicated already, perform a name lookup
if (!AttachToComponent)
{
FName AttachName = SceneComponent->GetAttachParent()->GetFName();
TInlineComponentArray<USceneComponent*> AllChildren;
ObjectTemplate->GetComponents(AllChildren);
for (USceneComponent* Child : AllChildren)
{
CA_SUPPRESS(28182); // Dereferencing NULL pointer. 'Child' contains the same NULL value as 'AttachToComponent' did.
if (Child->GetFName() == AttachName)
{
AttachToComponent = Child;
break;
}
}
}
}
if (!AttachToComponent)
{
AttachToComponent = ObjectTemplate->GetRootComponent();
}
USceneComponent* NewTemplateComponent = Cast<USceneComponent>(StaticDuplicateObject(SceneComponent, ObjectTemplate, NewName, RF_AllFlags & ~RF_Transient));
NewTemplateComponent->AttachToComponent(AttachToComponent, FAttachmentTransformRules::KeepRelativeTransform, SceneComponent->GetAttachSocketName());
ObjectTemplate->AddInstanceComponent(NewTemplateComponent);
DuplicatedDynamicComponents.Add(SceneComponent, NewTemplateComponent);
}
else
//.........这里部分代码省略.........