You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb: none #fyi: Laurent.Delayen, Thomas.Sarkanen [CL 11088765 by Lina Halper in Main branch]
77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "UObject/Interface.h"
|
|
#include "AnimationDataSource.generated.h"
|
|
|
|
UCLASS()
|
|
class ANIMATIONCORE_API UAnimationDataSourceRegistry : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
/**
|
|
* Registers a new data source under a given name.
|
|
* Returns false in case the data source has already been registered.
|
|
*
|
|
* @param InName The name to register the data source under
|
|
* @param InDataSource The data source to register
|
|
* @return true if succeeded
|
|
*/
|
|
bool RegisterDataSource(const FName& InName, UObject* InDataSource);
|
|
|
|
/**
|
|
* Unregisters / removes an existing data source under a given name.
|
|
* Returns false in case the data source has already been unregistered.
|
|
*
|
|
* @param InName The name of the data source to remove
|
|
* @return true if succeeded
|
|
*/
|
|
bool UnregisterDataSource(const FName& InName);
|
|
|
|
/**
|
|
* Returns true if this registry contains a source with the given name
|
|
*
|
|
* @param InName The name of the data source to look up.
|
|
* @return true if a source with the given name exists
|
|
*/
|
|
bool ContainsSource(const FName& InName) const;
|
|
|
|
/**
|
|
* Returns a given data source and cast it to the expected class.
|
|
*
|
|
* @param InName The name of the data source to look up.
|
|
* @param InExpectedClass The class expected from the data source
|
|
* @return The requested data source
|
|
*/
|
|
UObject* RequestSource(const FName& InName, UClass* InExpectedClass) const;
|
|
|
|
/**
|
|
* Returns a given data source and cast it to the expected class.
|
|
*
|
|
* @param InName The name of the data source to look up.
|
|
* @return The requested data source
|
|
*/
|
|
template<class T>
|
|
T* RequestSource(const FName& InName) const
|
|
{
|
|
UObject* DataSource = RequestSource(InName, T::StaticClass());
|
|
if (DataSource == nullptr)
|
|
{
|
|
return nullptr;
|
|
}
|
|
return Cast<T>(DataSource);
|
|
}
|
|
|
|
private:
|
|
|
|
UPROPERTY(transient)
|
|
TMap<FName, TWeakObjectPtr<UObject>> DataSources;
|
|
|
|
/** Clear Invalid Data Sources that are GC-ed */
|
|
void ClearInvalidDataSource();
|
|
}; |