UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NodeMappingContainer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "UObject/Object.h"
10#include "NodeMappingContainer.generated.h"
11
12/* Node Mapping Container Class
13 * This saves source items, and target items, and mapping between
14 * Used by Retargeting, Control Rig mapping. Will need to improve interface better
15 */
16UCLASS(hidecategories = Object, ClassGroup = "Animation", BlueprintType, Experimental, MinimalAPI)
18{
20
21private:
22 UPROPERTY(VisibleAnywhere, Category = Mapping)
23 TMap<FName, FNodeItem> SourceItems;
24
25 UPROPERTY(VisibleAnywhere, Category = Mapping)
26 TMap<FName, FNodeItem> TargetItems;
27
28 UPROPERTY(EditAnywhere, Category = Mapping)
29 TMap<FName, FName> SourceToTarget;
30
31 // source asset that is used to create source
32 // should be UNodeMappingProviderInterface
33 UPROPERTY(EditAnywhere, Category = Mapping)
34 TSoftObjectPtr<UObject> SourceAsset;
35
36 // source asset that is used to create target
37 // should be UNodeMappingProviderInterface
38 UPROPERTY(EditAnywhere, Category = Mapping)
39 TSoftObjectPtr<UObject> TargetAsset;
40
41public:
42 // soft object reference
43 const TSoftObjectPtr<UObject>& GetSourceAssetSoftObjectPtr() const { return SourceAsset; }
44 const TSoftObjectPtr<UObject>& GetTargetAssetSoftObjectPtr() const { return TargetAsset; }
45
46#if WITH_EDITOR
47 ENGINE_API FString GetDisplayName() const;
48
49 // Item getters
50 const TMap<FName, FNodeItem>& GetSourceItems() const { return SourceItems; }
51 const TMap<FName, FNodeItem>& GetTargetItems() const { return TargetItems; }
52
53 // update data from assets
55
56 // Asset setters
58 ENGINE_API void SetTargetAsset(UObject* InTargetAsset);
59
60 // Asset getters
63
64 // Add/delete mapping
65 ENGINE_API void AddMapping(const FName& InSourceNode, const FName& InTargetNode);
67
68 // getting node mapping table { source, target }
69 const TMap<FName, FName>& GetNodeMappingTable() const { return SourceToTarget; }
70
71 // this just maps between source to target by name if same
72 // note this will override source setting if exists before
74
75#endif// WITH_EDITOR
76
77 // get reverse node mapping table { target, source }
78 ENGINE_API void GetTargetToSourceMappingTable(TMap<FName, FName>& OutMappingTable) const;
79
80 // return true if source name is mapped
81 bool DoesContainMapping(const FName& SourceNode) const
82 {
83 return SourceToTarget.Contains(SourceNode);
84 }
85
86 // this function is not fast, if you want to do this for every frame, cache it somewhere
88 {
89 const FName* TargetNode = SourceToTarget.Find(SourceNode);
90 if (TargetNode)
91 {
92 const FNodeItem* Target = TargetItems.Find(*TargetNode);
93 const FNodeItem* Source = SourceItems.Find(SourceNode);
94 if (Target && Source)
95 {
96 FTransform Result = Target->Transform.GetRelativeTransform(Source->Transform);
97 Result.NormalizeRotation();
98 return Result;
99 }
100 }
101
103 }
104
105private:
106#if WITH_EDITOR
107 // internal utility function set OutItems by InAsset
109 // Validate SourceToTarget mapping is still valid with SourceItems and TargetItems
110 ENGINE_API void ValidateMapping();
111#endif // WITH_EDITOR
112};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
Definition NameTypes.h:617
Definition UnrealString.h.inl:34
Definition NodeMappingContainer.h:18
FTransform GetSourceToTargetTransform(const FName &SourceNode) const
Definition NodeMappingContainer.h:87
bool DoesContainMapping(const FName &SourceNode) const
Definition NodeMappingContainer.h:81
const TSoftObjectPtr< UObject > & GetTargetAssetSoftObjectPtr() const
Definition NodeMappingContainer.h:44
const TSoftObjectPtr< UObject > & GetSourceAssetSoftObjectPtr() const
Definition NodeMappingContainer.h:43
Definition Object.h:95
Definition RobinHoodHashTable.h:18
Definition NodeMappingProviderInterface.h:14
Definition SoftObjectPtr.h:174
static CORE_API const TTransform< double > Identity
Definition TransformNonVectorized.h:58