Skip to content

Commit

Permalink
Fixed crash in serialization of CDO/Archetype
Browse files Browse the repository at this point in the history
Removed unfinished modules from plugin descriptor
Fixed compilation of unit tests.
  • Loading branch information
Koderz committed Feb 26, 2023
1 parent 223b3be commit 090faf4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
18 changes: 0 additions & 18 deletions RealtimeMeshComponent.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@
"Name": "RealtimeMeshComponent",
"Type": "Runtime",
"LoadingPhase": "PostConfigInit",
"WhitelistPlatforms": [
"Win64",
"Linux",
"Mac",
"XboxOne",
"PS4",
"Android"
]
},
{
"Name": "RealtimeMeshTests",
Expand All @@ -37,16 +29,6 @@
"Name": "RealtimeMeshEditor",
"Type": "Editor",
"LoadingPhase": "Default"
},
{
"Name": "RealtimeMeshComposable",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "RealtimeDynamicMesh",
"Type": "Runtime",
"LoadingPhase": "Default"
}
]
}
9 changes: 6 additions & 3 deletions Source/RealtimeMeshComponent/Private/RealtimeMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,13 @@ void URealtimeMesh::Serialize(FArchive& Ar)
{
Super::Serialize(Ar);

Ar.UsingCustomVersion(RealtimeMesh::FRealtimeMeshVersion::GUID);
if (!HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject))
{
Ar.UsingCustomVersion(RealtimeMesh::FRealtimeMeshVersion::GUID);

// Serialize the mesh data
GetMesh()->Serialize(Ar);
// Serialize the mesh data
GetMesh()->Serialize(Ar);
}
}

void URealtimeMesh::PostDuplicate(bool bDuplicateForPIE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ IMPLEMENT_SIMPLE_AUTOMATION_TEST(FRealtimeMeshElementTypeTests, "RealtimeMeshCom

bool FRealtimeMeshElementTypeTests::RunTest(const FString& Parameters)
{
const auto VoidType = RealtimeMesh::GetRealtimeMeshDataElementType<void>();
//const auto VoidType = RealtimeMesh::GetRealtimeMeshDataElementType<void>();
const auto FloatType = RealtimeMesh::GetRealtimeMeshDataElementType<float>();
const auto VectorType = RealtimeMesh::GetRealtimeMeshDataElementType<FVector2f>();
const auto IntType = RealtimeMesh::GetRealtimeMeshDataElementType<uint32>();

TestFalse(TEXT("InvalidType Test"), VoidType.IsValid());
//TestFalse(TEXT("InvalidType Test"), VoidType.IsValid());
TestTrue(TEXT("FloatType Valid"), FloatType.IsValid());
TestTrue(TEXT("VectorType Valid"), FloatType.IsValid());
TestTrue(TEXT("IntType Valid"), IntType.IsValid());
Expand All @@ -28,12 +28,12 @@ bool FRealtimeMeshElementTypeTests::RunTest(const FString& Parameters)
TestTrue(TEXT("VectorType DataType"), VectorType.GetDatumType() == RealtimeMesh::ERealtimeMeshDatumType::Float);
TestTrue(TEXT("VectorType NumDatums"), VectorType.GetNumDatums() == 2);

const RealtimeMesh::FRealtimeMeshElementTypeDefinition InvalidDef = RealtimeMesh::FRealtimeMeshBufferLayoutUtilities::GetTypeDefinition(VoidType);
//const RealtimeMesh::FRealtimeMeshElementTypeDefinition InvalidDef = RealtimeMesh::FRealtimeMeshBufferLayoutUtilities::GetTypeDefinition(VoidType);
const RealtimeMesh::FRealtimeMeshElementTypeDefinition ValidVertex = RealtimeMesh::FRealtimeMeshBufferLayoutUtilities::GetTypeDefinition(VectorType);
const RealtimeMesh::FRealtimeMeshElementTypeDefinition ValidIndex = RealtimeMesh::FRealtimeMeshBufferLayoutUtilities::GetTypeDefinition(IntType);


TestFalse(TEXT("InvalidDef Valid"), InvalidDef.IsValid());
//TestFalse(TEXT("InvalidDef Valid"), InvalidDef.IsValid());
TestTrue(TEXT("ValidVertex Valid"), ValidVertex.IsValid());
TestTrue(TEXT("ValidIndex Valid"), ValidIndex.IsValid());

Expand Down

0 comments on commit 090faf4

Please sign in to comment.