diff --git a/.gitignore b/.gitignore index ce5f5e90d..b2c9ef973 100644 --- a/.gitignore +++ b/.gitignore @@ -264,3 +264,4 @@ spine-c/.docker-built .cache/ spine-godot/class_info.txt spine-godot/class_meta.json +spine-ue/DerivedDataCache diff --git a/spine-ue/Content/GettingStarted/Assets/celestial-circus/Textures/mix-and-match.uasset b/spine-ue/Content/GettingStarted/Assets/celestial-circus/Textures/mix-and-match.uasset deleted file mode 100644 index 91c6544f3..000000000 Binary files a/spine-ue/Content/GettingStarted/Assets/celestial-circus/Textures/mix-and-match.uasset and /dev/null differ diff --git a/spine-ue/Content/GettingStarted/Assets/celestial-circus/celestial-circus-pro.uasset b/spine-ue/Content/GettingStarted/Assets/celestial-circus/celestial-circus-pro.uasset index 586b74f03..108aa9b9c 100644 Binary files a/spine-ue/Content/GettingStarted/Assets/celestial-circus/celestial-circus-pro.uasset and b/spine-ue/Content/GettingStarted/Assets/celestial-circus/celestial-circus-pro.uasset differ diff --git a/spine-ue/Content/GettingStarted/Assets/celestial-circus/mix-and-match-pro.uasset b/spine-ue/Content/GettingStarted/Assets/celestial-circus/mix-and-match-pro.uasset deleted file mode 100644 index f57515af4..000000000 Binary files a/spine-ue/Content/GettingStarted/Assets/celestial-circus/mix-and-match-pro.uasset and /dev/null differ diff --git a/spine-ue/Content/GettingStarted/Assets/celestial-circus/mix-and-match.uasset b/spine-ue/Content/GettingStarted/Assets/celestial-circus/mix-and-match.uasset deleted file mode 100644 index f423d33b3..000000000 Binary files a/spine-ue/Content/GettingStarted/Assets/celestial-circus/mix-and-match.uasset and /dev/null differ diff --git a/spine-ue/Content/GettingStarted/Assets/mix-and-match/mix-and-match-pro.uasset b/spine-ue/Content/GettingStarted/Assets/mix-and-match/mix-and-match-pro.uasset index 7f2bc060f..5e47cffb4 100644 Binary files a/spine-ue/Content/GettingStarted/Assets/mix-and-match/mix-and-match-pro.uasset and b/spine-ue/Content/GettingStarted/Assets/mix-and-match/mix-and-match-pro.uasset differ diff --git a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp index 7f4c0d283..51796dfa9 100644 --- a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp +++ b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp @@ -286,12 +286,13 @@ void SSpineWidget::UpdateMesh(int32 LayerId, FSlateWindowElementList &OutDrawEle float *attachmentUvs = nullptr; Slot *slot = Skeleton->getDrawOrder()[i]; + SlotPose &slotPose = slot->getAppliedPose(); if (!slot->getBone().isActive()) { clipper.clipEnd(*slot); continue; } - Attachment *attachment = slot->getAppliedPose().getAttachment(); + Attachment *attachment = slotPose.getAttachment(); if (!attachment) { clipper.clipEnd(*slot); continue; @@ -304,22 +305,26 @@ void SSpineWidget::UpdateMesh(int32 LayerId, FSlateWindowElementList &OutDrawEle if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { RegionAttachment *regionAttachment = (RegionAttachment *) attachment; + Sequence &sequence = regionAttachment->getSequence(); + int sequenceIndex = sequence.resolveIndex(slotPose); attachmentColor.set(regionAttachment->getColor()); attachmentVertices->setSize(8, 0); - regionAttachment->computeWorldVertices(*slot, *attachmentVertices, 0, 2); - attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRegion(); + regionAttachment->computeWorldVertices(*slot, regionAttachment->getOffsets(slotPose), *attachmentVertices, 0, 2); + attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex); attachmentIndices = quadIndices; - attachmentUvs = regionAttachment->getUVs().buffer(); + attachmentUvs = sequence.getUVs(sequenceIndex).buffer(); numVertices = 4; numIndices = 6; } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { MeshAttachment *mesh = (MeshAttachment *) attachment; + Sequence &sequence = mesh->getSequence(); + int sequenceIndex = sequence.resolveIndex(slotPose); attachmentColor.set(mesh->getColor()); attachmentVertices->setSize(mesh->getWorldVerticesLength(), 0); mesh->computeWorldVertices(*Skeleton, *slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2); - attachmentAtlasRegion = (AtlasRegion *) mesh->getRegion(); + attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex); attachmentIndices = mesh->getTriangles().buffer(); - attachmentUvs = mesh->getUVs().buffer(); + attachmentUvs = sequence.getUVs(sequenceIndex).buffer(); numVertices = mesh->getWorldVerticesLength() >> 1; numIndices = mesh->getTriangles().size(); } else /* clipping */ { diff --git a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp index b07f710e7..2838906e0 100644 --- a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp +++ b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp @@ -113,11 +113,11 @@ void USpineSkeletonDataAsset::BeginDestroy() { class SP_API NullAttachmentLoader : public AttachmentLoader { public: virtual RegionAttachment *newRegionAttachment(Skin &skin, const String &name, const String &path, Sequence *sequence) { - return new (__FILE__, __LINE__) RegionAttachment(name); + return new (__FILE__, __LINE__) RegionAttachment(name, sequence); } virtual MeshAttachment *newMeshAttachment(Skin &skin, const String &name, const String &path, Sequence *sequence) { - return new (__FILE__, __LINE__) MeshAttachment(name); + return new (__FILE__, __LINE__) MeshAttachment(name, sequence); } virtual BoundingBoxAttachment *newBoundingBoxAttachment(Skin &skin, const String &name) { diff --git a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp index 55a58c70f..09fbbaa05 100644 --- a/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp +++ b/spine-ue/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp @@ -197,9 +197,10 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon float *attachmentUvs = nullptr; Slot *slot = Skeleton->getDrawOrder()[i]; - Attachment *attachment = slot->getAppliedPose().getAttachment(); + SlotPose &slotPose = slot->getAppliedPose(); + Attachment *attachment = slotPose.getAttachment(); - if (slot->getAppliedPose().getColor().a == 0 || !slot->getBone().isActive()) { + if (slotPose.getColor().a == 0 || !slot->getBone().isActive()) { clipper.clipEnd(*slot); continue; } @@ -223,12 +224,14 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon continue; } + Sequence &sequence = regionAttachment->getSequence(); + int sequenceIndex = sequence.resolveIndex(slotPose); attachmentColor.set(regionAttachment->getColor()); attachmentVertices->setSize(8, 0); - regionAttachment->computeWorldVertices(*slot, *attachmentVertices, 0, 2); - attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRegion(); + regionAttachment->computeWorldVertices(*slot, regionAttachment->getOffsets(slotPose), *attachmentVertices, 0, 2); + attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex); attachmentIndices = quadIndices; - attachmentUvs = regionAttachment->getUVs().buffer(); + attachmentUvs = sequence.getUVs(sequenceIndex).buffer(); numVertices = 4; numIndices = 6; } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { @@ -240,12 +243,14 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon continue; } + Sequence &sequence = mesh->getSequence(); + int sequenceIndex = sequence.resolveIndex(slotPose); attachmentColor.set(mesh->getColor()); attachmentVertices->setSize(mesh->getWorldVerticesLength(), 0); mesh->computeWorldVertices(*Skeleton, *slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2); - attachmentAtlasRegion = (AtlasRegion *) mesh->getRegion(); + attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex); attachmentIndices = mesh->getTriangles().buffer(); - attachmentUvs = mesh->getUVs().buffer(); + attachmentUvs = sequence.getUVs(sequenceIndex).buffer(); numVertices = mesh->getWorldVerticesLength() >> 1; numIndices = mesh->getTriangles().size(); } else /* clipping */ { diff --git a/spine-ue/Source/SpineUE/SpineUE.Build.cs b/spine-ue/Source/SpineUE/SpineUE.Build.cs index 2354795c7..7b9674ecb 100644 --- a/spine-ue/Source/SpineUE/SpineUE.Build.cs +++ b/spine-ue/Source/SpineUE/SpineUE.Build.cs @@ -33,7 +33,6 @@ public class SpineUE : ModuleRules { public SpineUE(ReadOnlyTargetRules Target) : base(Target) { - PrivatePCHHeaderFile = "SpineUE.h"; PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SpinePlugin", "ProceduralMeshComponent" }); PrivateDependencyModuleNames.AddRange(new string[] { }); } diff --git a/spine-ue/SpineUE.uproject b/spine-ue/SpineUE.uproject index b3f7b7c31..34b43a994 100644 --- a/spine-ue/SpineUE.uproject +++ b/spine-ue/SpineUE.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "5.5", + "EngineAssociation": "5.7", "Category": "", "Description": "", "Modules": [ @@ -13,4 +13,4 @@ ] } ] -} \ No newline at end of file +}