From 25719370c7cf6741b21515676e20fee5a9989636 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 15 Sep 2022 08:36:00 +0200 Subject: [PATCH] [ue4] Call computeWorldVertices before fetching renderer object. See #2154. --- .../Source/SpinePlugin/Private/SSpineWidget.cpp | 8 ++++---- .../Private/SpineSkeletonRendererComponent.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp index 4a845f1f1..2b0fb3381 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp @@ -273,18 +273,18 @@ void SSpineWidget::UpdateMesh(int32 LayerId, FSlateWindowElementList &OutDrawEle if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { RegionAttachment *regionAttachment = (RegionAttachment *) attachment; - attachmentColor.set(regionAttachment->getColor()); - attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRendererObject(); + attachmentColor.set(regionAttachment->getColor()); regionAttachment->computeWorldVertices(*slot, *attachmentVertices, 0, 2); + attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRendererObject(); attachmentIndices = quadIndices; attachmentUvs = regionAttachment->getUVs().buffer(); numVertices = 4; numIndices = 6; } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { MeshAttachment *mesh = (MeshAttachment *) attachment; - attachmentColor.set(mesh->getColor()); - attachmentAtlasRegion = (AtlasRegion *) mesh->getRendererObject(); + attachmentColor.set(mesh->getColor()); mesh->computeWorldVertices(*slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2); + attachmentAtlasRegion = (AtlasRegion *) mesh->getRendererObject(); attachmentIndices = mesh->getTriangles().buffer(); attachmentUvs = mesh->getUVs().buffer(); numVertices = mesh->getWorldVerticesLength() >> 1; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp index 7b9eeedba..fbf2ad5cc 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp @@ -235,9 +235,9 @@ void USpineSkeletonRendererComponent::UpdateMesh(Skeleton *Skeleton) { continue; } - attachmentColor.set(regionAttachment->getColor()); - attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRendererObject(); + attachmentColor.set(regionAttachment->getColor()); regionAttachment->computeWorldVertices(*slot, *attachmentVertices, 0, 2); + attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRendererObject(); attachmentIndices = quadIndices; attachmentUvs = regionAttachment->getUVs().buffer(); numVertices = 4; @@ -251,9 +251,9 @@ void USpineSkeletonRendererComponent::UpdateMesh(Skeleton *Skeleton) { continue; } - attachmentColor.set(mesh->getColor()); - attachmentAtlasRegion = (AtlasRegion *) mesh->getRendererObject(); + attachmentColor.set(mesh->getColor()); mesh->computeWorldVertices(*slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2); + attachmentAtlasRegion = (AtlasRegion *) mesh->getRendererObject(); attachmentIndices = mesh->getTriangles().buffer(); attachmentUvs = mesh->getUVs().buffer(); numVertices = mesh->getWorldVerticesLength() >> 1;