From d792636174eae359639ba032dd69395c6b3080f7 Mon Sep 17 00:00:00 2001 From: Moddingear Date: Sat, 22 Aug 2020 12:09:42 +0200 Subject: [PATCH 1/2] Fix issue #187 Fixed with *sortof* a bodge : the component was getting registered when it moved, while keeping it's data, so I made it so that it reuses the runtime mesh it had just like when you initialize it with one, so it doesn't try to reinit the RMC. --- .../Private/Components/RuntimeMeshComponentStatic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/RuntimeMeshComponent/Private/Components/RuntimeMeshComponentStatic.cpp b/Source/RuntimeMeshComponent/Private/Components/RuntimeMeshComponentStatic.cpp index 0f14a4a..747b73f 100644 --- a/Source/RuntimeMeshComponent/Private/Components/RuntimeMeshComponentStatic.cpp +++ b/Source/RuntimeMeshComponent/Private/Components/RuntimeMeshComponentStatic.cpp @@ -22,6 +22,7 @@ void URuntimeMeshComponentStatic::OnRegister() else { Initialize(StaticProvider); + RuntimeMesh = GetRuntimeMesh(); } Super::OnRegister(); From 7411577e8c0cc485e0ef598c7d249a82597c3e68 Mon Sep 17 00:00:00 2001 From: Moddingear Date: Mon, 24 Aug 2020 18:14:32 +0200 Subject: [PATCH 2/2] Fix issue #190 --- Source/RuntimeMeshComponent/Private/RuntimeMesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/RuntimeMeshComponent/Private/RuntimeMesh.cpp b/Source/RuntimeMeshComponent/Private/RuntimeMesh.cpp index 66582dc..5144382 100644 --- a/Source/RuntimeMeshComponent/Private/RuntimeMesh.cpp +++ b/Source/RuntimeMeshComponent/Private/RuntimeMesh.cpp @@ -1149,9 +1149,9 @@ FRuntimeMeshProxyPtr URuntimeMesh::GetRenderProxy(ERHIFeatureLevel::Type InFeatu for (int32 LODIndex = 0; LODIndex < LODs.Num(); LODIndex++) { FRuntimeMeshLOD& LOD = LODs[LODIndex]; - for (int32 SectionId = 0; SectionId < LOD.Sections.Num(); SectionId++) + for (auto pair : LOD.Sections) { - RenderProxy->CreateOrUpdateSection_GameThread(LODIndex, SectionId, LOD.Sections[SectionId], true); + RenderProxy->CreateOrUpdateSection_GameThread(LODIndex, pair.Key, pair.Value, true); bHadAnyInitialized = true; }