UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PhysTestSerializer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Chaos/Defines.h"
10#include "Chaos/PBDRigidsSOAs.h"
12#include "Containers/Array.h"
13#include "CoreMinimal.h"
14#include "HAL/Platform.h"
17#include "SQCapture.h"
20#include "Templates/UniquePtr.h"
21
22#ifndef PHYS_TEST_SERIALIZER
23#define PHYS_TEST_SERIALIZER 1
24#endif
25
26// Utility used for serializing just physics data. This is meant for only the physics engine data (physx or chaos, not any unreal side). It is not meant to be used for actual serialization
27
28#if PHYS_TEST_SERIALIZER
29
30namespace Chaos
31{
32
33 class FChaosArchive;
34}
35
37{
38public:
44
47
48 //Set the data from an external source. This will obliterate any existing data. Make sure you are not holding on to old internal data as it will go away
50
52 {
53 return ChaosContext.Get();
54 }
55
57 {
58 ensure(!SQCapture); //we don't have support for multi sweeps yet since the scene could change
59 SQCapture = TUniquePtr<FSQCapture>(new FSQCapture(*this));
60 return *SQCapture;
61 }
62
64 {
65 if (SQCapture)
66 {
67 //todo: this sucks, find a better way to create data instead of doing it lazily
69#if 0
70 SQCapture->CreateChaosDataFromPhysX();
71#endif
72 }
73 return SQCapture.Get();
74 }
75
77 {
78#if 0
79 if (!bChaosDataReady)
80 {
81 ensure(!bDiskDataIsChaos);
82 //only supported for physx to chaos - don't have serialization context
84 }
85#endif
86 return ChaosEvolution.Get();
87 }
88
89private:
90
91#if 0
93#endif
94
95private:
96
97 TArray<uint8> Data; //how the data is stored before going to disk
98 bool bDiskDataIsChaos;
99 bool bChaosDataReady;
100
101 TUniquePtr<FSQCapture> SQCapture;
102
105 Chaos::FPBDRigidsSOAs Particles;
108
110
111 FCustomVersionContainer ArchiveVersion;
112};
113
114#endif
#define ensure( InExpression)
Definition AssertionMacros.h:464
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition ChaosArchive.h:74
Definition ChaosArchive.h:167
Definition PBDRigidsEvolutionGBF.h:51
Definition PBDRigidsSOAs.h:269
Definition PBDRigidsSOAs.h:37
Definition Handles.h:152
Definition CustomVersion.h:111
Definition PhysTestSerializer.h:37
const FSQCapture * GetSQCapture()
Definition PhysTestSerializer.h:63
FPhysTestSerializer(FPhysTestSerializer &&Other)=delete
PHYSICSCORE_API void SetPhysicsData(Chaos::FPBDRigidsEvolution &ChaosEvolution)
Definition PhysTestSerializer.cpp:110
FSQCapture & CaptureSQ()
Definition PhysTestSerializer.h:56
PHYSICSCORE_API FPhysTestSerializer()
Definition PhysTestSerializer.cpp:20
FPhysTestSerializer & operator=(FPhysTestSerializer &&)=delete
Chaos::FPBDRigidsEvolution * GetChaosData()
Definition PhysTestSerializer.h:76
FPhysTestSerializer(const FPhysTestSerializer &Other)=delete
FPhysTestSerializer & operator=(const FPhysTestSerializer &)=delete
const Chaos::FChaosArchiveContext * GetChaosContext() const
Definition PhysTestSerializer.h:51
Definition Array.h:670
Definition UniquePtr.h:107
UE_FORCEINLINE_HINT T * Get() const
Definition UniquePtr.h:324
Definition SkeletalMeshComponent.h:307
Definition SQCapture.h:41