瀏覽代碼

Merge branch '3.7-beta' of https://github.com/esotericsoftware/spine-runtimes into 3.7-beta

badlogic 7 年之前
父節點
當前提交
75403b9e66
共有 24 個文件被更改,包括 502 次插入76 次删除
  1. 38 34
      spine-c/spine-c/include/spine/dll.h
  2. 7 5
      spine-c/spine-c/include/spine/extension.h
  3. 9 19
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java
  4. 90 0
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDrawable.java
  5. 76 0
      spine-starling/spine-starling-example/src/spine/examples/Shape.as
  6. 27 2
      spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as
  7. 45 0
      spine-ue4/Config/DefaultEngine.ini
  8. 二進制
      spine-ue4/Content/Test/Assets/NewMaterial.uasset
  9. 二進制
      spine-ue4/Content/Test/Blueprints/Plane_Blueprint.uasset
  10. 二進制
      spine-ue4/Content/Test/Blueprints/TwoColor_Blueprint.uasset
  11. 二進制
      spine-ue4/Content/Test/Test.umap
  12. 二進制
      spine-ue4/Content/Test/Test_BuiltData.uasset
  13. 1 1
      spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Private/RuntimeMeshComponent.cpp
  14. 0 1
      spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineAtlasImportFactory.cpp
  15. 4 4
      spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineEditorPlugin.cpp
  16. 0 1
      spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineSkeletonImportFactory.cpp
  17. 1 1
      spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/SpineEditorPlugin.Build.cs
  18. 21 1
      spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePlugin.cpp
  19. 3 7
      spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs
  20. 9 0
      spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha.meta
  21. 56 0
      spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader
  22. 9 0
      spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader.meta
  23. 99 0
      spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader
  24. 7 0
      spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader.meta

+ 38 - 34
spine-c/spine-c/include/spine/dll.h

@@ -1,48 +1,52 @@
 /******************************************************************************
 /******************************************************************************
- * Spine Runtimes Software License v2.5
- *
- * Copyright (c) 2013-2016, Esoteric Software
- * All rights reserved.
- *
- * You are granted a perpetual, non-exclusive, non-sublicensable, and
- * non-transferable license to use, install, execute, and perform the Spine
- * Runtimes software and derivative works solely for personal or internal
- * use. Without the written permission of Esoteric Software (see Section 2 of
- * the Spine Software License Agreement), you may not (a) modify, translate,
- * adapt, or develop new applications using the Spine Runtimes or otherwise
- * create derivative works or improvements of the Spine Runtimes or (b) remove,
- * delete, alter, or obscure any trademarks or any copyright, trademark, patent,
- * or other intellectual property or proprietary rights notices on or in the
- * Software, including any copy thereof. Redistributions in binary or source
- * form must include this license and terms.
- *
- * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
- * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
+* Spine Runtimes Software License v2.5
+*
+* Copyright (c) 2013-2016, Esoteric Software
+* All rights reserved.
+*
+* You are granted a perpetual, non-exclusive, non-sublicensable, and
+* non-transferable license to use, install, execute, and perform the Spine
+* Runtimes software and derivative works solely for personal or internal
+* use. Without the written permission of Esoteric Software (see Section 2 of
+* the Spine Software License Agreement), you may not (a) modify, translate,
+* adapt, or develop new applications using the Spine Runtimes or otherwise
+* create derivative works or improvements of the Spine Runtimes or (b) remove,
+* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
+* or other intellectual property or proprietary rights notices on or in the
+* Software, including any copy thereof. Redistributions in binary or source
+* form must include this license and terms.
+*
+* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
+* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************/
 
 
 #ifndef SPINE_SHAREDLIB_H
 #ifndef SPINE_SHAREDLIB_H
 #define SPINE_SHAREDLIB_H
 #define SPINE_SHAREDLIB_H
 
 
 #ifdef _WIN32
 #ifdef _WIN32
-	#define DLLIMPORT __declspec(dllimport)
-	#define DLLEXPORT __declspec(dllexport)
+#define DLLIMPORT __declspec(dllimport)
+#define DLLEXPORT __declspec(dllexport)
 #else
 #else
-	#define DLLIMPORT
-	#define DLLEXPORT
+#ifndef DLLIMPORT
+#define DLLIMPORT
+#endif
+#ifndef DLLEXPORT
+#define DLLEXPORT
+#endif
 #endif
 #endif
 
 
 #ifdef SPINEPLUGIN_API
 #ifdef SPINEPLUGIN_API
-	#define SP_API SPINEPLUGIN_API
+#define SP_API SPINEPLUGIN_API
 #else
 #else
-	#define SP_API
+#define SP_API
 #endif
 #endif
 
 
 #endif /* SPINE_SHAREDLIB_H */
 #endif /* SPINE_SHAREDLIB_H */

+ 7 - 5
spine-c/spine-c/include/spine/extension.h

@@ -61,6 +61,8 @@
 #ifndef SPINE_EXTENSION_H_
 #ifndef SPINE_EXTENSION_H_
 #define SPINE_EXTENSION_H_
 #define SPINE_EXTENSION_H_
 
 
+#include <spine/dll.h>
+
 /* All allocation uses these. */
 /* All allocation uses these. */
 #define MALLOC(TYPE,COUNT) ((TYPE*)_spMalloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
 #define MALLOC(TYPE,COUNT) ((TYPE*)_spMalloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
 #define CALLOC(TYPE,COUNT) ((TYPE*)_spCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__))
 #define CALLOC(TYPE,COUNT) ((TYPE*)_spCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__))
@@ -170,11 +172,11 @@ void* _spRealloc(void* ptr, size_t size);
 void _spFree (void* ptr);
 void _spFree (void* ptr);
 float _spRandom ();
 float _spRandom ();
 
 
-void _spSetMalloc (void* (*_malloc) (size_t size));
-void _spSetDebugMalloc (void* (*_malloc) (size_t size, const char* file, int line));
-void _spSetRealloc(void* (*_realloc) (void* ptr, size_t size));
-void _spSetFree (void (*_free) (void* ptr));
-void _spSetRandom(float (*_random) ());
+SP_API void _spSetMalloc (void* (*_malloc) (size_t size));
+SP_API void _spSetDebugMalloc (void* (*_malloc) (size_t size, const char* file, int line));
+SP_API void _spSetRealloc(void* (*_realloc) (void* ptr, size_t size));
+SP_API void _spSetFree (void (*_free) (void* ptr));
+SP_API void _spSetRandom(float (*_random) ());
 
 
 char* _spReadFile (const char* path, int* length);
 char* _spReadFile (const char* path, int* length);
 
 

+ 9 - 19
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java

@@ -62,6 +62,14 @@ public class SkeletonRenderer {
 	private final Color temp6 = new Color();
 	private final Color temp6 = new Color();
 
 
 	public void draw (Batch batch, Skeleton skeleton) {
 	public void draw (Batch batch, Skeleton skeleton) {
+		if (batch instanceof PolygonSpriteBatch) {
+			draw((PolygonSpriteBatch)batch, skeleton);
+			return;
+		} else if (batch instanceof TwoColorPolygonBatch) {
+			draw((TwoColorPolygonBatch)batch, skeleton);
+			return;
+		}
+
 		VertexEffect vertexEffect = this.vertexEffect;
 		VertexEffect vertexEffect = this.vertexEffect;
 		if (vertexEffect != null) vertexEffect.begin(skeleton);
 		if (vertexEffect != null) vertexEffect.begin(skeleton);
 
 
@@ -205,8 +213,7 @@ public class SkeletonRenderer {
 					FloatArray clippedVertices = clipper.getClippedVertices();
 					FloatArray clippedVertices = clipper.getClippedVertices();
 					ShortArray clippedTriangles = clipper.getClippedTriangles();
 					ShortArray clippedTriangles = clipper.getClippedTriangles();
 					if (vertexEffect != null) applyVertexEffect(clippedVertices.items, clippedVertices.size, 5, c, 0);
 					if (vertexEffect != null) applyVertexEffect(clippedVertices.items, clippedVertices.size, 5, c, 0);
-					printAttachmentVertices(attachment.getName() + " (clipped)", clippedVertices.items, clippedVertices.size, clippedTriangles.items, clippedTriangles.size);
-					batch.draw(texture, clippedVertices.items, 0, clippedVertices.size / 5, clippedTriangles.items, 0,
+					batch.draw(texture, clippedVertices.items, 0, clippedVertices.size, clippedTriangles.items, 0,
 						clippedTriangles.size);
 						clippedTriangles.size);
 				} else {
 				} else {
 					if (vertexEffect != null) {
 					if (vertexEffect != null) {
@@ -233,7 +240,6 @@ public class SkeletonRenderer {
 							vertices[v + 2] = uvs[u + 1];
 							vertices[v + 2] = uvs[u + 1];
 						}
 						}
 					}
 					}
-					printAttachmentVertices(attachment.getName(), vertices, verticesLength / 5, triangles, triangles.length);
 					batch.draw(texture, vertices, 0, verticesLength, triangles, 0, triangles.length);
 					batch.draw(texture, vertices, 0, verticesLength, triangles, 0, triangles.length);
 				}
 				}
 			}
 			}
@@ -242,22 +248,6 @@ public class SkeletonRenderer {
 		}
 		}
 		clipper.clipEnd();
 		clipper.clipEnd();
 		if (vertexEffect != null) vertexEffect.end();
 		if (vertexEffect != null) vertexEffect.end();
-		System.out.println("=====================\n");
-	}
-	
-	private void printAttachmentVertices(String name, float[] vertices, int vertexCount, short[] triangles, int triangleCount) {
-		System.out.println("attachment: " + name);
-		System.out.print("indices (" + triangleCount + "): ");
-		for(int i = 0; i < triangleCount; i++) {
-			System.out.print(triangles[i] + " ");
-		}
-		
-		System.out.print("\nvertices (" + vertexCount + "): ");
-		for(int i = 0; i < triangleCount; i++) {
-			int index = triangles[i] * 5;			
-			System.out.print((int)vertices[index] + " " + ((int)vertices[index + 1] + " "));
-		}
-		System.out.println("\n");
 	}
 	}
 
 
 	@SuppressWarnings("null")
 	@SuppressWarnings("null")

+ 90 - 0
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDrawable.java

@@ -0,0 +1,90 @@
+/******************************************************************************
+ * Spine Runtimes Software License v2.5
+ *
+ * Copyright (c) 2013-2016, Esoteric Software
+ * All rights reserved.
+ *
+ * You are granted a perpetual, non-exclusive, non-sublicensable, and
+ * non-transferable license to use, install, execute, and perform the Spine
+ * Runtimes software and derivative works solely for personal or internal
+ * use. Without the written permission of Esoteric Software (see Section 2 of
+ * the Spine Software License Agreement), you may not (a) modify, translate,
+ * adapt, or develop new applications using the Spine Runtimes or otherwise
+ * create derivative works or improvements of the Spine Runtimes or (b) remove,
+ * delete, alter, or obscure any trademarks or any copyright, trademark, patent,
+ * or other intellectual property or proprietary rights notices on or in the
+ * Software, including any copy thereof. Redistributions in binary or source
+ * form must include this license and terms.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
+ * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *****************************************************************************/
+
+package com.esotericsoftware.spine.utils;
+
+import com.badlogic.gdx.graphics.g2d.Batch;
+import com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable;
+import com.esotericsoftware.spine.AnimationState;
+import com.esotericsoftware.spine.Skeleton;
+import com.esotericsoftware.spine.SkeletonRenderer;
+
+/** A scene2d drawable that draws a skeleton. The animation state and skeleton must be updated each frame, or
+ * {@link #update(float)} called each frame. */
+public class SkeletonDrawable extends BaseDrawable {
+	private SkeletonRenderer renderer;
+	private Skeleton skeleton;
+	AnimationState state;
+
+	/** Creates an uninitialized SkeletonDrawable. The renderer, skeleton, and animation state must be set before use. */
+	public SkeletonDrawable () {
+	}
+
+	public SkeletonDrawable (SkeletonRenderer renderer, Skeleton skeleton, AnimationState state) {
+		this.renderer = renderer;
+		this.skeleton = skeleton;
+		this.state = state;
+	}
+
+	public void update (float delta) {
+		state.update(delta);
+		state.apply(skeleton);
+	}
+
+	public void draw (Batch batch, float x, float y, float width, float height) {
+		skeleton.setPosition(x, y);
+		skeleton.updateWorldTransform();
+		renderer.draw(batch, skeleton);
+	}
+
+	public SkeletonRenderer getRenderer () {
+		return renderer;
+	}
+
+	public void setRenderer (SkeletonRenderer renderer) {
+		this.renderer = renderer;
+	}
+
+	public Skeleton getSkeleton () {
+		return skeleton;
+	}
+
+	public void setSkeleton (Skeleton skeleton) {
+		this.skeleton = skeleton;
+	}
+
+	public AnimationState getAnimationState () {
+		return state;
+	}
+
+	public void setAnimationState (AnimationState state) {
+		this.state = state;
+	}
+}

+ 76 - 0
spine-starling/spine-starling-example/src/spine/examples/Shape.as

@@ -0,0 +1,76 @@
+package spine.examples {
+	import starling.animation.IAnimatable;
+	import starling.textures.Texture;
+	import flash.display.BitmapData;
+	import flash.geom.Point;
+	import spine.starling.SkeletonMesh;
+
+	import starling.display.DisplayObject;
+	import starling.rendering.IndexData;
+	import starling.rendering.Painter;
+	import starling.utils.Color;
+
+	
+	public class Shape extends DisplayObject implements IAnimatable {
+		private var r: Number = 1, g: Number = 1, b: Number = 1, a: Number = 1;
+		private var mesh: SkeletonMesh;
+		private var vertices: Vector.<Number>;
+		
+		public function Shape() {
+			var bitmapData: BitmapData = new BitmapData(16, 16, false, 0xffffffff);
+			mesh = new SkeletonMesh(Texture.fromBitmapData(bitmapData));			
+			setVertices(new <Number>[0, 0, 100, 0, 100, 100, 0, 100]);
+			setColor(1, 0, 0, 1);
+		}
+		
+		public function setVertices(vertices: Vector.<Number>): void {
+			this.vertices = vertices;
+		}
+		
+		public function setColor(r: Number, g: Number, b: Number, a: Number): void {
+			this.r = r;
+			this.g = g;
+			this.b = b;
+			this.a = a;
+		}
+		
+		override public function render(painter : Painter) : void {
+			var indices: IndexData = mesh.getIndexData();
+			var idx: int = 0;
+			var x:Number = vertices[0], y:Number = vertices[1];			
+			for (var i:int = 2; i < vertices.length - 2; i+=2) {
+				var x2:Number = vertices[i], y2:Number = vertices[i+1]; 
+				var x3:Number = vertices[i+2], y3:Number = vertices[i+3];
+				indices.setIndex(idx, idx);
+				indices.setIndex(idx+1, idx+1);
+				indices.setIndex(idx+2, idx+2);
+				mesh.setVertexPosition(idx, x, y);
+				mesh.setTexCoords(idx++, 0, 0);
+				mesh.setVertexPosition(idx, x2, y2);
+				mesh.setTexCoords(idx++, 0, 0);
+				mesh.setVertexPosition(idx, x3, y3);
+				mesh.setTexCoords(idx++, 0, 0);					
+			}			
+			indices.numIndices = idx;
+			indices.trim();
+			mesh.getVertexData().numVertices = idx;
+			
+			var rgb: uint = Color.rgb(r * 255, g * 255, b * 255);
+			var alpha: uint = a * 255;	
+			mesh.getVertexData().colorize("color", 0xffffffff, 0xff);
+						
+			mesh.setVertexDataChanged();
+			mesh.setIndexDataChanged();
+					
+			painter.batchMesh(mesh);			
+		}
+		
+		public function advanceTime(time : Number) : void {
+			this.setRequiresRedraw();	
+		}
+		
+		override public function hitTest(localPoint : Point) : DisplayObject {
+			return null;
+		}
+	}
+}

+ 27 - 2
spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as

@@ -29,6 +29,10 @@
  *****************************************************************************/
  *****************************************************************************/
  
  
 package spine.examples {
 package spine.examples {
+	import starling.display.Image;
+	import starling.textures.Texture;
+	import flash.display.BitmapData;
+	import spine.attachments.BoundingBoxAttachment;
 	import spine.*;
 	import spine.*;
 	import spine.animation.AnimationStateData;
 	import spine.animation.AnimationStateData;
 	import spine.animation.TrackEntry;
 	import spine.animation.TrackEntry;
@@ -54,7 +58,8 @@ package spine.examples {
 
 
 		[Embed(source = "/spineboy.png")]
 		[Embed(source = "/spineboy.png")]
 		static public const SpineboyAtlasTexture : Class;
 		static public const SpineboyAtlasTexture : Class;
-		private var skeleton : SkeletonAnimation;		
+		private var skeleton : SkeletonAnimation;
+		private var shape: Shape;	
 
 
 		public function SpineboyExample() {
 		public function SpineboyExample() {
 			var spineAtlas : Atlas = new Atlas(new SpineboyAtlas(), new StarlingTextureLoader(new SpineboyAtlasTexture()));
 			var spineAtlas : Atlas = new Atlas(new SpineboyAtlas(), new StarlingTextureLoader(new SpineboyAtlasTexture()));
@@ -71,6 +76,7 @@ package spine.examples {
 			skeleton = new SkeletonAnimation(skeletonData, stateData);
 			skeleton = new SkeletonAnimation(skeletonData, stateData);
 			skeleton.x = 400;
 			skeleton.x = 400;
 			skeleton.y = 560;
 			skeleton.y = 560;
+			skeleton.scale = 0.5;
 
 
 			skeleton.state.onStart.add(function(entry : TrackEntry) : void {
 			skeleton.state.onStart.add(function(entry : TrackEntry) : void {
 				trace(entry.trackIndex + " start: " + entry.animation.name);
 				trace(entry.trackIndex + " start: " + entry.animation.name);
@@ -97,10 +103,29 @@ package spine.examples {
 			skeleton.state.addAnimationByName(0, "run", true, 0);
 			skeleton.state.addAnimationByName(0, "run", true, 0);
 
 
 			addChild(skeleton);
 			addChild(skeleton);
-			Starling.juggler.add(skeleton);
+			Starling.juggler.add(skeleton);				
+			
+			shape = new Shape();
+			shape.setVertices(new <Number>[0, 0, 400, 600, 800, 0]);
+			shape.setColor(1, 0, 0, 1);
+			addChild(shape);
+			Starling.juggler.add(shape);
 
 
+			addEventListener(starling.events.Event.ENTER_FRAME, onUpdate);
 			addEventListener(TouchEvent.TOUCH, onClick);
 			addEventListener(TouchEvent.TOUCH, onClick);
 		}
 		}
+		
+		private function onUpdate() : void {
+			var slot:Slot = skeleton.skeleton.findSlot("head-bb");
+			var bb:BoundingBoxAttachment = skeleton.skeleton.getAttachmentForSlotIndex(slot.data.index, "head") as BoundingBoxAttachment;
+			var worldVertices:Vector.<Number> = new Vector.<Number>(bb.worldVerticesLength);
+			bb.computeWorldVertices(slot, 0, bb.worldVerticesLength, worldVertices, 0, 2);
+			for (var i:int = 0; i < worldVertices.length; i+=2) {
+				worldVertices[i] = worldVertices[i] * skeleton.scale + skeleton.x;
+				worldVertices[i + 1] = worldVertices[i + 1] * skeleton.scale + skeleton.y;
+			}
+			shape.setVertices(worldVertices);
+		}
 
 
 		private function onClick(event : TouchEvent) : void {
 		private function onClick(event : TouchEvent) : void {
 			var touch : Touch = event.getTouch(this);
 			var touch : Touch = event.getTouch(this);

+ 45 - 0
spine-ue4/Config/DefaultEngine.ini

@@ -6,4 +6,49 @@ AppliedTargetedHardwareClass=Desktop
 DefaultGraphicsPerformance=Maximum
 DefaultGraphicsPerformance=Maximum
 AppliedDefaultGraphicsPerformance=Maximum
 AppliedDefaultGraphicsPerformance=Maximum
 
 
+[/Script/EngineSettings.GameMapsSettings]
+GameDefaultMap=/Game/Test/Test.Test
+GlobalDefaultGameMode=/Game/Test/Blueprints/TouchClick.TouchClick_C
+
+[/Script/Engine.PhysicsSettings]
+DefaultGravityZ=-980.000000
+DefaultTerminalVelocity=4000.000000
+DefaultFluidFriction=0.300000
+SimulateScratchMemorySize=262144
+RagdollAggregateThreshold=4
+TriangleMeshTriangleMinAreaThreshold=5.000000
+bEnableAsyncScene=False
+bEnableShapeSharing=False
+bEnablePCM=True
+bEnableStabilization=False
+bWarnMissingLocks=True
+bEnable2DPhysics=False
+LockedAxis=Invalid
+DefaultDegreesOfFreedom=Full3D
+BounceThresholdVelocity=200.000000
+FrictionCombineMode=Average
+RestitutionCombineMode=Average
+MaxAngularVelocity=3600.000000
+MaxDepenetrationVelocity=0.000000
+ContactOffsetMultiplier=0.020000
+MinContactOffset=2.000000
+MaxContactOffset=8.000000
+bSimulateSkeletalMeshOnDedicatedServer=True
+DefaultShapeComplexity=CTF_UseSimpleAndComplex
+bDefaultHasComplexCollision=True
+bSuppressFaceRemapTable=False
+bSupportUVFromHitResults=False
+bDisableActiveActors=False
+bDisableCCD=False
+bEnableEnhancedDeterminism=False
+MaxPhysicsDeltaTime=0.033333
+bSubstepping=False
+bSubsteppingAsync=False
+MaxSubstepDeltaTime=0.016667
+MaxSubsteps=6
+SyncSceneSmoothingFactor=0.000000
+AsyncSceneSmoothingFactor=0.990000
+InitialAverageFrameRate=0.016667
+PhysXTreeRebuildRate=10
+
 
 

二進制
spine-ue4/Content/Test/Assets/NewMaterial.uasset


二進制
spine-ue4/Content/Test/Blueprints/Plane_Blueprint.uasset


二進制
spine-ue4/Content/Test/Blueprints/TwoColor_Blueprint.uasset


二進制
spine-ue4/Content/Test/Test.umap


二進制
spine-ue4/Content/Test/Test_BuiltData.uasset


+ 1 - 1
spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Private/RuntimeMeshComponent.cpp

@@ -1778,7 +1778,7 @@ void URuntimeMeshComponent::UpdateCollision()
 	BodySetup->BodySetupGuid = FGuid::NewGuid();
 	BodySetup->BodySetupGuid = FGuid::NewGuid();
 
 
 
 
-#if WITH_RUNTIME_PHYSICS_COOKING || WITH_EDITOR
+#if WITH_RUNTIME_PHYSICS_COOKING || WITH_PHYSX || WITH_EDITOR
 	// Clear current mesh data
 	// Clear current mesh data
 	BodySetup->InvalidatePhysicsData();
 	BodySetup->InvalidatePhysicsData();
 	// Create new mesh data
 	// Create new mesh data

+ 0 - 1
spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineAtlasImportFactory.cpp

@@ -37,7 +37,6 @@
 #include "Developer/AssetTools/Public/IAssetTools.h"
 #include "Developer/AssetTools/Public/IAssetTools.h"
 #include "Developer/DesktopPlatform/Public/IDesktopPlatform.h"
 #include "Developer/DesktopPlatform/Public/IDesktopPlatform.h"
 #include "Developer/DesktopPlatform/Public/DesktopPlatformModule.h"
 #include "Developer/DesktopPlatform/Public/DesktopPlatformModule.h"
-#include "spine/spine.h"
 #include <string>
 #include <string>
 #include <string.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdlib.h>

+ 4 - 4
spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineEditorPlugin.cpp

@@ -39,11 +39,11 @@ class FSpineEditorPlugin: public ISpineEditorPlugin {
 
 
 IMPLEMENT_MODULE(FSpineEditorPlugin, ISpineEditorPlugin)
 IMPLEMENT_MODULE(FSpineEditorPlugin, ISpineEditorPlugin)
 
 
+void FSpineEditorPlugin::StartupModule () {
+}
 
 
-
-void FSpineEditorPlugin::StartupModule () { }
-
-void FSpineEditorPlugin::ShutdownModule () { }
+void FSpineEditorPlugin::ShutdownModule () {
+}
 
 
 
 
 
 

+ 0 - 1
spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/Private/SpineSkeletonImportFactory.cpp

@@ -37,7 +37,6 @@
 #include "Developer/AssetTools/Public/IAssetTools.h"
 #include "Developer/AssetTools/Public/IAssetTools.h"
 #include "Developer/DesktopPlatform/Public/IDesktopPlatform.h"
 #include "Developer/DesktopPlatform/Public/IDesktopPlatform.h"
 #include "Developer/DesktopPlatform/Public/DesktopPlatformModule.h"
 #include "Developer/DesktopPlatform/Public/DesktopPlatformModule.h"
-#include "spine/spine.h"
 #include <string>
 #include <string>
 #include <string.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdlib.h>

+ 1 - 1
spine-ue4/Plugins/SpinePlugin/Source/SpineEditorPlugin/SpineEditorPlugin.Build.cs

@@ -9,7 +9,7 @@ namespace UnrealBuildTool.Rules
 			PublicIncludePaths.AddRange(new string[] { "SpineEditorPlugin/Public", "SpinePlugin/Public/spine-c/include" });
 			PublicIncludePaths.AddRange(new string[] { "SpineEditorPlugin/Public", "SpinePlugin/Public/spine-c/include" });
             
             
             PrivateIncludePaths.AddRange(new string[] { "SpineEditorPlugin/Private", "SpinePlugin/Public/spine-c/include" });
             PrivateIncludePaths.AddRange(new string[] { "SpineEditorPlugin/Private", "SpinePlugin/Public/spine-c/include" });
-            
+
             PublicDependencyModuleNames.AddRange(new string[] {
             PublicDependencyModuleNames.AddRange(new string[] {
                 "Core",
                 "Core",
                 "CoreUObject",
                 "CoreUObject",

+ 21 - 1
spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpinePlugin.cpp

@@ -37,8 +37,28 @@ class FSpinePlugin : public SpinePlugin {
 
 
 IMPLEMENT_MODULE( FSpinePlugin, SpinePlugin )
 IMPLEMENT_MODULE( FSpinePlugin, SpinePlugin )
 
 
-void FSpinePlugin::StartupModule() { }
+// These should be filled with UE4's specific allocator functions.
+extern "C" {
+    void _spSetMalloc( void* ( *_malloc ) ( size_t size ) );
+    void _spSetFree( void( *_free ) ( void* ptr ) );
+    void _spSetRealloc( void* ( *_realloc ) ( void* ptr, size_t size ) );
+}
+
+static void * SpineMalloc( size_t size ) {
+    return FMemory::Malloc( size );
+}
 
 
+static void * SpineRealloc( void* ptr, size_t size ) {
+    return FMemory::Realloc( ptr, size );
+}
+
+void FSpinePlugin::StartupModule() {
+#if !UE_EDITOR
+    _spSetMalloc( &SpineMalloc );
+    _spSetRealloc( &SpineRealloc );
+    _spSetFree( FMemory::Free );
+#endif
+}
 
 
 void FSpinePlugin::ShutdownModule() { }
 void FSpinePlugin::ShutdownModule() { }
 
 

+ 3 - 7
spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs

@@ -1824,11 +1824,7 @@ namespace Spine.Unity.Editor {
 		}
 		}
 
 
 		public static void DrawDot (Vector3 position, float size) {
 		public static void DrawDot (Vector3 position, float size) {
-			#if UNITY_5_6_OR_NEWER
-			Handles.DotHandleCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position), EventType.Ignore);
-			#else
-			Handles.DotCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position));
-			#endif
+			Handles.DotHandleCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position), EventType.Ignore); //Handles.DotCap(0, position, Quaternion.identity, size * HandleUtility.GetHandleSize(position));			
 		}
 		}
 
 
 		public static void DrawBoundingBoxes (Transform transform, Skeleton skeleton) {
 		public static void DrawBoundingBoxes (Transform transform, Skeleton skeleton) {
@@ -1839,9 +1835,9 @@ namespace Spine.Unity.Editor {
 		}
 		}
 
 
 		public static void DrawBoundingBox (Slot slot, BoundingBoxAttachment box, Transform t) {
 		public static void DrawBoundingBox (Slot slot, BoundingBoxAttachment box, Transform t) {
-			if (box.Vertices.Length <= 0) return; // Handle cases where user creates a BoundingBoxAttachment but doesn't actually define it.
+			if (box.Vertices.Length <= 2) return; // Handle cases where user creates a BoundingBoxAttachment but doesn't actually define it.
 
 
-			var worldVerts = new float[box.Vertices.Length];
+			var worldVerts = new float[box.WorldVerticesLength];
 			box.ComputeWorldVertices(slot, worldVerts);
 			box.ComputeWorldVertices(slot, worldVerts);
 
 
 			Handles.color = Color.green;
 			Handles.color = Color.green;

+ 9 - 0
spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d6f7e10049c6d6348ae5c92ccb3825e0
+folderAsset: yes
+timeCreated: 1521392482
+licenseType: Free
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 56 - 0
spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader

@@ -0,0 +1,56 @@
+// - Unlit + no shadow
+// - Double-sided, no depth
+
+Shader "Spine/Straight Alpha/Skeleton Fill" {
+	Properties {
+		_FillColor ("FillColor", Color) = (1,1,1,1)
+		_FillPhase ("FillPhase", Range(0, 1)) = 0
+		[NoScaleOffset]_MainTex ("MainTex", 2D) = "white" {}
+	}
+	SubShader {
+		Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
+		Blend One OneMinusSrcAlpha
+		Cull Off
+		ZWrite Off
+		Lighting Off
+
+		Pass {
+			CGPROGRAM
+			#pragma vertex vert
+			#pragma fragment frag
+			#include "UnityCG.cginc"
+			sampler2D _MainTex;
+			float4 _FillColor;
+			float _FillPhase;
+
+			struct VertexInput {
+				float4 vertex : POSITION;
+				float2 uv : TEXCOORD0;
+				float4 vertexColor : COLOR;
+			};
+
+			struct VertexOutput {
+				float4 pos : SV_POSITION;
+				float2 uv : TEXCOORD0;
+				float4 vertexColor : COLOR;
+			};
+
+			VertexOutput vert (VertexInput v) {
+				VertexOutput o = (VertexOutput)0;
+				o.uv = v.uv;
+				o.vertexColor = v.vertexColor;
+				o.pos = UnityObjectToClipPos(v.vertex);
+				return o;
+			}
+
+			float4 frag (VertexOutput i) : COLOR {
+				float4 rawColor = tex2D(_MainTex,i.uv);
+				float finalAlpha = (rawColor.a * i.vertexColor.a);
+				float3 finalColor = lerp((rawColor.rgb * i.vertexColor.rgb * rawColor.a), (_FillColor.rgb * finalAlpha), _FillPhase);
+				return fixed4(finalColor, finalAlpha);
+			}
+			ENDCG
+		}
+	}
+	FallBack "Diffuse"
+}

+ 9 - 0
spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Fill.shader.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ec3c686f972ccf5459c2b55555e6635f
+timeCreated: 1492385797
+licenseType: Free
+ShaderImporter:
+  defaultTextures: []
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 99 - 0
spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader

@@ -0,0 +1,99 @@
+// - Two color tint
+// - unlit
+// - No depth, no backface culling, no fog.
+
+Shader "Spine/Straight Alpha/Skeleton Tint" {
+	Properties {
+		_Color ("Tint Color", Color) = (1,1,1,1)
+		_Black ("Black Point", Color) = (0,0,0,0)
+		[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
+		_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
+	}
+
+	SubShader {
+		Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
+
+		Fog { Mode Off }
+		Cull Off
+		ZWrite Off
+		Blend One OneMinusSrcAlpha
+		Lighting Off
+
+		Pass {
+			CGPROGRAM
+			#pragma vertex vert
+			#pragma fragment frag
+			#include "UnityCG.cginc"
+			sampler2D _MainTex;
+			float4 _Color;
+			float4 _Black;
+
+			struct VertexInput {
+				float4 vertex : POSITION;
+				float2 uv : TEXCOORD0;
+				float4 vertexColor : COLOR;
+			};
+
+			struct VertexOutput {
+				float4 pos : SV_POSITION;
+				float2 uv : TEXCOORD0;
+				float4 vertexColor : COLOR;
+			};
+
+			VertexOutput vert (VertexInput v) {
+				VertexOutput o;
+				o.pos = UnityObjectToClipPos(v.vertex); // replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
+				o.uv = v.uv;
+				o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
+				return o;
+			}
+
+			float4 frag (VertexOutput i) : COLOR {
+				float4 texColor = tex2D(_MainTex, i.uv);
+				texColor = float4(texColor.rgb * texColor.a, texColor.a);
+				return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * _Black.rgb * texColor.a*_Color.a*i.vertexColor.a), 0);
+			}
+			ENDCG
+		}
+
+		Pass {
+			Name "Caster"
+			Tags { "LightMode"="ShadowCaster" }
+			Offset 1, 1
+			ZWrite On
+			ZTest LEqual
+
+			Fog { Mode Off }
+			Cull Off
+			Lighting Off
+
+			CGPROGRAM
+			#pragma vertex vert
+			#pragma fragment frag
+			#pragma multi_compile_shadowcaster
+			#pragma fragmentoption ARB_precision_hint_fastest
+			#include "UnityCG.cginc"
+			sampler2D _MainTex;
+			fixed _Cutoff;
+
+			struct VertexOutput { 
+				V2F_SHADOW_CASTER;
+				float2 uv : TEXCOORD1;
+			};
+
+			VertexOutput vert (appdata_base v) {
+				VertexOutput o;
+				o.uv = v.texcoord;
+				TRANSFER_SHADOW_CASTER(o)
+				return o;
+			}
+
+			float4 frag (VertexOutput i) : COLOR {
+				fixed4 texcol = tex2D(_MainTex, i.uv);
+				clip(texcol.a - _Cutoff);
+				SHADOW_CASTER_FRAGMENT(i)
+			}
+			ENDCG
+		}
+	}
+}

+ 7 - 0
spine-unity/Assets/spine-unity/Modules/Shaders/Straight Alpha/Spine-Straight-Skeleton-Tint.shader.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: c9a84b3418d033a4f9749511a6ac36d6
+ShaderImporter:
+  defaultTextures: []
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: