mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
4a66ced952
@ -1354,10 +1354,9 @@ spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char
|
||||
skeletonData->skins[skeletonData->skinsCount++] = skin;
|
||||
if (strcmp(skin->name, "default") == 0) skeletonData->defaultSkin = skin;
|
||||
|
||||
for (attachmentsMap = Json_getItem(skinMap,
|
||||
"attachments")
|
||||
->child;
|
||||
attachmentsMap; attachmentsMap = attachmentsMap->next) {
|
||||
skinPart = Json_getItem(skinMap, "attachments");
|
||||
if (skinPart) {
|
||||
for (attachmentsMap = skinPart->child; attachmentsMap; attachmentsMap = attachmentsMap->next) {
|
||||
spSlotData *slot = spSkeletonData_findSlot(skeletonData, attachmentsMap->name);
|
||||
Json *attachmentMap;
|
||||
|
||||
@ -1392,7 +1391,8 @@ spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char
|
||||
}
|
||||
|
||||
sequence = readSequence(Json_getItem(attachmentMap, "sequence"));
|
||||
attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, attachmentName,
|
||||
attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type,
|
||||
attachmentName,
|
||||
path, sequence);
|
||||
if (!attachment) {
|
||||
if (self->attachmentLoader->error1) {
|
||||
@ -1572,6 +1572,7 @@ spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Linked meshes. */
|
||||
for (i = 0; i < internal->linkedMeshCount; ++i) {
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/MeshAttachment.h>
|
||||
#include <spine/HasRendererObject.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
@ -53,10 +52,13 @@ void MeshAttachment::updateRegion() {
|
||||
_uvs.setSize(_regionUVs.size(), 0);
|
||||
}
|
||||
|
||||
if (_region == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
int i = 0, n = (int) _regionUVs.size();
|
||||
float u = _region->u, v = _region->v;
|
||||
float width = 0, height = 0;
|
||||
|
||||
switch (_region->degrees) {
|
||||
case 90: {
|
||||
float textureWidth = _region->height / (_region->u2 - _region->u);
|
||||
|
||||
@ -264,7 +264,7 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon
|
||||
// ignore regions for which we can't find a material
|
||||
UMaterialInstanceDynamic *material = nullptr;
|
||||
int foundPageIndex = -1;
|
||||
for (int pageIndex = 0; i < component->Atlas->atlasPages.Num(); pageIndex++) {
|
||||
for (int pageIndex = 0; pageIndex < component->Atlas->atlasPages.Num(); pageIndex++) {
|
||||
AtlasPage *page = component->Atlas->GetAtlas()->getPages()[pageIndex];
|
||||
if (attachmentAtlasRegion->page == page) {
|
||||
foundPageIndex = pageIndex;
|
||||
@ -277,33 +277,33 @@ void USpineSkeletonRendererComponent::UpdateMesh(USpineSkeletonComponent *compon
|
||||
}
|
||||
switch (slot->getData().getBlendMode()) {
|
||||
case BlendMode_Additive:
|
||||
if (i >= atlasAdditiveBlendMaterials.Num()) {
|
||||
if (foundPageIndex >= atlasAdditiveBlendMaterials.Num()) {
|
||||
clipper.clipEnd(*slot);
|
||||
continue;
|
||||
}
|
||||
material = atlasAdditiveBlendMaterials[i];
|
||||
material = atlasAdditiveBlendMaterials[foundPageIndex];
|
||||
break;
|
||||
case BlendMode_Multiply:
|
||||
if (i >= atlasMultiplyBlendMaterials.Num()) {
|
||||
if (foundPageIndex >= atlasMultiplyBlendMaterials.Num()) {
|
||||
clipper.clipEnd(*slot);
|
||||
continue;
|
||||
}
|
||||
material = atlasMultiplyBlendMaterials[i];
|
||||
material = atlasMultiplyBlendMaterials[foundPageIndex];
|
||||
break;
|
||||
case BlendMode_Screen:
|
||||
if (i >= atlasScreenBlendMaterials.Num()) {
|
||||
if (foundPageIndex >= atlasScreenBlendMaterials.Num()) {
|
||||
clipper.clipEnd(*slot);
|
||||
continue;
|
||||
}
|
||||
material = atlasScreenBlendMaterials[i];
|
||||
material = atlasScreenBlendMaterials[foundPageIndex];
|
||||
break;
|
||||
case BlendMode_Normal:
|
||||
default:
|
||||
if (i >= atlasNormalBlendMaterials.Num()) {
|
||||
if (foundPageIndex >= atlasNormalBlendMaterials.Num()) {
|
||||
clipper.clipEnd(*slot);
|
||||
continue;
|
||||
}
|
||||
material = atlasNormalBlendMaterials[i];
|
||||
material = atlasNormalBlendMaterials[foundPageIndex];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user