Browse Source

Merge branch '3.7' into 3.8-beta

badlogic 6 years ago
parent
commit
be3bceeee3

+ 1 - 0
CHANGELOG.md

@@ -162,6 +162,7 @@
   * 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`.
 * 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
 
 ## C# ##

+ 2 - 2
CMakeLists.txt

@@ -6,8 +6,8 @@ if(MSVC)
 	set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
 	set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
 else()
-	set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c89")
-	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
+	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 -Wshadow -std=c++03 -fno-exceptions -fno-rtti")
 endif()
 
 set(CMAKE_INSTALL_PREFIX "./")

+ 4 - 4
spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp

@@ -74,8 +74,8 @@ void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
 		return;
 	}
 
-	VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(slotAttachment);
-	if (!vertexAttachment->applyDeform(_attachment)) {
+	VertexAttachment *attachment = static_cast<VertexAttachment *>(slotAttachment);
+	if (!attachment->applyDeform(_attachment)) {
 		return;
 	}
 
@@ -100,9 +100,9 @@ void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
 			}
 			verticesArray.setSize(vertexCount, 0);
 			Vector<float> &vertices = verticesArray;
-			if (vertexAttachment->getBones().size() == 0) {
+			if (attachment->getBones().size() == 0) {
 				// Unweighted vertex positions.
-				Vector<float> &setupVertices = vertexAttachment->getVertices();
+				Vector<float> &setupVertices = attachment->getVertices();
 				for (size_t i = 0; i < vertexCount; i++)
 					vertices[i] += (setupVertices[i] - vertices[i]) * alpha;
 			} else {

+ 1 - 1
spine-cpp/spine-cpp/src/spine/IkConstraint.cpp

@@ -60,7 +60,7 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress
 	float sy = bone._ascaleY;
 	if (compress || stretch) {
 		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;
 			sx *= s;
 			if (uniform) sy *= s;

+ 1 - 1
spine-cpp/spine-cpp/src/spine/RTTI.cpp

@@ -63,4 +63,4 @@ bool RTTI::instanceOf(const RTTI &rtti) const {
 	}
 
 	return false;
-}
+}

+ 2 - 1
spine-cpp/spine-cpp/src/spine/Skeleton.cpp

@@ -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]);
 	}
 }

+ 5 - 5
spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp

@@ -144,9 +144,9 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
 	}
 
 	/* Bones. */
-	int bonesCount = readVarint(input, true);
-	skeletonData->_bones.setSize(bonesCount, 0);
-	for (int i = 0; i < bonesCount; ++i) {
+	int numBones = readVarint(input, true);
+	skeletonData->_bones.setSize(numBones, 0);
+	for (int i = 0; i < numBones; ++i) {
 		const char *name = readString(input);
 		BoneData *parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, true)];
 		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 (weighted) {
 							deform.setSize(deformLength, 0);
-							for (size_t i = 0; i < deformLength; ++i) {
-								deform[i] = 0;
+							for (size_t iiii = 0; iiii < deformLength; ++iiii) {
+								deform[iiii] = 0;
 							}
 						} else {
 							deform.clearAndAddAll(vertices);

+ 12 - 11
spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp

@@ -643,7 +643,8 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
 	}
 
 	/* 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];
 		Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(
 				linkedMesh->_skin);
@@ -1062,8 +1063,8 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
 				VertexAttachment *attachment = static_cast<VertexAttachment *>(baseAttachment);
 
 				weighted = attachment->_bones.size() != 0;
-				Vector<float> &vertices = attachment->_vertices;
-				deformLength = weighted ? vertices.size() / 3 * 2 : vertices.size();
+				Vector<float> &verts = attachment->_vertices;
+				deformLength = weighted ? verts.size() / 3 * 2 : verts.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) {
 					Json *vertices = Json::getItem(valueMap, "vertices");
-					Vector<float> deform;
+					Vector<float> deformed;
 					if (!vertices) {
 						if (weighted) {
-							deform.setSize(deformLength, 0);
+							deformed.setSize(deformLength, 0);
 						} else {
-							deform.clearAndAddAll(attachment->_vertices);
+							deformed.clearAndAddAll(attachment->_vertices);
 						}
 					} else {
 						int v, start = Json::getInt(valueMap, "offset", 0);
 						Json *vertex;
-						deform.setSize(deformLength, 0);
+						deformed.setSize(deformLength, 0);
 						if (_scale == 1) {
 							for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) {
-								deform[v] = vertex->_valueFloat;
+								deformed[v] = vertex->_valueFloat;
 							}
 						} else {
 							for (vertex = vertices->_child, v = start; vertex; vertex = vertex->_next, ++v) {
-								deform[v] = vertex->_valueFloat * _scale;
+								deformed[v] = vertex->_valueFloat * _scale;
 							}
 						}
 						if (!weighted) {
 							Vector<float> &verticesAttachment = attachment->_vertices;
 							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);
 				}
 

+ 4 - 4
spine-sfml/cpp/src/spine/spine-sfml.cpp

@@ -233,11 +233,11 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
 		if (vertexEffect != 0) {
 			tempUvs.clear();
 			tempColors.clear();
-			for (int i = 0; i < verticesCount; i++) {
+			for (int ii = 0; ii < verticesCount; ii++) {
 				Color vertexColor = light;
 				Color dark;
 				dark.r = dark.g = dark.b = dark.a = 0;
-				int index = i << 1;
+				int index = ii << 1;
 				float x = (*vertices)[index];
 				float y = (*vertices)[index + 1];
 				float u = (*uvs)[index];
@@ -250,8 +250,8 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
 				tempColors.add(vertexColor);
 			}
 
-			for (int i = 0; i < indicesCount; ++i) {
-				int index = (*indices)[i] << 1;
+			for (int ii = 0; ii < indicesCount; ++ii) {
+				int index = (*indices)[ii] << 1;
 				vertex.position.x = (*vertices)[index];
 				vertex.position.y = (*vertices)[index + 1];
 				vertex.texCoords.x = (*uvs)[index] * size.x;

+ 2 - 2
spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SSpineWidget.cpp

@@ -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);
 	}
 
-	FSlateBrush brush;
+	/*FSlateBrush brush;
 	brush.SetResourceObject(Material);
 	brush = widget->Brush;
 
@@ -218,7 +218,7 @@ void SSpineWidget::Flush(int32 LayerId, FSlateWindowElementList& OutDrawElements
 	if (shaderResource) {
 		FSlateResourceHandle resourceHandle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(brush);
 		FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, resourceHandle, renderData.VertexData, renderData.IndexData, nullptr, 0, 0);
-	}
+	}*/
 
 	Vertices.SetNum(0);
 	Indices.SetNum(0);

+ 2 - 2
spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp

@@ -34,8 +34,8 @@
 
 using namespace spine;
 
-void UTrackEntry::SetTrackEntry(TrackEntry* entry) {
-	this->entry = entry;
+void UTrackEntry::SetTrackEntry(TrackEntry* trackEntry) {
+	this->entry = trackEntry;
 	if (entry) entry->setRendererObject((void*)this);
 }
 

+ 2 - 2
spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp

@@ -136,8 +136,8 @@ SkeletonData* USpineSkeletonDataAsset::GetSkeletonData (Atlas* Atlas, bool Force
 
 AnimationStateData* USpineSkeletonDataAsset::GetAnimationStateData(Atlas* atlas) {
 	if (!animationStateData) {
-		SkeletonData* skeletonData = GetSkeletonData(atlas, false);
-		animationStateData = new (__FILE__, __LINE__) AnimationStateData(skeletonData);
+		SkeletonData* data = GetSkeletonData(atlas, false);
+		animationStateData = new (__FILE__, __LINE__) AnimationStateData(data);
 	}
 	for (auto& data : MixData) {
 		if (!data.From.IsEmpty() && !data.To.IsEmpty()) {

+ 1 - 1
spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Public/SpineSkeletonAnimationComponent.h

@@ -81,7 +81,7 @@ public:
 	
 	UTrackEntry () { }		
 
-	void SetTrackEntry (spine::TrackEntry* entry);
+	void SetTrackEntry (spine::TrackEntry* trackEntry);
 	spine::TrackEntry* GetTrackEntry() { return entry; }
 	
 	UFUNCTION(BlueprintCallable, Category="Components|Spine|TrackEntry")

+ 1 - 1
spine-ue4/SpineUE4.uproject

@@ -1,6 +1,6 @@
 {
 	"FileVersion": 3,
-	"EngineAssociation": "4.20",
+	"EngineAssociation": "4.21",
 	"Category": "",
 	"Description": "",
 	"Modules": [