mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.7' into 3.8-beta
This commit is contained in:
commit
be3bceeee3
@ -162,6 +162,7 @@
|
|||||||
* All C structs and enums `spXXX` have been replaced with their C++ equivalents `spine::XXX` in all public interfaces.
|
* All C structs and enums `spXXX` have been replaced with their C++ equivalents `spine::XXX` in all public interfaces.
|
||||||
* All instantiations via `new` of C++ classes from spine-cpp should contain `(__FILE__, __LINE__)`. This allows the tracking of instantations and detection of memory leaks via the `spine::DebugExtension`.
|
* All instantiations via `new` of C++ classes from spine-cpp should contain `(__FILE__, __LINE__)`. This allows the tracking of instantations and detection of memory leaks via the `spine::DebugExtension`.
|
||||||
* Updated to Unreal Engine 4.20 (samples require 4.17+), see the `spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/SpinePlugin.build.cs` file on how to compile in 4.20 with the latest UBT API changes.
|
* Updated to Unreal Engine 4.20 (samples require 4.17+), see the `spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/SpinePlugin.build.cs` file on how to compile in 4.20 with the latest UBT API changes.
|
||||||
|
* Updated to Unreal Engine 4.21 (samples require 4.21).
|
||||||
* **Breaking change**: `UBoneDriverComponent` and `UBoneFollowerComponent` are now `USceneComponent` instead of `UActorComponent`. They either update only themselves, or also the owning `UActor`, depending on whether the new flag `UseComponentTransform` is set. See https://github.com/EsotericSoftware/spine-runtimes/pull/1175
|
* **Breaking change**: `UBoneDriverComponent` and `UBoneFollowerComponent` are now `USceneComponent` instead of `UActorComponent`. They either update only themselves, or also the owning `UActor`, depending on whether the new flag `UseComponentTransform` is set. See https://github.com/EsotericSoftware/spine-runtimes/pull/1175
|
||||||
|
|
||||||
## C# ##
|
## C# ##
|
||||||
|
|||||||
@ -6,8 +6,8 @@ if(MSVC)
|
|||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
|
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
else()
|
else()
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c89")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Wshadow -std=c89")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -Wshadow -std=c++03 -fno-exceptions -fno-rtti")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "./")
|
set(CMAKE_INSTALL_PREFIX "./")
|
||||||
|
|||||||
@ -74,8 +74,8 @@ void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(slotAttachment);
|
VertexAttachment *attachment = static_cast<VertexAttachment *>(slotAttachment);
|
||||||
if (!vertexAttachment->applyDeform(_attachment)) {
|
if (!attachment->applyDeform(_attachment)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,9 +100,9 @@ void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
|
|||||||
}
|
}
|
||||||
verticesArray.setSize(vertexCount, 0);
|
verticesArray.setSize(vertexCount, 0);
|
||||||
Vector<float> &vertices = verticesArray;
|
Vector<float> &vertices = verticesArray;
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (attachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions.
|
// Unweighted vertex positions.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Vector<float> &setupVertices = attachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++)
|
for (size_t i = 0; i < vertexCount; i++)
|
||||||
vertices[i] += (setupVertices[i] - vertices[i]) * alpha;
|
vertices[i] += (setupVertices[i] - vertices[i]) * alpha;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress
|
|||||||
float sy = bone._ascaleY;
|
float sy = bone._ascaleY;
|
||||||
if (compress || stretch) {
|
if (compress || stretch) {
|
||||||
float b = bone._data.getLength() * sx, dd = MathUtil::sqrt(tx * tx + ty * ty);
|
float b = bone._data.getLength() * sx, dd = MathUtil::sqrt(tx * tx + ty * ty);
|
||||||
if ((compress && dd < b) || (stretch && dd > b) && b > 0.0001f) {
|
if (((compress && dd < b) || (stretch && dd > b)) && (b > 0.0001f)) {
|
||||||
float s = (dd / b - 1) * alpha + 1;
|
float s = (dd / b - 1) * alpha + 1;
|
||||||
sx *= s;
|
sx *= s;
|
||||||
if (uniform) sy *= s;
|
if (uniform) sy *= s;
|
||||||
|
|||||||
@ -176,7 +176,8 @@ void Skeleton::updateCache() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0, n = _bones.size(); i < n; ++i) {
|
size_t n = _bones.size();
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
sortBone(_bones[i]);
|
sortBone(_bones[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,9 +144,9 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Bones. */
|
/* Bones. */
|
||||||
int bonesCount = readVarint(input, true);
|
int numBones = readVarint(input, true);
|
||||||
skeletonData->_bones.setSize(bonesCount, 0);
|
skeletonData->_bones.setSize(numBones, 0);
|
||||||
for (int i = 0; i < bonesCount; ++i) {
|
for (int i = 0; i < numBones; ++i) {
|
||||||
const char *name = readString(input);
|
const char *name = readString(input);
|
||||||
BoneData *parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, true)];
|
BoneData *parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, true)];
|
||||||
BoneData *data = new(__FILE__, __LINE__) BoneData(i, String(name, true), parent);
|
BoneData *data = new(__FILE__, __LINE__) BoneData(i, String(name, true), parent);
|
||||||
@ -916,8 +916,8 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
if (end == 0) {
|
if (end == 0) {
|
||||||
if (weighted) {
|
if (weighted) {
|
||||||
deform.setSize(deformLength, 0);
|
deform.setSize(deformLength, 0);
|
||||||
for (size_t i = 0; i < deformLength; ++i) {
|
for (size_t iiii = 0; iiii < deformLength; ++iiii) {
|
||||||
deform[i] = 0;
|
deform[iiii] = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
deform.clearAndAddAll(vertices);
|
deform.clearAndAddAll(vertices);
|
||||||
|
|||||||
@ -643,7 +643,8 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Linked meshes. */
|
/* Linked meshes. */
|
||||||
for (int i = 0, n = _linkedMeshes.size(); i < n; ++i) {
|
int n = _linkedMeshes.size();
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
LinkedMesh *linkedMesh = _linkedMeshes[i];
|
LinkedMesh *linkedMesh = _linkedMeshes[i];
|
||||||
Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(
|
Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(
|
||||||
linkedMesh->_skin);
|
linkedMesh->_skin);
|
||||||
@ -1062,8 +1063,8 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
|
|||||||
VertexAttachment *attachment = static_cast<VertexAttachment *>(baseAttachment);
|
VertexAttachment *attachment = static_cast<VertexAttachment *>(baseAttachment);
|
||||||
|
|
||||||
weighted = attachment->_bones.size() != 0;
|
weighted = attachment->_bones.size() != 0;
|
||||||
Vector<float> &vertices = attachment->_vertices;
|
Vector<float> &verts = attachment->_vertices;
|
||||||
deformLength = weighted ? vertices.size() / 3 * 2 : vertices.size();
|
deformLength = weighted ? verts.size() / 3 * 2 : verts.size();
|
||||||
|
|
||||||
timeline = new(__FILE__, __LINE__) DeformTimeline(timelineMap->_size);
|
timeline = new(__FILE__, __LINE__) DeformTimeline(timelineMap->_size);
|
||||||
|
|
||||||
@ -1072,34 +1073,34 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
|
|||||||
|
|
||||||
for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
||||||
Json *vertices = Json::getItem(valueMap, "vertices");
|
Json *vertices = Json::getItem(valueMap, "vertices");
|
||||||
Vector<float> deform;
|
Vector<float> deformed;
|
||||||
if (!vertices) {
|
if (!vertices) {
|
||||||
if (weighted) {
|
if (weighted) {
|
||||||
deform.setSize(deformLength, 0);
|
deformed.setSize(deformLength, 0);
|
||||||
} else {
|
} else {
|
||||||
deform.clearAndAddAll(attachment->_vertices);
|
deformed.clearAndAddAll(attachment->_vertices);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int v, start = Json::getInt(valueMap, "offset", 0);
|
int v, start = Json::getInt(valueMap, "offset", 0);
|
||||||
Json *vertex;
|
Json *vertex;
|
||||||
deform.setSize(deformLength, 0);
|
deformed.setSize(deformLength, 0);
|
||||||
if (_scale == 1) {
|
if (_scale == 1) {
|
||||||
for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) {
|
for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) {
|
||||||
deform[v] = vertex->_valueFloat;
|
deformed[v] = vertex->_valueFloat;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) {
|
for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) {
|
||||||
deform[v] = vertex->_valueFloat * _scale;
|
deformed[v] = vertex->_valueFloat * _scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!weighted) {
|
if (!weighted) {
|
||||||
Vector<float> &verticesAttachment = attachment->_vertices;
|
Vector<float> &verticesAttachment = attachment->_vertices;
|
||||||
for (v = 0; v < deformLength; ++v) {
|
for (v = 0; v < deformLength; ++v) {
|
||||||
deform[v] += verticesAttachment[v];
|
deformed[v] += verticesAttachment[v];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), deform);
|
timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), deformed);
|
||||||
readCurve(valueMap, timeline, frameIndex);
|
readCurve(valueMap, timeline, frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -233,11 +233,11 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
|
|||||||
if (vertexEffect != 0) {
|
if (vertexEffect != 0) {
|
||||||
tempUvs.clear();
|
tempUvs.clear();
|
||||||
tempColors.clear();
|
tempColors.clear();
|
||||||
for (int i = 0; i < verticesCount; i++) {
|
for (int ii = 0; ii < verticesCount; ii++) {
|
||||||
Color vertexColor = light;
|
Color vertexColor = light;
|
||||||
Color dark;
|
Color dark;
|
||||||
dark.r = dark.g = dark.b = dark.a = 0;
|
dark.r = dark.g = dark.b = dark.a = 0;
|
||||||
int index = i << 1;
|
int index = ii << 1;
|
||||||
float x = (*vertices)[index];
|
float x = (*vertices)[index];
|
||||||
float y = (*vertices)[index + 1];
|
float y = (*vertices)[index + 1];
|
||||||
float u = (*uvs)[index];
|
float u = (*uvs)[index];
|
||||||
@ -250,8 +250,8 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
|
|||||||
tempColors.add(vertexColor);
|
tempColors.add(vertexColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < indicesCount; ++i) {
|
for (int ii = 0; ii < indicesCount; ++ii) {
|
||||||
int index = (*indices)[i] << 1;
|
int index = (*indices)[ii] << 1;
|
||||||
vertex.position.x = (*vertices)[index];
|
vertex.position.x = (*vertices)[index];
|
||||||
vertex.position.y = (*vertices)[index + 1];
|
vertex.position.y = (*vertices)[index + 1];
|
||||||
vertex.texCoords.x = (*uvs)[index] * size.x;
|
vertex.texCoords.x = (*uvs)[index] * size.x;
|
||||||
|
|||||||
@ -210,7 +210,7 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList& OutDrawElements
|
|||||||
setVertex(&vertexData[i], Vertices[i].X, Vertices[i].Y, Uvs[i].X, Uvs[i].Y, Colors[i], offset);
|
setVertex(&vertexData[i], Vertices[i].X, Vertices[i].Y, Uvs[i].X, Uvs[i].Y, Colors[i], offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
FSlateBrush brush;
|
/*FSlateBrush brush;
|
||||||
brush.SetResourceObject(Material);
|
brush.SetResourceObject(Material);
|
||||||
brush = widget->Brush;
|
brush = widget->Brush;
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList& OutDrawElements
|
|||||||
if (shaderResource) {
|
if (shaderResource) {
|
||||||
FSlateResourceHandle resourceHandle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(brush);
|
FSlateResourceHandle resourceHandle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(brush);
|
||||||
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, resourceHandle, renderData.VertexData, renderData.IndexData, nullptr, 0, 0);
|
FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, resourceHandle, renderData.VertexData, renderData.IndexData, nullptr, 0, 0);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
Vertices.SetNum(0);
|
Vertices.SetNum(0);
|
||||||
Indices.SetNum(0);
|
Indices.SetNum(0);
|
||||||
|
|||||||
@ -34,8 +34,8 @@
|
|||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
void UTrackEntry::SetTrackEntry(TrackEntry* entry) {
|
void UTrackEntry::SetTrackEntry(TrackEntry* trackEntry) {
|
||||||
this->entry = entry;
|
this->entry = trackEntry;
|
||||||
if (entry) entry->setRendererObject((void*)this);
|
if (entry) entry->setRendererObject((void*)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -136,8 +136,8 @@ SkeletonData* USpineSkeletonDataAsset::GetSkeletonData (Atlas* Atlas, bool Force
|
|||||||
|
|
||||||
AnimationStateData* USpineSkeletonDataAsset::GetAnimationStateData(Atlas* atlas) {
|
AnimationStateData* USpineSkeletonDataAsset::GetAnimationStateData(Atlas* atlas) {
|
||||||
if (!animationStateData) {
|
if (!animationStateData) {
|
||||||
SkeletonData* skeletonData = GetSkeletonData(atlas, false);
|
SkeletonData* data = GetSkeletonData(atlas, false);
|
||||||
animationStateData = new (__FILE__, __LINE__) AnimationStateData(skeletonData);
|
animationStateData = new (__FILE__, __LINE__) AnimationStateData(data);
|
||||||
}
|
}
|
||||||
for (auto& data : MixData) {
|
for (auto& data : MixData) {
|
||||||
if (!data.From.IsEmpty() && !data.To.IsEmpty()) {
|
if (!data.From.IsEmpty() && !data.To.IsEmpty()) {
|
||||||
|
|||||||
@ -81,7 +81,7 @@ public:
|
|||||||
|
|
||||||
UTrackEntry () { }
|
UTrackEntry () { }
|
||||||
|
|
||||||
void SetTrackEntry (spine::TrackEntry* entry);
|
void SetTrackEntry (spine::TrackEntry* trackEntry);
|
||||||
spine::TrackEntry* GetTrackEntry() { return entry; }
|
spine::TrackEntry* GetTrackEntry() { return entry; }
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category="Components|Spine|TrackEntry")
|
UFUNCTION(BlueprintCallable, Category="Components|Spine|TrackEntry")
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"FileVersion": 3,
|
"FileVersion": 3,
|
||||||
"EngineAssociation": "4.20",
|
"EngineAssociation": "4.21",
|
||||||
"Category": "",
|
"Category": "",
|
||||||
"Description": "",
|
"Description": "",
|
||||||
"Modules": [
|
"Modules": [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user