UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DatasmithAnimationElementsImpl.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
6
7#include "Containers/Array.h"
9
10class FDatasmithLevelSequenceElementImpl : public FDatasmithElementImpl< IDatasmithLevelSequenceElement >
11{
12public:
13 explicit FDatasmithLevelSequenceElementImpl(const TCHAR* InName);
14
15 virtual const TCHAR* GetFile() const override { return *File.Get(); }
16 virtual void SetFile(const TCHAR* InFile) override { File = InFile; };
17
18 virtual FMD5Hash GetFileHash() const override { return FileHash; }
19 virtual void SetFileHash(FMD5Hash Hash) override { FileHash = Hash; }
20
21 virtual float GetFrameRate() const override { return FrameRate; }
22 virtual void SetFrameRate(float FramePerSecs) override { FrameRate = FramePerSecs; }
23
24 virtual void AddAnimation(const TSharedRef< IDatasmithBaseAnimationElement >& InAnimation) override { Animations.Add(InAnimation); }
25 virtual int32 GetAnimationsCount() const override { return Animations.Num(); }
26
31
32 virtual void RemoveAnimation(const TSharedRef< IDatasmithBaseAnimationElement >& InAnimation) override { Animations.Remove(InAnimation); }
33
34private:
36 TReflected<FMD5Hash> FileHash;
37 TReflected<float> FrameRate;
38
40};
41
42template< typename InterfaceType >
44{
45public:
70
71class FDatasmithTransformAnimationElementImpl : public FDatasmithBaseAnimationElementImpl< IDatasmithTransformAnimationElement >
72{
73public:
74 explicit FDatasmithTransformAnimationElementImpl(const TCHAR* InName);
75
76 virtual void AddFrame(EDatasmithTransformType TransformType, const FDatasmithTransformFrameInfo& FrameInfo) override { Frames[(uint8)TransformType].Add(FrameInfo); }
77 virtual int32 GetFramesCount(EDatasmithTransformType TransformType) const override { return Frames[(uint8)TransformType].Num(); }
78
79 virtual void SetCurveInterpMode(EDatasmithTransformType TransformType, EDatasmithCurveInterpMode CurveInterpMode) override
80 {
81 TransformCurveInterpMode[(uint32) TransformType] = CurveInterpMode;
82 }
83
85 {
86 return TransformCurveInterpMode[(uint32) TransformType];
87 }
88
89 virtual const FDatasmithTransformFrameInfo& GetFrame(EDatasmithTransformType TransformType, int32 Index) const override
90 {
91 return Frames[(uint8)TransformType].IsValidIndex(Index) ? Frames[(uint8)TransformType][Index] : FDatasmithTransformFrameInfo::InvalidFrameInfo;
92 }
93
94 virtual void RemoveFrame(EDatasmithTransformType TransformType, int32 Index) override
95 {
96 if (Frames[(uint8)TransformType].IsValidIndex(Index))
97 {
98 Frames[(uint8)TransformType].RemoveAt(Index);
99 }
100 }
101
103 {
104 return EnabledChannels;
105 }
106
108 {
109 EnabledChannels = Channels;
110 }
111
112private:
115 EDatasmithTransformChannels EnabledChannels;
116};
117
118class FDatasmithVisibilityAnimationElementImpl : public FDatasmithBaseAnimationElementImpl< IDatasmithVisibilityAnimationElement >
119{
120public:
121 explicit FDatasmithVisibilityAnimationElementImpl(const TCHAR* InName);
122
123 virtual void AddFrame(const FDatasmithVisibilityFrameInfo& FrameInfo) override { Frames.Add(FrameInfo); }
124 virtual int32 GetFramesCount() const override { return Frames.Num(); }
125
127 {
128 CurveInterpMode = InCurveInterpMode;
129 }
130
132 {
133 return CurveInterpMode;
134 }
135
136 virtual const FDatasmithVisibilityFrameInfo& GetFrame(int32 Index) const override
137 {
139 }
140
141 virtual void RemoveFrame(int32 Index) override
142 {
143 if (Frames.IsValidIndex(Index))
144 {
145 Frames.RemoveAt(Index);
146 }
147 }
148
149 virtual void SetPropagateToChildren(bool bInPropagate) override
150 {
151 bPropagate = bInPropagate;
152 }
153
154 virtual bool GetPropagateToChildren() const override
155 {
156 return bPropagate;
157 }
158
159private:
161 EDatasmithCurveInterpMode CurveInterpMode;
162 bool bPropagate;
163};
164
165class FDatasmithSubsequenceAnimationElementImpl : public FDatasmithBaseAnimationElementImpl< IDatasmithSubsequenceAnimationElement >
166{
167public:
168 explicit FDatasmithSubsequenceAnimationElementImpl(const TCHAR* InName);
169
170 virtual FFrameNumber GetStartTime() const override
171 {
172 return StartTime;
173 }
174
175 virtual void SetStartTime(FFrameNumber InStartTime) override
176 {
177 StartTime = InStartTime;
178 }
179
180 virtual int32 GetDuration() const override
181 {
182 return Duration;
183 }
184
185 virtual void SetDuration(int32 InDuration) override
186 {
187 Duration = InDuration;
188 }
189
190 virtual float GetTimeScale() const override
191 {
192 return TimeScale;
193 }
194
195 virtual void SetTimeScale(float InTimeScale) override
196 {
197 TimeScale = InTimeScale;
198 }
199
201 {
202 return Subsequence;
203 }
204
206 {
207 Subsequence = InSubsequence;
208 }
209
210private:
211 FFrameNumber StartTime;
212 int32 Duration;
213 float TimeScale;
215};
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EDatasmithElementType
Definition DatasmithDefinitions.h:20
EDatasmithTransformType
Definition DatasmithDefinitions.h:390
EDatasmithTransformChannels
Definition DatasmithDefinitions.h:110
EDatasmithCompletionMode
Definition DatasmithDefinitions.h:403
EDatasmithElementAnimationSubType
Definition DatasmithDefinitions.h:65
EDatasmithCurveInterpMode
Definition DatasmithTypes.h:13
@ Num
Definition MetalRHIPrivate.h:234
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition DatasmithAnimationElementsImpl.h:44
virtual bool IsSubType(const EDatasmithElementAnimationSubType AnimSubType) const override
Definition DatasmithAnimationElementsImpl.h:48
FDatasmithBaseAnimationElementImpl(const TCHAR *InName, EDatasmithElementType ChildType, EDatasmithElementAnimationSubType InSubtype=EDatasmithElementAnimationSubType::BaseAnimation)
Definition DatasmithAnimationElementsImpl.h:65
virtual void SetCompletionMode(EDatasmithCompletionMode InCompletionMode) override
Definition DatasmithAnimationElementsImpl.h:50
virtual EDatasmithCompletionMode GetCompletionMode() const override
Definition DatasmithAnimationElementsImpl.h:55
Definition DatasmithSceneElementsImpl.h:25
virtual bool IsSubTypeInternal(uint64 InSubType) const
Definition DatasmithSceneElementsImpl.h:46
Definition DatasmithAnimationElementsImpl.h:11
virtual void SetFileHash(FMD5Hash Hash) override
Definition DatasmithAnimationElementsImpl.h:19
virtual void AddAnimation(const TSharedRef< IDatasmithBaseAnimationElement > &InAnimation) override
Definition DatasmithAnimationElementsImpl.h:24
virtual void SetFile(const TCHAR *InFile) override
Definition DatasmithAnimationElementsImpl.h:16
virtual FMD5Hash GetFileHash() const override
Definition DatasmithAnimationElementsImpl.h:18
virtual const TCHAR * GetFile() const override
Definition DatasmithAnimationElementsImpl.h:15
virtual TSharedPtr< IDatasmithBaseAnimationElement > GetAnimation(int32 InIndex) override
Definition DatasmithAnimationElementsImpl.h:27
virtual void RemoveAnimation(const TSharedRef< IDatasmithBaseAnimationElement > &InAnimation) override
Definition DatasmithAnimationElementsImpl.h:32
virtual float GetFrameRate() const override
Definition DatasmithAnimationElementsImpl.h:21
virtual int32 GetAnimationsCount() const override
Definition DatasmithAnimationElementsImpl.h:25
virtual void SetFrameRate(float FramePerSecs) override
Definition DatasmithAnimationElementsImpl.h:22
Definition DatasmithAnimationElementsImpl.h:166
virtual void SetDuration(int32 InDuration) override
Definition DatasmithAnimationElementsImpl.h:185
virtual int32 GetDuration() const override
Definition DatasmithAnimationElementsImpl.h:180
virtual FFrameNumber GetStartTime() const override
Definition DatasmithAnimationElementsImpl.h:170
virtual TWeakPtr< IDatasmithLevelSequenceElement > GetSubsequence() const override
Definition DatasmithAnimationElementsImpl.h:200
virtual void SetSubsequence(TWeakPtr< IDatasmithLevelSequenceElement > InSubsequence) override
Definition DatasmithAnimationElementsImpl.h:205
virtual void SetTimeScale(float InTimeScale) override
Definition DatasmithAnimationElementsImpl.h:195
virtual void SetStartTime(FFrameNumber InStartTime) override
Definition DatasmithAnimationElementsImpl.h:175
virtual float GetTimeScale() const override
Definition DatasmithAnimationElementsImpl.h:190
Definition DatasmithAnimationElementsImpl.h:72
virtual EDatasmithCurveInterpMode GetCurveInterpMode(EDatasmithTransformType TransformType) const override
Definition DatasmithAnimationElementsImpl.h:84
virtual EDatasmithTransformChannels GetEnabledTransformChannels() const override
Definition DatasmithAnimationElementsImpl.h:102
virtual void RemoveFrame(EDatasmithTransformType TransformType, int32 Index) override
Definition DatasmithAnimationElementsImpl.h:94
virtual void SetCurveInterpMode(EDatasmithTransformType TransformType, EDatasmithCurveInterpMode CurveInterpMode) override
Definition DatasmithAnimationElementsImpl.h:79
virtual const FDatasmithTransformFrameInfo & GetFrame(EDatasmithTransformType TransformType, int32 Index) const override
Definition DatasmithAnimationElementsImpl.h:89
virtual int32 GetFramesCount(EDatasmithTransformType TransformType) const override
Definition DatasmithAnimationElementsImpl.h:77
virtual void SetEnabledTransformChannels(EDatasmithTransformChannels Channels) override
Definition DatasmithAnimationElementsImpl.h:107
virtual void AddFrame(EDatasmithTransformType TransformType, const FDatasmithTransformFrameInfo &FrameInfo) override
Definition DatasmithAnimationElementsImpl.h:76
Definition DatasmithAnimationElementsImpl.h:119
virtual bool GetPropagateToChildren() const override
Definition DatasmithAnimationElementsImpl.h:154
virtual void RemoveFrame(int32 Index) override
Definition DatasmithAnimationElementsImpl.h:141
virtual void SetPropagateToChildren(bool bInPropagate) override
Definition DatasmithAnimationElementsImpl.h:149
virtual const FDatasmithVisibilityFrameInfo & GetFrame(int32 Index) const override
Definition DatasmithAnimationElementsImpl.h:136
virtual EDatasmithCurveInterpMode GetCurveInterpMode() const override
Definition DatasmithAnimationElementsImpl.h:131
virtual int32 GetFramesCount() const override
Definition DatasmithAnimationElementsImpl.h:124
virtual void SetCurveInterpMode(EDatasmithCurveInterpMode InCurveInterpMode) override
Definition DatasmithAnimationElementsImpl.h:126
virtual void AddFrame(const FDatasmithVisibilityFrameInfo &FrameInfo) override
Definition DatasmithAnimationElementsImpl.h:123
Definition Array.h:670
SizeType Remove(const ElementType &Item)
Definition Array.h:3091
UE_REWRITE SizeType Num() const
Definition Array.h:1144
void RemoveAt(SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2083
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
UE_NODEBUG UE_FORCEINLINE_HINT bool IsValidIndex(SizeType Index) const
Definition Array.h:1122
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition SharedPointer.h:1295
U16 Index
Definition radfft.cpp:71
Definition DatasmithTypes.h:94
static UE_API FDatasmithTransformFrameInfo InvalidFrameInfo
Definition DatasmithTypes.h:129
Definition DatasmithTypes.h:136
static UE_API FDatasmithVisibilityFrameInfo InvalidFrameInfo
Definition DatasmithTypes.h:148
Definition FrameNumber.h:18
Definition SecureHash.h:133