mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
[ue] Update renderers for sequence attachments and refresh sample assets
This commit is contained in:
parent
9b969202e8
commit
55cc604baa
1
.gitignore
vendored
1
.gitignore
vendored
@ -264,3 +264,4 @@ spine-c/.docker-built
|
|||||||
.cache/
|
.cache/
|
||||||
spine-godot/class_info.txt
|
spine-godot/class_info.txt
|
||||||
spine-godot/class_meta.json
|
spine-godot/class_meta.json
|
||||||
|
spine-ue/DerivedDataCache
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -286,12 +286,13 @@ void SSpineWidget::UpdateMesh(int32 LayerId, FSlateWindowElementList &OutDrawEle
|
|||||||
float *attachmentUvs = nullptr;
|
float *attachmentUvs = nullptr;
|
||||||
|
|
||||||
Slot *slot = Skeleton->getDrawOrder()[i];
|
Slot *slot = Skeleton->getDrawOrder()[i];
|
||||||
|
SlotPose &slotPose = slot->getAppliedPose();
|
||||||
if (!slot->getBone().isActive()) {
|
if (!slot->getBone().isActive()) {
|
||||||
clipper.clipEnd(*slot);
|
clipper.clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Attachment *attachment = slot->getAppliedPose().getAttachment();
|
Attachment *attachment = slotPose.getAttachment();
|
||||||
if (!attachment) {
|
if (!attachment) {
|
||||||
clipper.clipEnd(*slot);
|
clipper.clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
@ -304,22 +305,26 @@ void SSpineWidget::UpdateMesh(int32 LayerId, FSlateWindowElementList &OutDrawEle
|
|||||||
|
|
||||||
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||||
RegionAttachment *regionAttachment = (RegionAttachment *) attachment;
|
RegionAttachment *regionAttachment = (RegionAttachment *) attachment;
|
||||||
|
Sequence &sequence = regionAttachment->getSequence();
|
||||||
|
int sequenceIndex = sequence.resolveIndex(slotPose);
|
||||||
attachmentColor.set(regionAttachment->getColor());
|
attachmentColor.set(regionAttachment->getColor());
|
||||||
attachmentVertices->setSize(8, 0);
|
attachmentVertices->setSize(8, 0);
|
||||||
regionAttachment->computeWorldVertices(*slot, *attachmentVertices, 0, 2);
|
regionAttachment->computeWorldVertices(*slot, regionAttachment->getOffsets(slotPose), *attachmentVertices, 0, 2);
|
||||||
attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRegion();
|
attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex);
|
||||||
attachmentIndices = quadIndices;
|
attachmentIndices = quadIndices;
|
||||||
attachmentUvs = regionAttachment->getUVs().buffer();
|
attachmentUvs = sequence.getUVs(sequenceIndex).buffer();
|
||||||
numVertices = 4;
|
numVertices = 4;
|
||||||
numIndices = 6;
|
numIndices = 6;
|
||||||
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||||
MeshAttachment *mesh = (MeshAttachment *) attachment;
|
MeshAttachment *mesh = (MeshAttachment *) attachment;
|
||||||
|
Sequence &sequence = mesh->getSequence();
|
||||||
|
int sequenceIndex = sequence.resolveIndex(slotPose);
|
||||||
attachmentColor.set(mesh->getColor());
|
attachmentColor.set(mesh->getColor());
|
||||||
attachmentVertices->setSize(mesh->getWorldVerticesLength(), 0);
|
attachmentVertices->setSize(mesh->getWorldVerticesLength(), 0);
|
||||||
mesh->computeWorldVertices(*Skeleton, *slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2);
|
mesh->computeWorldVertices(*Skeleton, *slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2);
|
||||||
attachmentAtlasRegion = (AtlasRegion *) mesh->getRegion();
|
attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex);
|
||||||
attachmentIndices = mesh->getTriangles().buffer();
|
attachmentIndices = mesh->getTriangles().buffer();
|
||||||
attachmentUvs = mesh->getUVs().buffer();
|
attachmentUvs = sequence.getUVs(sequenceIndex).buffer();
|
||||||
numVertices = mesh->getWorldVerticesLength() >> 1;
|
numVertices = mesh->getWorldVerticesLength() >> 1;
|
||||||
numIndices = mesh->getTriangles().size();
|
numIndices = mesh->getTriangles().size();
|
||||||
} else /* clipping */ {
|
} else /* clipping */ {
|
||||||
|
|||||||
@ -113,11 +113,11 @@ void USpineSkeletonDataAsset::BeginDestroy() {
|
|||||||
class SP_API NullAttachmentLoader : public AttachmentLoader {
|
class SP_API NullAttachmentLoader : public AttachmentLoader {
|
||||||
public:
|
public:
|
||||||
virtual RegionAttachment *newRegionAttachment(Skin &skin, const String &name, const String &path, Sequence *sequence) {
|
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) {
|
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) {
|
virtual BoundingBoxAttachment *newBoundingBoxAttachment(Skin &skin, const String &name) {
|
||||||
|
|||||||
@ -197,9 +197,10 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon
|
|||||||
float *attachmentUvs = nullptr;
|
float *attachmentUvs = nullptr;
|
||||||
|
|
||||||
Slot *slot = Skeleton->getDrawOrder()[i];
|
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);
|
clipper.clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -223,12 +224,14 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sequence &sequence = regionAttachment->getSequence();
|
||||||
|
int sequenceIndex = sequence.resolveIndex(slotPose);
|
||||||
attachmentColor.set(regionAttachment->getColor());
|
attachmentColor.set(regionAttachment->getColor());
|
||||||
attachmentVertices->setSize(8, 0);
|
attachmentVertices->setSize(8, 0);
|
||||||
regionAttachment->computeWorldVertices(*slot, *attachmentVertices, 0, 2);
|
regionAttachment->computeWorldVertices(*slot, regionAttachment->getOffsets(slotPose), *attachmentVertices, 0, 2);
|
||||||
attachmentAtlasRegion = (AtlasRegion *) regionAttachment->getRegion();
|
attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex);
|
||||||
attachmentIndices = quadIndices;
|
attachmentIndices = quadIndices;
|
||||||
attachmentUvs = regionAttachment->getUVs().buffer();
|
attachmentUvs = sequence.getUVs(sequenceIndex).buffer();
|
||||||
numVertices = 4;
|
numVertices = 4;
|
||||||
numIndices = 6;
|
numIndices = 6;
|
||||||
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||||
@ -240,12 +243,14 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sequence &sequence = mesh->getSequence();
|
||||||
|
int sequenceIndex = sequence.resolveIndex(slotPose);
|
||||||
attachmentColor.set(mesh->getColor());
|
attachmentColor.set(mesh->getColor());
|
||||||
attachmentVertices->setSize(mesh->getWorldVerticesLength(), 0);
|
attachmentVertices->setSize(mesh->getWorldVerticesLength(), 0);
|
||||||
mesh->computeWorldVertices(*Skeleton, *slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2);
|
mesh->computeWorldVertices(*Skeleton, *slot, 0, mesh->getWorldVerticesLength(), attachmentVertices->buffer(), 0, 2);
|
||||||
attachmentAtlasRegion = (AtlasRegion *) mesh->getRegion();
|
attachmentAtlasRegion = (AtlasRegion *) sequence.getRegion(sequenceIndex);
|
||||||
attachmentIndices = mesh->getTriangles().buffer();
|
attachmentIndices = mesh->getTriangles().buffer();
|
||||||
attachmentUvs = mesh->getUVs().buffer();
|
attachmentUvs = sequence.getUVs(sequenceIndex).buffer();
|
||||||
numVertices = mesh->getWorldVerticesLength() >> 1;
|
numVertices = mesh->getWorldVerticesLength() >> 1;
|
||||||
numIndices = mesh->getTriangles().size();
|
numIndices = mesh->getTriangles().size();
|
||||||
} else /* clipping */ {
|
} else /* clipping */ {
|
||||||
|
|||||||
@ -33,7 +33,6 @@ public class SpineUE : ModuleRules
|
|||||||
{
|
{
|
||||||
public SpineUE(ReadOnlyTargetRules Target) : base(Target)
|
public SpineUE(ReadOnlyTargetRules Target) : base(Target)
|
||||||
{
|
{
|
||||||
PrivatePCHHeaderFile = "SpineUE.h";
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SpinePlugin", "ProceduralMeshComponent" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SpinePlugin", "ProceduralMeshComponent" });
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"FileVersion": 3,
|
"FileVersion": 3,
|
||||||
"EngineAssociation": "5.5",
|
"EngineAssociation": "5.7",
|
||||||
"Category": "",
|
"Category": "",
|
||||||
"Description": "",
|
"Description": "",
|
||||||
"Modules": [
|
"Modules": [
|
||||||
@ -13,4 +13,4 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user