Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Private/AnimBlueprintCompilerHandlerCollection.cpp
Thomas Sarkanen 8b3709fb28 Restricted anim BP compiler subsystem APIs
Removed direct access to currently compiling BP class to restrict unguarded mutation.
Const-corrected various accessors and overrides.
Moved UObject-based compiler subsystems to 'handlers' and removed UObject dependency.
Moved from set of virtual functions on subsystems/handlers to a restricted set of contexts passed to specific multicast delegates that handlers subscribe to.
Removed anim class subsystems.
Moved property access code to engine module (editor code is still in a plugin).
Fixed nativized builds where anim BPs have nativized/non-nativized classes in the hierarchy

#rb Dan.OConnor
#jira none

[CL 14278258 by Thomas Sarkanen in ue5-main branch]
2020-09-09 08:32:25 -04:00

38 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimBlueprintCompilerHandlerCollection.h"
#include "AnimBlueprintCompilerCreationContext.h"
/** All of our registered handler factories */
static TMap<FName, TFunction<TUniquePtr<IAnimBlueprintCompilerHandler>(IAnimBlueprintCompilerCreationContext&)>> HandlerFactories;
void IAnimBlueprintCompilerHandlerCollection::RegisterHandler(FName InName, TFunction<TUniquePtr<IAnimBlueprintCompilerHandler>(IAnimBlueprintCompilerCreationContext&)> InFunction)
{
HandlerFactories.Add(InName, InFunction);
}
void IAnimBlueprintCompilerHandlerCollection::UnregisterHandler(FName InName)
{
HandlerFactories.Remove(InName);
}
void FAnimBlueprintCompilerHandlerCollection::Initialize(FAnimBlueprintCompilerContext* InCompilerContext)
{
FAnimBlueprintCompilerCreationContext CreationContext(InCompilerContext);
// Create all of the registered handlers
for(const TPair<FName, TFunction<TUniquePtr<IAnimBlueprintCompilerHandler>(IAnimBlueprintCompilerCreationContext&)>>& HandlerFactoryPair : HandlerFactories)
{
Handlers.Add(HandlerFactoryPair.Key, HandlerFactoryPair.Value(CreationContext));
}
}
IAnimBlueprintCompilerHandler* FAnimBlueprintCompilerHandlerCollection::GetHandlerByName(FName InName) const
{
if(const TUniquePtr<IAnimBlueprintCompilerHandler>* FoundHandler = Handlers.Find(InName))
{
return (*FoundHandler).Get();
}
return nullptr;
}