Files
UnrealEngineUWP/Engine/Source/Editor/UnrealEd/Public/IPropertyAccessCompiler.h
thomas sarkanen 57122faf0a AnimNext params in Anim BPs
Added a new anim node: AnimNext Parameters. This injects parameters into the AnimNext stack for all leafwards nodes.

Added a new way of binding to parameters on anim nodes.
- Added indirection to UAnimGraphNode_Base to allow different 'binding types' to be authored by deriving from UAnimGraphNodeBinding
- Added new binding type for AnimNext parameters
- Moved existing binding code (inc UI widget creation) into UAnimGraphNodeBinding_Base
- Binding types can be selected on a per-node or per-anim BP basis

Reworked FParamStack API a little
- Allow for better error checking when pushing/popping stack layers. Pushed layers can now only be subsequently popped by passing in the handle of the pushed layer.
- Standalone layers are now wrapped in an opaque handle rather than returning a unique ptr
- GetParamData APIs now perform more involved type checking, allowing derived object types & type conversions to be implemented

Improved parameter type sandboxing for automated tests. If running low-level type tests while execution was happening on another thread, the editor could crash because of invalidating already-existing types.

Lots of other small fixes to get workflows nicer and end-to-end functionality working

#rb Nicholas.Frechette,Jaime.Cifuentes,Jurre.deBaare

[CL 26455905 by thomas sarkanen in ue5-main branch]
2023-07-19 04:36:34 -04:00

146 lines
4.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Containers/ArrayView.h"
#include "UObject/ObjectMacros.h"
#include "Features/IModularFeature.h"
#include "IPropertyAccessCompiler.generated.h"
class UObject;
struct FPropertyAccessLibrary;
enum class EPropertyAccessCopyType : uint8;
// DEPRECATED - The various batching of property copy
UENUM()
enum class EPropertyAccessBatchType : uint8
{
// Copies designed to be called one at a time via ProcessCopy
Unbatched,
// Copies designed to be processed in one call to ProcessCopies
Batched,
};
enum class EPropertyAccessHandleType : int32
{
Copy,
Access,
};
// Handle used to track property accesses that are being compiled
struct FPropertyAccessHandle
{
public:
// Get the internal index
int32 GetId() const { return Id; }
// Check this handle for validity
bool IsValid() const { return Id != INDEX_NONE; }
// Get the type
EPropertyAccessHandleType GetType() const { return Type; }
FPropertyAccessHandle() = default;
FPropertyAccessHandle(int32 InId, EPropertyAccessHandleType InType)
: Id(InId)
, Type(InType)
{
}
inline bool operator==(const FPropertyAccessHandle& Other) const
{
return Id == Other.Id;
}
private:
// Index used to track accesses by external systems
int32 Id = INDEX_NONE;
// The type of this access
EPropertyAccessHandleType Type = EPropertyAccessHandleType::Copy;
};
inline uint32 GetTypeHash(const FPropertyAccessHandle& Value)
{
return HashCombine(GetTypeHash(Value.GetId()), GetTypeHash(Value.GetType()));
}
// Handle used to describe property accesses that have been compiled
struct FCompiledPropertyAccessHandle
{
public:
FCompiledPropertyAccessHandle() = default;
// Get the index into the batch
int32 GetId() const { return Id; }
// Get the index of the batch
int32 GetBatchId() const { return BatchId; }
// Check this handle for validity
bool IsValid() const { return Id != INDEX_NONE; }
private:
friend class FPropertyAccessLibraryCompiler;
FCompiledPropertyAccessHandle(int32 InId, int32 InBatchId, EPropertyAccessHandleType InType)
: Id(InId)
, BatchId(InBatchId)
, Type(InType)
{
}
// Index into the batch
int32 Id = INDEX_NONE;
// Index of the batch
int32 BatchId = INDEX_NONE;
// The type of this access
EPropertyAccessHandleType Type = EPropertyAccessHandleType::Copy;
};
// A helper used to compile a property access library
class IPropertyAccessLibraryCompiler
{
public:
virtual ~IPropertyAccessLibraryCompiler() {}
// Begin compilation - reset the library to its default state
virtual void BeginCompilation() = 0;
UE_DEPRECATED(5.0, "Please use BeginCompilation without a class arg")
virtual void BeginCompilation(const UClass* InClass) {}
// Add a copy to the property access library we are compiling
// @return a handle to the pending copy. This can be resolved to a true copy index by calling GetCompiledHandle
virtual FPropertyAccessHandle AddCopy(TArrayView<FString> InSourcePath, TArrayView<FString> InDestPath, const FName& InContextId, UObject* InAssociatedObject = nullptr) = 0;
UE_DEPRECATED(5.0, "Please use AddCopy with a context ID that returns a handle")
virtual int32 AddCopy(TArrayView<FString> InSourcePath, TArrayView<FString> InDestPath, EPropertyAccessBatchType InBatchType, UObject* InAssociatedObject = nullptr)
{
FPropertyAccessHandle Handle = AddCopy(InSourcePath, InDestPath, FName(NAME_None), InAssociatedObject);
return Handle.GetId();
}
// Add an access to the property access library we are compiling
// @return a handle to the pending access. This can be resolved to a true access index by calling GetCompiledHandle
virtual FPropertyAccessHandle AddAccess(TArrayView<FString> InPath, UObject* InAssociatedObject = nullptr) = 0;
// Post-process the library to finish compilation. @return true if compilation succeeded.
virtual bool FinishCompilation() = 0;
// Iterate any errors we have with compilation
virtual void IterateErrors(TFunctionRef<void(const FText&, UObject*)> InFunction) const = 0;
// Maps the initial copy handle to a true handle, post compilation
virtual FCompiledPropertyAccessHandle GetCompiledHandle(FPropertyAccessHandle InHandle) const = 0;
// Get the access type for the specified handle
virtual EPropertyAccessCopyType GetCompiledHandleAccessType(FPropertyAccessHandle InHandle) const = 0;
};