Space Plunder
Loading...
Searching...
No Matches
UCurveExtractor Class Reference

#include <CurveExtractor.h>

Inheritance diagram for UCurveExtractor:

Public Member Functions

virtual void OnApply_Implementation (UAnimSequence *AnimationSequence) override
 
virtual void OnRevert_Implementation (UAnimSequence *AnimationSequence) override
 
void SaveCurve (UPackage *Package, UCurveVector *Curve, const FString &PackagePath)
 

Public Attributes

FName BoneName
 
FName AnimName
 
FString WeaponName
 
float SampleRate = 30.f
 
bool bNormalize = true
 
bool bAddToAnimation = false
 
UAnimSequence * RefAnimation = nullptr
 
FName CurveName
 

Private Member Functions

FTransform ExtractPose (UAnimSequence *Animation, const FBoneContainer &BoneContainer, FCompactPoseBoneIndex CompactPoseBoneIndex, double Time)
 
float NormalizeValue (float Value, float MaxValue) const
 
void ExtractCurveAssets (UAnimSequence *AnimationSequence)
 
void ExtractAnimCurves (UAnimSequence *AnimationSequence)
 
void AddCurveKey (TArray< FRichCurveKey > &Keys, float Time, float Value)
 
void AddCurve (UAnimSequence *Animation, FName Name, const TArray< FRichCurveKey > &Keys)
 
void RemoveCurve (UAnimSequence *Animation, FName Name)
 
FName GetCurveName (FString Type, FString Axis) const
 

Member Function Documentation

◆ AddCurve()

void UCurveExtractor::AddCurve ( UAnimSequence * Animation,
FName Name,
const TArray< FRichCurveKey > & Keys )
private
28{
29 IAnimationDataController& Controller = Animation->GetController();
30 const FAnimationCurveIdentifier CurveId = UAnimationCurveIdentifierExtensions::GetCurveIdentifier(
31 Animation->GetSkeleton(), Name, ERawCurveTrackTypes::RCT_Float);
32
33 if(!Keys.Num())
34 {
35 return;
36 }
37
38 // Override the curve if exists
39 if(!Controller.SetCurveKeys(CurveId, Keys))
40 {
41 Controller.AddCurve(CurveId);
42 Controller.SetCurveKeys(CurveId, Keys);
43 }
44}

◆ AddCurveKey()

void UCurveExtractor::AddCurveKey ( TArray< FRichCurveKey > & Keys,
float Time,
float Value )
private
21{
22 FRichCurveKey& Key = Keys.AddDefaulted_GetRef();
23 Key.Time = Time;
24 Key.Value = Value;
25}

◆ ExtractAnimCurves()

void UCurveExtractor::ExtractAnimCurves ( UAnimSequence * AnimationSequence)
private

Remapping to [0;1]

61{
62 if (!AnimationSequence || !RefAnimation)
63 {
64 UE_LOG(LogAnimation, Error, TEXT("CurveExtractor failed. Reason: Invalid Animation"));
65 return;
66 }
67
68 USkeleton* Skeleton = AnimationSequence->GetSkeleton();
69 if (!Skeleton)
70 {
71 UE_LOG(LogAnimation, Error,
72 TEXT("CurveExtractor failed. Reason: Animation with invalid Skeleton. Animation: %s"),
73 *GetNameSafe(AnimationSequence));
74 return;
75 }
76
77 if (!RefAnimation->GetSkeleton() || RefAnimation->GetSkeleton() != Skeleton)
78 {
79 UE_LOG(LogAnimation, Error,
80 TEXT("CurveExtractor failed. Reason: Animation with invalid Skeleton. Animation: %s"),
81 *GetNameSafe(RefAnimation));
82 return;
83 }
84
85 const int32 BoneIndex = Skeleton->GetReferenceSkeleton().FindBoneIndex(BoneName);
86 if (BoneIndex == INDEX_NONE)
87 {
88 UE_LOG(LogAnimation, Error,
89 TEXT("CurveExtractor failed. Reason: Invalid Bone Index. BoneName: %s Animation: %s Skeleton: %s"),
90 *BoneName.ToString(), *GetNameSafe(AnimationSequence), *GetNameSafe(Skeleton));
91 return;
92 }
93
94 if (RefAnimation->GetSkeleton()->GetReferenceSkeleton().FindBoneIndex(BoneName) == INDEX_NONE)
95 {
96 UE_LOG(LogAnimation, Error,
97 TEXT("CurveExtractor failed. Reason: Invalid Bone Index. BoneName: %s Animation: %s Skeleton: %s"),
98 *BoneName.ToString(), *GetNameSafe(RefAnimation), *GetNameSafe(RefAnimation->GetSkeleton()));
99 return;
100 }
101
102 FMemMark Mark(FMemStack::Get());
103
104 TArray<FBoneIndexType> RequiredBones;
105 RequiredBones.Add(BoneIndex);
106 Skeleton->GetReferenceSkeleton().EnsureParentsExistAndSort(RequiredBones);
107
108 FBoneContainer BoneContainer(RequiredBones, false, *Skeleton);
109 const FCompactPoseBoneIndex CompactPoseBoneIndex = BoneContainer.
110 MakeCompactPoseIndex(FMeshPoseBoneIndex(BoneIndex));
111
112 const float AnimLength = AnimationSequence->GetPlayLength();
113 const float SampleInterval = 1.f / SampleRate;
114
115 float Time = 0.f;
116 int32 SampleIndex = 0;
117
118 FTransform RefPose = ExtractPose(RefAnimation ? RefAnimation : AnimationSequence, BoneContainer,
119 CompactPoseBoneIndex, 0.f);
120 TArray<FTransform> BonePoses;
121
122 FVector MaxLoc = FVector::ZeroVector;
123 FRotator MaxRot = FRotator::ZeroRotator;
124
125 TArray<FRichCurveKey> CurveTX;
126 TArray<FRichCurveKey> CurveTY;
127 TArray<FRichCurveKey> CurveTZ;
128 TArray<FRichCurveKey> CurveRX;
129 TArray<FRichCurveKey> CurveRY;
130 TArray<FRichCurveKey> CurveRZ;
131
132 while (Time < AnimLength)
133 {
134 Time = FMath::Clamp(SampleIndex * SampleInterval, 0.f, AnimLength);
135 SampleIndex++;
136
137 FTransform CurrentPose = ExtractPose(AnimationSequence, BoneContainer, CompactPoseBoneIndex, Time);
138 FTransform DeltaPose;
139
140 DeltaPose.SetLocation(CurrentPose.GetLocation() - RefPose.GetLocation());
141 DeltaPose.SetRotation(CurrentPose.GetRotation() * RefPose.GetRotation().Inverse());
142 DeltaPose.NormalizeRotation();
143
144 if(bNormalize)
145 {
146 if (FMath::Abs(DeltaPose.GetLocation().X) > FMath::Abs(MaxLoc.X))
147 {
148 MaxLoc.X = FMath::Abs(DeltaPose.GetLocation().X);
149 }
150
151 if (FMath::Abs(DeltaPose.GetLocation().Y) > FMath::Abs(MaxLoc.Y))
152 {
153 MaxLoc.Y = FMath::Abs(DeltaPose.GetLocation().Y);
154 }
155
156 if (FMath::Abs(DeltaPose.GetLocation().Z) > FMath::Abs(MaxLoc.Z))
157 {
158 MaxLoc.Z = FMath::Abs(DeltaPose.GetLocation().Z);
159 }
160
161 if (FMath::Abs(DeltaPose.Rotator().Pitch) > FMath::Abs(MaxRot.Pitch))
162 {
163 MaxRot.Pitch = FMath::Abs(DeltaPose.Rotator().Pitch);
164 }
165
166 if (FMath::Abs(DeltaPose.Rotator().Yaw) > FMath::Abs(MaxRot.Yaw))
167 {
168 MaxRot.Yaw = FMath::Abs(DeltaPose.Rotator().Yaw);
169 }
170
171 if (FMath::Abs(DeltaPose.Rotator().Roll) > FMath::Abs(MaxRot.Roll))
172 {
173 MaxRot.Roll = FMath::Abs(DeltaPose.Rotator().Roll);
174 }
175
176 BonePoses.Add(DeltaPose);
177
178 AddCurveKey(CurveTX, Time, 0.f);
179 AddCurveKey(CurveTY, Time, 0.f);
180 AddCurveKey(CurveTZ, Time, 0.f);
181
182 AddCurveKey(CurveRX, Time, 0.f);
183 AddCurveKey(CurveRY, Time, 0.f);
184 AddCurveKey(CurveRZ, Time, 0.f);
185
186 continue;
187 }
188
189 AddCurveKey(CurveTX, Time, DeltaPose.GetLocation().X);
190 AddCurveKey(CurveTY, Time, DeltaPose.GetLocation().Y);
191 AddCurveKey(CurveTZ, Time, DeltaPose.GetLocation().Z);
192
193 AddCurveKey(CurveRX, Time, DeltaPose.Rotator().Roll);
194 AddCurveKey(CurveRY, Time, DeltaPose.Rotator().Pitch);
195 AddCurveKey(CurveRZ, Time, DeltaPose.Rotator().Yaw);
196 }
197
198 if(bNormalize)
199 {
200
201 for (int i = 0; i < BonePoses.Num(); i++)
202 {
203 FVector NormalizedVector;
204 NormalizedVector.X = NormalizeValue(BonePoses[i].GetLocation().X, MaxLoc.X);
205 NormalizedVector.Y = NormalizeValue(BonePoses[i].GetLocation().Y, MaxLoc.Y);
206 NormalizedVector.Z = NormalizeValue(BonePoses[i].GetLocation().Z, MaxLoc.Z);
207
208 FRotator NormalizedRotator;
209 NormalizedRotator.Pitch = NormalizeValue(BonePoses[i].Rotator().Pitch, MaxRot.Pitch);
210 NormalizedRotator.Yaw = NormalizeValue(BonePoses[i].Rotator().Yaw, MaxRot.Yaw);
211 NormalizedRotator.Roll = NormalizeValue(BonePoses[i].Rotator().Roll, MaxRot.Roll);
212
213 BonePoses[i] = FTransform(NormalizedRotator, NormalizedVector);
214 }
215
216 for (int i = 0; i < CurveTX.Num(); i++)
217 {
218 CurveTX[i].Value = BonePoses[i].GetLocation().X;
219 CurveTY[i].Value = BonePoses[i].GetLocation().Y;
220 CurveTZ[i].Value = BonePoses[i].GetLocation().Z;
221
222 CurveRX[i].Value = BonePoses[i].Rotator().Roll;
223 CurveRY[i].Value = BonePoses[i].Rotator().Pitch;
224 CurveRZ[i].Value = BonePoses[i].Rotator().Yaw;
225 }
226 }
227
228 AddCurve(AnimationSequence, GetCurveName(TEXT("T"), TEXT("X")), CurveTX);
229 AddCurve(AnimationSequence, GetCurveName(TEXT("T"), TEXT("Y")), CurveTY);
230 AddCurve(AnimationSequence, GetCurveName(TEXT("T"), TEXT("Z")), CurveTZ);
231
232 AddCurve(AnimationSequence, GetCurveName(TEXT("R"), TEXT("R")), CurveRX);
233 AddCurve(AnimationSequence, GetCurveName(TEXT("R"), TEXT("P")), CurveRY);
234 AddCurve(AnimationSequence, GetCurveName(TEXT("R"), TEXT("Y")), CurveRZ);
235}
FName GetCurveName(FString Type, FString Axis) const
Definition CurveExtractor.cpp:55
float SampleRate
Definition CurveExtractor.h:34
float NormalizeValue(float Value, float MaxValue) const
Definition CurveExtractor.cpp:10
bool bNormalize
Definition CurveExtractor.h:37
FTransform ExtractPose(UAnimSequence *Animation, const FBoneContainer &BoneContainer, FCompactPoseBoneIndex CompactPoseBoneIndex, double Time)
Definition CurveExtractor.cpp:432
void AddCurve(UAnimSequence *Animation, FName Name, const TArray< FRichCurveKey > &Keys)
Definition CurveExtractor.cpp:27
void AddCurveKey(TArray< FRichCurveKey > &Keys, float Time, float Value)
Definition CurveExtractor.cpp:20
FName BoneName
Definition CurveExtractor.h:23
UAnimSequence * RefAnimation
Definition CurveExtractor.h:43

◆ ExtractCurveAssets()

void UCurveExtractor::ExtractCurveAssets ( UAnimSequence * AnimationSequence)
private

Filling poses array with additive data

Remapping to [0;1]

238{
239 if (AnimationSequence == nullptr)
240 {
241 UE_LOG(LogAnimation, Error, TEXT("CurveExtractor failed. Reason: Invalid Animation"));
242 return;
243 }
244
245 USkeleton* Skeleton = AnimationSequence->GetSkeleton();
246 if (Skeleton == nullptr)
247 {
248 UE_LOG(LogAnimation, Error,
249 TEXT("CurveExtractor failed. Reason: Animation with invalid Skeleton. Animation: %s"),
250 *GetNameSafe(AnimationSequence));
251 return;
252 }
253
254 const int32 BoneIndex = Skeleton->GetReferenceSkeleton().FindBoneIndex(BoneName);
255 if (BoneIndex == INDEX_NONE)
256 {
257 UE_LOG(LogAnimation, Error,
258 TEXT("CurveExtractor failed. Reason: Invalid Bone Index. BoneName: %s Animation: %s Skeleton: %s"),
259 *BoneName.ToString(), *GetNameSafe(AnimationSequence), *GetNameSafe(Skeleton));
260 return;
261 }
262
263 FMemMark Mark(FMemStack::Get());
264
265 TArray<FBoneIndexType> RequiredBones;
266 RequiredBones.Add(BoneIndex);
267 Skeleton->GetReferenceSkeleton().EnsureParentsExistAndSort(RequiredBones);
268
269 FBoneContainer BoneContainer(RequiredBones, false, *Skeleton);
270 const FCompactPoseBoneIndex CompactPoseBoneIndex = BoneContainer.
271 MakeCompactPoseIndex(FMeshPoseBoneIndex(BoneIndex));
272
273 const float AnimLength = AnimationSequence->GetPlayLength();
274 const float SampleInterval = 1.f / SampleRate;
275
276 float Time = 0.f;
277 int32 SampleIndex = 0;
278
279 FTransform RefPose = ExtractPose(AnimationSequence, BoneContainer, CompactPoseBoneIndex, 0.f);
280
281 TArray<FTransform> BonePoses;
282
283 FVector MaxLoc = FVector::ZeroVector;
284 FRotator MaxRot = FRotator::ZeroRotator;
285
286 auto PluginSettings = GetMutableDefault<UPluginSettings>();
287
288 if (!PluginSettings)
289 {
290 UE_LOG(LogTemp, Error, TEXT("Plugin Settings Are NULL"))
291 return;
292 }
293
294 const FString PackagePath = PluginSettings->CurvesSavePath + WeaponName + FString("_Curves/");
295
296 UPackage* PackageLoc = CreatePackage(*(PackagePath + AnimName.ToString() + FString("Loc")));
297 PackageLoc->FullyLoad();
298
299 UPackage* PackageRot = CreatePackage(*(PackagePath + AnimName.ToString() + FString("Rot")));
300 PackageRot->FullyLoad();
301
302 UCurveVector* TranslationCurve = NewObject<UCurveVector>(PackageLoc, *(AnimName.ToString() + FString("Loc")),
303 RF_Public | RF_Standalone);
304 UCurveVector* RotationCurve = NewObject<UCurveVector>(PackageRot, *(AnimName.ToString() + FString("Rot")),
305 RF_Public | RF_Standalone);
306
307
308 while (Time < AnimLength)
309 {
310 Time = FMath::Clamp(SampleIndex * SampleInterval, 0.f, AnimLength);
311 SampleIndex++;
312
313 FTransform CurrentPose = ExtractPose(AnimationSequence, BoneContainer, CompactPoseBoneIndex, Time);
314 FTransform DeltaPose = CurrentPose.Inverse() * RefPose;
315 DeltaPose.NormalizeRotation();
316
317 if(bNormalize)
318 {
319 if (FMath::Abs(DeltaPose.GetLocation().X) > FMath::Abs(MaxLoc.X))
320 {
321 MaxLoc.X = FMath::Abs(DeltaPose.GetLocation().X);
322 }
323
324 if (FMath::Abs(DeltaPose.GetLocation().Y) > FMath::Abs(MaxLoc.Y))
325 {
326 MaxLoc.Y = FMath::Abs(DeltaPose.GetLocation().Y);
327 }
328
329 if (FMath::Abs(DeltaPose.GetLocation().Z) > FMath::Abs(MaxLoc.Z))
330 {
331 MaxLoc.Z = FMath::Abs(DeltaPose.GetLocation().Z);
332 }
333
334 if (FMath::Abs(DeltaPose.Rotator().Pitch) > FMath::Abs(MaxRot.Pitch))
335 {
336 MaxRot.Pitch = FMath::Abs(DeltaPose.Rotator().Pitch);
337 }
338
339 if (FMath::Abs(DeltaPose.Rotator().Yaw) > FMath::Abs(MaxRot.Yaw))
340 {
341 MaxRot.Yaw = FMath::Abs(DeltaPose.Rotator().Yaw);
342 }
343
344 if (FMath::Abs(DeltaPose.Rotator().Roll) > FMath::Abs(MaxRot.Roll))
345 {
346 MaxRot.Roll = FMath::Abs(DeltaPose.Rotator().Roll);
347 }
348
349 BonePoses.Add(DeltaPose);
350
351 TranslationCurve->FloatCurves[0].UpdateOrAddKey(Time, 0.f, true);
352 TranslationCurve->FloatCurves[1].UpdateOrAddKey(Time, 0.f, true);
353 TranslationCurve->FloatCurves[2].UpdateOrAddKey(Time, 0.f, true);
354
355 RotationCurve->FloatCurves[0].UpdateOrAddKey(Time, 0.f, true);
356 RotationCurve->FloatCurves[1].UpdateOrAddKey(Time, 0.f, true);
357 RotationCurve->FloatCurves[2].UpdateOrAddKey(Time, 0.f, true);
358
359 continue;
360 }
361
362 TranslationCurve->FloatCurves[0].UpdateOrAddKey(Time, DeltaPose.GetLocation().X, true);
363 TranslationCurve->FloatCurves[1].UpdateOrAddKey(Time, DeltaPose.GetLocation().Y, true);
364 TranslationCurve->FloatCurves[2].UpdateOrAddKey(Time, DeltaPose.GetLocation().Z, true);
365
366 RotationCurve->FloatCurves[0].UpdateOrAddKey(Time, DeltaPose.Rotator().Roll, true);
367 RotationCurve->FloatCurves[1].UpdateOrAddKey(Time, DeltaPose.Rotator().Pitch, true);
368 RotationCurve->FloatCurves[2].UpdateOrAddKey(Time, DeltaPose.Rotator().Yaw, true);
369 }
370
371 if(bNormalize)
372 {
373
374 for (int i = 0; i < BonePoses.Num(); i++)
375 {
376 FVector NormalizedVector;
377 NormalizedVector.X = NormalizeValue(BonePoses[i].GetLocation().X, MaxLoc.X);
378 NormalizedVector.Y = NormalizeValue(BonePoses[i].GetLocation().Y, MaxLoc.Y);
379 NormalizedVector.Z = NormalizeValue(BonePoses[i].GetLocation().Z, MaxLoc.Z);
380
381 FRotator NormalizedRotator;
382 NormalizedRotator.Pitch = NormalizeValue(BonePoses[i].Rotator().Pitch, MaxRot.Pitch);
383 NormalizedRotator.Yaw = NormalizeValue(BonePoses[i].Rotator().Yaw, MaxRot.Yaw);
384 NormalizedRotator.Roll = NormalizeValue(BonePoses[i].Rotator().Roll, MaxRot.Roll);
385
386 BonePoses[i] = FTransform(NormalizedRotator, NormalizedVector);
387 }
388
389 for (int i = 0; i < TranslationCurve->FloatCurves->GetNumKeys(); i++)
390 {
391 TranslationCurve->FloatCurves[0].Keys[i].Value = BonePoses[i].GetLocation().X;
392 TranslationCurve->FloatCurves[1].Keys[i].Value = BonePoses[i].GetLocation().Y;
393 TranslationCurve->FloatCurves[2].Keys[i].Value = BonePoses[i].GetLocation().Z;
394
395 RotationCurve->FloatCurves[0].Keys[i].Value = BonePoses[i].Rotator().Roll;
396 RotationCurve->FloatCurves[1].Keys[i].Value = BonePoses[i].Rotator().Pitch;
397 RotationCurve->FloatCurves[2].Keys[i].Value = BonePoses[i].Rotator().Yaw;
398 }
399 }
400
401 SaveCurve(PackageLoc, TranslationCurve, PackagePath + AnimName.ToString() + FString("Loc"));
402 SaveCurve(PackageRot, RotationCurve, PackagePath + AnimName.ToString() + FString("Rot"));
403}
void SaveCurve(UPackage *Package, UCurveVector *Curve, const FString &PackagePath)
Definition CurveExtractor.cpp:454
FName AnimName
Definition CurveExtractor.h:27
FString WeaponName
Definition CurveExtractor.h:31

◆ ExtractPose()

FTransform UCurveExtractor::ExtractPose ( UAnimSequence * Animation,
const FBoneContainer & BoneContainer,
FCompactPoseBoneIndex CompactPoseBoneIndex,
double Time )
private

Return bone transform in root bone space

434{
435 FCompactPose Pose;
436 Pose.SetBoneContainer(&BoneContainer);
437
438 FBlendedCurve Curve;
439 Curve.InitFrom(BoneContainer);
440
441 FAnimExtractContext Context(Time, false);
442 UE::Anim::FStackAttributeContainer Attributes;
443 FAnimationPoseData AnimationPoseData(Pose, Curve, Attributes);
444
445 Animation->GetBonePose(AnimationPoseData, Context, true);
446
447 check(Pose.IsValidIndex(CompactPoseBoneIndex));
448
449 FCSPose<FCompactPose> ComponentSpacePose;
450 ComponentSpacePose.InitPose(Pose);
451 return ComponentSpacePose.GetComponentSpaceTransform(CompactPoseBoneIndex);
452}

◆ GetCurveName()

FName UCurveExtractor::GetCurveName ( FString Type,
FString Axis ) const
private
56{
57 return FName(*FString::Printf(TEXT("%s_%s_%s"), *CurveName.ToString(), *Type, *Axis));
58}
FName CurveName
Definition CurveExtractor.h:46

◆ NormalizeValue()

float UCurveExtractor::NormalizeValue ( float Value,
float MaxValue ) const
private
11{
12 if(FMath::IsNearlyZero(MaxValue))
13 {
14 return 0.f;
15 }
16
17 return Value / MaxValue;
18}

◆ OnApply_Implementation()

void UCurveExtractor::OnApply_Implementation ( UAnimSequence * AnimationSequence)
overridevirtual
406{
407 Super::OnApply_Implementation(AnimationSequence);
408
410 {
411 ExtractAnimCurves(AnimationSequence);
412 return;
413 }
414
415 ExtractCurveAssets(AnimationSequence);
416}
bool bAddToAnimation
Definition CurveExtractor.h:40
void ExtractCurveAssets(UAnimSequence *AnimationSequence)
Definition CurveExtractor.cpp:237
void ExtractAnimCurves(UAnimSequence *AnimationSequence)
Definition CurveExtractor.cpp:60

◆ OnRevert_Implementation()

void UCurveExtractor::OnRevert_Implementation ( UAnimSequence * AnimationSequence)
overridevirtual
419{
420 Super::OnRevert_Implementation(AnimationSequence);
421
422 RemoveCurve(AnimationSequence, GetCurveName(TEXT("T"), TEXT("X")));
423 RemoveCurve(AnimationSequence, GetCurveName(TEXT("T"), TEXT("Y")));
424 RemoveCurve(AnimationSequence, GetCurveName(TEXT("T"), TEXT("Z")));
425
426 RemoveCurve(AnimationSequence, GetCurveName(TEXT("R"), TEXT("R")));
427 RemoveCurve(AnimationSequence, GetCurveName(TEXT("R"), TEXT("P")));
428 RemoveCurve(AnimationSequence, GetCurveName(TEXT("R"), TEXT("Y")));
429}
void RemoveCurve(UAnimSequence *Animation, FName Name)
Definition CurveExtractor.cpp:46

◆ RemoveCurve()

void UCurveExtractor::RemoveCurve ( UAnimSequence * Animation,
FName Name )
private
47{
48 IAnimationDataController& Controller = Animation->GetController();
49 const FAnimationCurveIdentifier CurveId = UAnimationCurveIdentifierExtensions::GetCurveIdentifier(
50 Animation->GetSkeleton(), Name, ERawCurveTrackTypes::RCT_Float);
51
52 Controller.RemoveCurve(CurveId, true);
53}

◆ SaveCurve()

void UCurveExtractor::SaveCurve ( UPackage * Package,
UCurveVector * Curve,
const FString & PackagePath )

Getting the full path to the file

Finally saving just created package

455{
456 FAssetRegistryModule::AssetCreated(Curve);
457
458
459 const FString FilePath = FPackageName::LongPackageNameToFilename(PackagePath,
460 FPackageName::GetAssetPackageExtension());
461
462
463 FSavePackageArgs SavePackageArgs;
464 SavePackageArgs.TopLevelFlags = EObjectFlags::RF_Public | EObjectFlags::RF_Standalone;
465 const bool bSuccess = UPackage::SavePackage(Package, Curve, *FilePath, SavePackageArgs);
466
467 Package->SetDirtyFlag(true);
468
469 UE_LOG(LogTemp, Warning, TEXT("Saved Recoil Curves: %s"), bSuccess ? TEXT("SUCCESS") : TEXT("ERROR"))
470}

Member Data Documentation

◆ AnimName

FName UCurveExtractor::AnimName

Name of procedural animation. Note: _Rot and _Loc postfixes are added automatically

◆ bAddToAnimation

bool UCurveExtractor::bAddToAnimation = false

◆ bNormalize

bool UCurveExtractor::bNormalize = true

◆ BoneName

FName UCurveExtractor::BoneName

Bone which will be captured

◆ CurveName

FName UCurveExtractor::CurveName

◆ RefAnimation

UAnimSequence* UCurveExtractor::RefAnimation = nullptr

◆ SampleRate

float UCurveExtractor::SampleRate = 30.f

◆ WeaponName

FString UCurveExtractor::WeaponName

Weapon name


The documentation for this class was generated from the following files: