Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Private/AnimBlueprintExtension_BlendSpaceGraph.cpp
thomas sarkanen fe48b98e94 Fixed null blendspaces being referenced by child anim BPs that use blendspace graphs
Ensure that RF_Public is set so that external packages (like child BPs) can access the sub-object

#jira UE-135892 - Crash after adding child blueprint class of parent Animation BP class
#rb Jurre.deBaare
#preflight 619f9c3bb55894aa746b6c4b

#ROBOMERGE-AUTHOR: thomas.sarkanen
#ROBOMERGE-SOURCE: CL 18294806 in //UE5/Release-5.0/... via CL 18294808
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18294815 by thomas sarkanen in ue5-release-engine-test branch]
2021-11-25 10:44:14 -05:00

22 lines
866 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimBlueprintExtension_BlendSpaceGraph.h"
#include "Animation/BlendSpace.h"
void UAnimBlueprintExtension_BlendSpaceGraph::HandleStartCompilingClass(const UClass* InClass, IAnimBlueprintCompilationBracketContext& InCompilationContext, IAnimBlueprintGeneratedClassCompiledData& OutCompiledData)
{
Subsystem.BlendSpaces.Empty();
Class = const_cast<UClass*>(InClass);
}
UBlendSpace* UAnimBlueprintExtension_BlendSpaceGraph::AddBlendSpace(UBlendSpace* InSourceBlendSpace)
{
UBlendSpace* CopiedBlendSpace = DuplicateObject(InSourceBlendSpace, Class);
CopiedBlendSpace->ClearFlags(RF_Transient);
// RF_Public is required because this blendspace may need to be referenced in child classes
CopiedBlendSpace->SetFlags(RF_Public);
Subsystem.BlendSpaces.Add(CopiedBlendSpace);
return CopiedBlendSpace;
}