Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Public/AnimGraphNode_AssetPlayerBase.h
Thomas Sarkanen d9c2b172f7 Skeleton compatibility improvements
Skeleton compatibility is now bi-directional. Specifying a compatible skeleton A -> B now implies B -> A.
Skeleton compatibility is now an editor-only concern. The runtime will attempt to do the 'best it can' via name -> name mappings. Only the editor will prevent assigning incompatible skeletons in (e.g.) asset pickers etc.
Skeleton compatibility checks in editor can now be disabled in the editor preferences (and each asset picker now has a checkbox option in its view settings that allows for quick access to this).

Moves FSkeletonRemapping to its own file (which is now private).
Skeleton remappings are now generated on demand on worker threads just before animation decompression and stored in a registry, guarded by FRWScopeLock for thread-safety.

Fixed some anim BP compiler edge cases where asset references on pins were not getting preloaded correctly, causing skeletons to be erroneously reported as missing.

Exposed the current asset registry filter in SAssetView so that menu extensions can access it (and use it to provide context)

#jira UE-166054
#jira UE-167355
#rb Jurre.deBaare,John.vanderBerg
#preflight 635902602e6690262afa86f9

[CL 22878911 by Thomas Sarkanen in ue5-main branch]
2022-11-01 06:25:59 -04:00

78 lines
4.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Animation/AnimationAsset.h"
#include "AnimGraphNode_Base.h"
#include "EdGraph/EdGraphNodeUtils.h"
#include "AnimGraphNode_AssetPlayerBase.generated.h"
/** Get the default anim node class for playing a particular asset */
ANIMGRAPH_API UClass* GetNodeClassForAsset(const UClass* AssetClass);
/** See if a particular anim NodeClass can play a particular anim AssetClass */
ANIMGRAPH_API bool SupportNodeClassForAsset(const UClass* AssetClass, UClass* NodeClass);
/** Helper / intermediate for asset player graphical nodes */
UCLASS(Abstract)
class ANIMGRAPH_API UAnimGraphNode_AssetPlayerBase : public UAnimGraphNode_Base
{
GENERATED_BODY()
public:
// Deprecated - sync group data is held on the contained FAnimNode_Base
UPROPERTY()
FAnimationGroupReference SyncGroup_DEPRECATED;
/** UObject interface */
void Serialize(FArchive& Ar) override;
void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
/** UEdGraphNode interface */
virtual void PinConnectionListChanged(UEdGraphPin* Pin) override;
virtual void PinDefaultValueChanged(UEdGraphPin* Pin) override;
virtual FText GetTooltipText() const override;
/** UK2Node interface */
virtual bool IsActionFilteredOut(class FBlueprintActionFilter const& Filter) override;
/** UAnimGraphNode_Base interface */
virtual void OnProcessDuringCompilation(IAnimBlueprintCompilationContext& InCompilationContext, IAnimBlueprintGeneratedClassCompiledData& OutCompiledData) override;
virtual void GetOutputLinkAttributes(FNodeAttributeArray& OutAttributes) const override;
virtual void ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog) override;
virtual void SetAnimationAsset(UAnimationAsset* Asset) { check(false); /*Base function called*/ }
// Override this to copy any relevant settings from the animation asset used when creating a node with a drag/drop operation
virtual void CopySettingsFromAnimationAsset(UAnimationAsset* Asset) {}
// Helper function to gather menu actions from specific asset types supported by this node
static void GetMenuActionsHelper(
FBlueprintActionDatabaseRegistrar& InActionRegistrar,
TSubclassOf<UAnimGraphNode_Base> InNodeClass,
const TArray<TSubclassOf<UObject>>& InAssetTypes,
const TArray<TSubclassOf<UObject>>& InExcludedAssetTypes,
const TFunctionRef<FText(const FAssetData&, UClass*)>& InMenuNameFunction,
const TFunctionRef<FText(const FAssetData&, UClass*)>& InMenuTooltipFunction,
const TFunction<void(UEdGraphNode*, bool, const FAssetData)>& InSetupNewNodeFromAssetFunction,
const TFunction<void(UEdGraphNode*, bool, TSubclassOf<UObject>)>& InSetupNewNodeFromClassFunction = nullptr,
const TFunction<FText(const FAssetData&)>& InMenuCategoryFunction = nullptr);
// Helper function to validate player nodes
void ValidateAnimNodeDuringCompilationHelper(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog, UAnimationAsset* InAsset, TSubclassOf<UAnimationAsset> InAssetType, UEdGraphPin* InExposedPin, FName InPropertyName);
// Helper function to preload required assets (including those referenced on pins)
void PreloadRequiredAssetsHelper(UAnimationAsset* InAsset, UEdGraphPin* InExposedPin);
protected:
// Helper functions to build a title for an asset player node
FText GetNodeTitleHelper(ENodeTitleType::Type InTitleType, UEdGraphPin* InAssetPin, const FText& InAssetDesc, const TFunction<FText(UAnimationAsset*)> InPostFixFunctionRef = nullptr) const;
FText GetNodeTitleForAsset(ENodeTitleType::Type InTitleType, UAnimationAsset* InAsset, const FText& InAssetDesc, const TFunction<FText(UAnimationAsset*)> InPostFixFunctionRef = nullptr) const;
// Default setup function that can be used with GetMenuActionsHalper
static void SetupNewNode(UEdGraphNode* InNewNode, bool bInIsTemplateNode, const FAssetData InAssetData);
/** Used for filtering in the Blueprint context menu when the sequence asset this node uses is unloaded */
FString UnloadedSkeletonName;
};