mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
All scripts now in Spine.Unity and Spine.Unity.Modules namespace
This commit is contained in:
parent
c0eb1a5237
commit
cc95db8e6c
@ -34,8 +34,9 @@ using System.IO;
|
||||
using UnityEngine;
|
||||
using Spine;
|
||||
|
||||
/// <summary>Loads and stores a Spine atlas and list of materials.</summary>
|
||||
public class AtlasAsset : ScriptableObject {
|
||||
namespace Spine.Unity {
|
||||
/// <summary>Loads and stores a Spine atlas and list of materials.</summary>
|
||||
public class AtlasAsset : ScriptableObject {
|
||||
public TextAsset atlasFile;
|
||||
public Material[] materials;
|
||||
private Atlas atlas;
|
||||
@ -141,9 +142,9 @@ public class AtlasAsset : ScriptableObject {
|
||||
|
||||
return mesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MaterialsTextureLoader : TextureLoader {
|
||||
public class MaterialsTextureLoader : TextureLoader {
|
||||
AtlasAsset atlasAsset;
|
||||
|
||||
public MaterialsTextureLoader (AtlasAsset atlasAsset) {
|
||||
@ -178,4 +179,5 @@ public class MaterialsTextureLoader : TextureLoader {
|
||||
|
||||
public void Unload (object texture) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,10 +182,7 @@ namespace Spine.Unity.Editor {
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
if (GUILayout.Button(new GUIContent("Bake All Skins", SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(150)))
|
||||
SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, m_skeletonData.Skins, "", bakeAnimations, bakeIK, bakeEventOptions);
|
||||
|
||||
@ -200,35 +197,20 @@ namespace Spine.Unity.Editor {
|
||||
} else
|
||||
skinName = m_skeletonAnimation.skeleton.Skin.Name;
|
||||
|
||||
bool oops = false;
|
||||
|
||||
try {
|
||||
GUILayout.BeginVertical();
|
||||
using (var m = new EditorGUILayout.VerticalScope()) {
|
||||
if (GUILayout.Button(new GUIContent("Bake " + skinName, SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(250)))
|
||||
SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, new ExposedList<Skin>(new [] { bakeSkin }), "", bakeAnimations, bakeIK, bakeEventOptions);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
GUILayout.Label(new GUIContent("Skins", SpineEditorUtilities.Icons.skinsRoot), GUILayout.Width(50));
|
||||
if (GUILayout.Button(skinName, EditorStyles.popup, GUILayout.Width(196))) {
|
||||
SelectSkinContext();
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
|
||||
|
||||
} catch {
|
||||
oops = true;
|
||||
//GUILayout.BeginVertical();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!oops)
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
@ -31,15 +31,15 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Spine;
|
||||
|
||||
public class SkeletonDataAsset : ScriptableObject {
|
||||
namespace Spine.Unity {
|
||||
public class SkeletonDataAsset : ScriptableObject {
|
||||
public AtlasAsset[] atlasAssets;
|
||||
#if SPINE_TK2D
|
||||
#if SPINE_TK2D
|
||||
public tk2dSpriteCollectionData spriteCollection;
|
||||
#endif
|
||||
#endif
|
||||
public TextAsset skeletonJSON;
|
||||
public float scale = 0.01f;
|
||||
public String[] fromAnimation;
|
||||
@ -76,17 +76,17 @@ public class SkeletonDataAsset : ScriptableObject {
|
||||
return null;
|
||||
}
|
||||
|
||||
#if !SPINE_TK2D
|
||||
#if !SPINE_TK2D
|
||||
if (atlasAssets.Length == 0) {
|
||||
Reset();
|
||||
return null;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if (atlasAssets.Length == 0 && spriteCollection == null) {
|
||||
Reset();
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Atlas[] atlasArr = new Atlas[atlasAssets.Length];
|
||||
for (int i = 0; i < atlasAssets.Length; i++) {
|
||||
@ -107,12 +107,12 @@ public class SkeletonDataAsset : ScriptableObject {
|
||||
AttachmentLoader attachmentLoader;
|
||||
float skeletonDataScale;
|
||||
|
||||
#if !SPINE_TK2D
|
||||
#if !SPINE_TK2D
|
||||
attachmentLoader = new AtlasAttachmentLoader(atlasArr);
|
||||
skeletonDataScale = scale;
|
||||
#else
|
||||
#else
|
||||
if (spriteCollection != null) {
|
||||
attachmentLoader = new SpriteCollectionAttachmentLoader(spriteCollection);
|
||||
attachmentLoader = new Spine.Unity.TK2D.SpriteCollectionAttachmentLoader(spriteCollection);
|
||||
skeletonDataScale = (1.0f / (spriteCollection.invOrthoSize * spriteCollection.halfTargetHeight) * scale);
|
||||
} else {
|
||||
if (atlasArr.Length == 0) {
|
||||
@ -123,7 +123,7 @@ public class SkeletonDataAsset : ScriptableObject {
|
||||
attachmentLoader = new AtlasAttachmentLoader(atlasArr);
|
||||
skeletonDataScale = scale;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
try {
|
||||
//var stopwatch = new System.Diagnostics.Stopwatch();
|
||||
@ -172,4 +172,6 @@ public class SkeletonDataAsset : ScriptableObject {
|
||||
GetSkeletonData(false);
|
||||
return stateData;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,17 +28,14 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Spine;
|
||||
|
||||
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Spine/BoneFollower")]
|
||||
public class BoneFollower : MonoBehaviour {
|
||||
namespace Spine.Unity {
|
||||
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Spine/BoneFollower")]
|
||||
public class BoneFollower : MonoBehaviour {
|
||||
|
||||
#region Inspector
|
||||
public SkeletonRenderer skeletonRenderer;
|
||||
@ -143,4 +140,6 @@ public class BoneFollower : MonoBehaviour {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,10 +30,8 @@
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
|
||||
namespace Spine.Unity.Editor {
|
||||
public static class SpineInspectorUtility {
|
||||
|
||||
@ -28,13 +28,12 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Spine;
|
||||
|
||||
|
||||
public class AtlasRegionAttacher : MonoBehaviour {
|
||||
namespace Spine.Unity.Modules {
|
||||
public class AtlasRegionAttacher : MonoBehaviour {
|
||||
|
||||
[System.Serializable]
|
||||
public class SlotRegionPair {
|
||||
@ -77,4 +76,5 @@ public class AtlasRegionAttacher : MonoBehaviour {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,14 +28,12 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Spine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class BoundingBoxFollower : MonoBehaviour {
|
||||
namespace Spine.Unity {
|
||||
[ExecuteInEditMode]
|
||||
public class BoundingBoxFollower : MonoBehaviour {
|
||||
|
||||
public SkeletonRenderer skeletonRenderer;
|
||||
|
||||
@ -57,27 +55,19 @@ public class BoundingBoxFollower : MonoBehaviour {
|
||||
public Dictionary<BoundingBoxAttachment, string> attachmentNameTable = new Dictionary<BoundingBoxAttachment, string>();
|
||||
|
||||
public string CurrentAttachmentName {
|
||||
get {
|
||||
return currentAttachmentName;
|
||||
}
|
||||
get { return currentAttachmentName; }
|
||||
}
|
||||
|
||||
public BoundingBoxAttachment CurrentAttachment {
|
||||
get {
|
||||
return currentAttachment;
|
||||
}
|
||||
get { return currentAttachment; }
|
||||
}
|
||||
|
||||
public PolygonCollider2D CurrentCollider {
|
||||
get {
|
||||
return currentCollider;
|
||||
}
|
||||
get { return currentCollider; }
|
||||
}
|
||||
|
||||
public Slot Slot {
|
||||
get {
|
||||
return slot;
|
||||
}
|
||||
get { return slot; }
|
||||
}
|
||||
|
||||
|
||||
@ -191,4 +181,6 @@ public class BoundingBoxFollower : MonoBehaviour {
|
||||
|
||||
currentAttachmentName = currentAttachment == null ? null : attachmentNameTable[attachment];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,12 +28,12 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Spine;
|
||||
using Spine.Unity;
|
||||
|
||||
public class CustomSkin : MonoBehaviour {
|
||||
namespace Spine.Unity.Modules {
|
||||
public class CustomSkin : MonoBehaviour {
|
||||
|
||||
[System.Serializable]
|
||||
public class SkinPair {
|
||||
@ -78,4 +78,6 @@ public class CustomSkin : MonoBehaviour {
|
||||
// But it's useful for your script to keep a reference to it.
|
||||
skeleton.SetSkin(customSkin);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,11 +4,12 @@
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SkeletonGhost : MonoBehaviour {
|
||||
namespace Spine.Unity.Modules {
|
||||
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SkeletonGhost : MonoBehaviour {
|
||||
public bool ghostingEnabled = true;
|
||||
public float spawnRate = 0.05f;
|
||||
public Color32 color = new Color32(0xFF, 0xFF, 0xFF, 0x00); // default for additive.
|
||||
@ -150,4 +151,6 @@ public class SkeletonGhost : MonoBehaviour {
|
||||
|
||||
return new Color32(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[CustomEditor(typeof(SkeletonRagdoll2D))]
|
||||
public class SkeletonRagdoll2DInspector : Editor {
|
||||
namespace Spine.Unity.Modules {
|
||||
[CustomEditor(typeof(SkeletonRagdoll2D))]
|
||||
public class SkeletonRagdoll2DInspector : UnityEditor.Editor {
|
||||
SerializedProperty startingBoneName, stopBoneNames, applyOnStart, pinStartBone, enableJointCollision, gravityScale, disableIK, thickness, rotationLimit, colliderLayer, mix, rootMass, massFalloffFactor;
|
||||
|
||||
void OnEnable () {
|
||||
@ -49,4 +48,6 @@ public class SkeletonRagdoll2DInspector : Editor {
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField(name, EditorStyles.boldLabel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,8 +8,9 @@ using UnityEditor;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[CustomEditor(typeof(SkeletonRagdoll))]
|
||||
public class SkeletonRagdollInspector : Editor {
|
||||
namespace Spine.Unity.Modules {
|
||||
[CustomEditor(typeof(SkeletonRagdoll))]
|
||||
public class SkeletonRagdollInspector : UnityEditor.Editor {
|
||||
SerializedProperty startingBoneName, stopBoneNames, applyOnStart, pinStartBone, enableJointCollision, useGravity, disableIK, thickness, rotationLimit, colliderLayer, mix, rootMass, massFalloffFactor;
|
||||
|
||||
void OnEnable () {
|
||||
@ -50,4 +51,6 @@ public class SkeletonRagdollInspector : Editor {
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField(name, EditorStyles.boldLabel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,10 +6,10 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Spine;
|
||||
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SkeletonRagdoll : MonoBehaviour {
|
||||
namespace Spine.Unity.Modules {
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SkeletonRagdoll : MonoBehaviour {
|
||||
private static Transform helper;
|
||||
|
||||
[Header("Hierarchy")]
|
||||
@ -423,4 +423,6 @@ public class SkeletonRagdoll : MonoBehaviour {
|
||||
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,10 +6,11 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Spine;
|
||||
using Spine.Unity;
|
||||
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SkeletonRagdoll2D : MonoBehaviour {
|
||||
namespace Spine.Unity.Modules {
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SkeletonRagdoll2D : MonoBehaviour {
|
||||
private static Transform helper;
|
||||
|
||||
[Header("Hierarchy")]
|
||||
@ -39,27 +40,19 @@ public class SkeletonRagdoll2D : MonoBehaviour {
|
||||
public float mix = 1;
|
||||
|
||||
public Rigidbody2D RootRigidbody {
|
||||
get {
|
||||
return this.rootRigidbody;
|
||||
}
|
||||
get { return this.rootRigidbody; }
|
||||
}
|
||||
|
||||
public Vector3 RootOffset {
|
||||
get {
|
||||
return this.rootOffset;
|
||||
}
|
||||
get { return this.rootOffset; }
|
||||
}
|
||||
|
||||
public Vector3 EstimatedSkeletonPosition {
|
||||
get {
|
||||
return this.rootRigidbody.position - rootOffset;
|
||||
}
|
||||
get { return this.rootRigidbody.position - rootOffset; }
|
||||
}
|
||||
|
||||
public bool IsActive {
|
||||
get {
|
||||
return this.isActive;
|
||||
}
|
||||
get { return this.isActive; }
|
||||
}
|
||||
|
||||
private Rigidbody2D rootRigidbody;
|
||||
@ -282,14 +275,14 @@ public class SkeletonRagdoll2D : MonoBehaviour {
|
||||
if (colliders.Count == 0) {
|
||||
var box = go.AddComponent<BoxCollider2D>();
|
||||
box.size = new Vector2(length, thickness);
|
||||
#if UNITY_5
|
||||
#if UNITY_5
|
||||
// MITCH
|
||||
// box.offset = new Vector2((b.WorldFlipX ? -length : length) / 2, 0);
|
||||
box.offset = new Vector2(length / 2, 0);
|
||||
#else
|
||||
#else
|
||||
//box.center = new Vector2((b.WorldFlipX ? -length : length) / 2, 0);
|
||||
box.center = new Vector2(length/2, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,4 +427,6 @@ public class SkeletonRagdoll2D : MonoBehaviour {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,38 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, 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 (the "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 otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software 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; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) 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.
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Spine.Unity;
|
||||
using Spine.Unity.Editor;
|
||||
|
||||
namespace Spine.Unity.Editor {
|
||||
namespace Spine.Unity.Modules {
|
||||
[CustomEditor(typeof(SkeletonPartsRenderer))]
|
||||
public class SkeletonRenderPartInspector : UnityEditor.Editor {
|
||||
SpineInspectorUtility.SerializedSortingProperties sortingProperties;
|
||||
@ -13,7 +42,6 @@ namespace Spine.Unity.Editor {
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI () {
|
||||
DrawDefaultInspector();
|
||||
SpineInspectorUtility.SortingPropertyFields(sortingProperties, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,40 @@
|
||||
using UnityEngine;
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, 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 (the "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 otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software 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; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) 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.
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
using Spine.Unity;
|
||||
using Spine.Unity.Editor;
|
||||
|
||||
namespace Spine.Unity.Editor {
|
||||
namespace Spine.Unity.Modules {
|
||||
|
||||
[CustomEditor(typeof(SkeletonRenderSeparator))]
|
||||
public class SkeletonRenderSeparatorInspector : UnityEditor.Editor {
|
||||
|
||||
@ -1,8 +1,37 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, 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 (the "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 otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software 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; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) 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.
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
using Spine.Unity.MeshGeneration;
|
||||
|
||||
namespace Spine.Unity {
|
||||
namespace Spine.Unity.Modules {
|
||||
[RequireComponent(typeof(MeshRenderer), typeof(MeshFilter))]
|
||||
public class SkeletonPartsRenderer : MonoBehaviour {
|
||||
|
||||
|
||||
@ -1,9 +1,38 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, 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 (the "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 otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software 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; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) 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.
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Spine.Unity;
|
||||
|
||||
namespace Spine.Unity {
|
||||
namespace Spine.Unity.Modules {
|
||||
|
||||
[ExecuteInEditMode]
|
||||
[HelpURL("https://github.com/pharan/spine-unity-docs/blob/master/SkeletonRenderSeparator.md")]
|
||||
@ -28,7 +57,7 @@ namespace Spine.Unity {
|
||||
public bool copyPropertyBlock = false;
|
||||
[Tooltip("Copies MeshRenderer flags into ")]
|
||||
public bool copyMeshRendererFlags = false;
|
||||
public List<Spine.Unity.SkeletonPartsRenderer> partsRenderers = new List<SkeletonPartsRenderer>();
|
||||
public List<Spine.Unity.Modules.SkeletonPartsRenderer> partsRenderers = new List<SkeletonPartsRenderer>();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void Reset () {
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SkeletonUtilityEyeConstraint : SkeletonUtilityConstraint {
|
||||
|
||||
namespace Spine.Unity.Modules {
|
||||
public class SkeletonUtilityEyeConstraint : SkeletonUtilityConstraint {
|
||||
public Transform[] eyes;
|
||||
public float radius = 0.5f;
|
||||
public Transform target;
|
||||
@ -84,4 +84,5 @@ public class SkeletonUtilityEyeConstraint : SkeletonUtilityConstraint {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,10 +32,11 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[RequireComponent(typeof(SkeletonUtilityBone)), ExecuteInEditMode]
|
||||
public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
||||
namespace Spine.Unity.Modules {
|
||||
[RequireComponent(typeof(SkeletonUtilityBone)), ExecuteInEditMode]
|
||||
public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
||||
|
||||
#if UNITY_4_3
|
||||
#if UNITY_4_3
|
||||
public LayerMask groundMask;
|
||||
public bool use2D = false;
|
||||
public bool useRadius = false;
|
||||
@ -44,7 +45,7 @@ public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
||||
public float castOffset = 0;
|
||||
public float groundOffset = 0;
|
||||
public float adjustSpeed = 5;
|
||||
#else
|
||||
#else
|
||||
[Tooltip("LayerMask for what objects to raycast against")]
|
||||
public LayerMask groundMask;
|
||||
[Tooltip("The 2D")]
|
||||
@ -61,7 +62,7 @@ public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
||||
public float groundOffset = 0;
|
||||
[Tooltip("How fast the target IK position adjusts to the ground. Use smaller values to prevent snapping")]
|
||||
public float adjustSpeed = 5;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Vector3 rayOrigin;
|
||||
@ -86,12 +87,12 @@ public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
||||
RaycastHit2D hit;
|
||||
|
||||
if (useRadius) {
|
||||
#if UNITY_4_3
|
||||
#if UNITY_4_3
|
||||
//NOTE: Unity 4.3.x does not have CircleCast
|
||||
hit = Physics2D.Raycast(rayOrigin , rayDir, castDistance + groundOffset, groundMask);
|
||||
#else
|
||||
#else
|
||||
hit = Physics2D.CircleCast(rayOrigin, castRadius, rayDir, castDistance + groundOffset, groundMask);
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
hit = Physics2D.Raycast(rayOrigin, rayDir, castDistance + groundOffset, groundMask);
|
||||
}
|
||||
@ -149,4 +150,6 @@ public class SkeletonUtilityGroundConstraint : SkeletonUtilityConstraint {
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawLine(hitEnd, clearEnd);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,10 +30,10 @@
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SkeletonUtilityKinematicShadow : MonoBehaviour {
|
||||
namespace Spine.Unity.Modules {
|
||||
public class SkeletonUtilityKinematicShadow : MonoBehaviour {
|
||||
public bool hideShadow = true;
|
||||
public Transform parent;
|
||||
Dictionary<Transform, Transform> shadowTable;
|
||||
@ -111,4 +111,5 @@ public class SkeletonUtilityKinematicShadow : MonoBehaviour {
|
||||
pair.Value.localRotation = pair.Key.localRotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,13 +30,11 @@
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Spine;
|
||||
|
||||
public class SpriteAttacher : MonoBehaviour {
|
||||
|
||||
|
||||
namespace Spine.Unity.Modules {
|
||||
public class SpriteAttacher : MonoBehaviour {
|
||||
public bool attachOnStart = true;
|
||||
public bool keepLoaderInMemory = true;
|
||||
|
||||
@ -68,9 +66,9 @@ public class SpriteAttacher : MonoBehaviour {
|
||||
if (!keepLoaderInMemory)
|
||||
loader = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpriteAttachmentLoader : AttachmentLoader {
|
||||
public class SpriteAttachmentLoader : AttachmentLoader {
|
||||
|
||||
//TODO: Memory cleanup functions
|
||||
|
||||
@ -196,4 +194,34 @@ public class SpriteAttachmentLoader : AttachmentLoader {
|
||||
public BoundingBoxAttachment NewBoundingBoxAttachment (Skin skin, string name) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpriteAttachmentExtensions {
|
||||
public static Attachment AttachUnitySprite (this Skeleton skeleton, string slotName, Sprite sprite, string shaderName = "Spine/Skeleton") {
|
||||
var att = sprite.ToRegionAttachment(shaderName);
|
||||
skeleton.FindSlot(slotName).Attachment = att;
|
||||
return att;
|
||||
}
|
||||
|
||||
public static Attachment AddUnitySprite (this SkeletonData skeletonData, string slotName, Sprite sprite, string skinName = "", string shaderName = "Spine/Skeleton") {
|
||||
var att = sprite.ToRegionAttachment(shaderName);
|
||||
|
||||
var slotIndex = skeletonData.FindSlotIndex(slotName);
|
||||
Skin skin = skeletonData.defaultSkin;
|
||||
if (skinName != "")
|
||||
skin = skeletonData.FindSkin(skinName);
|
||||
|
||||
skin.AddAttachment(slotIndex, att.Name, att);
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
public static RegionAttachment ToRegionAttachment (this Sprite sprite, string shaderName = "Spine/Skeleton") {
|
||||
var loader = new SpriteAttachmentLoader(sprite, Shader.Find(shaderName));
|
||||
var att = loader.NewRegionAttachment(null, sprite.name, "");
|
||||
loader = null;
|
||||
return att;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@ using UnityEngine;
|
||||
using Spine;
|
||||
|
||||
// TODO: handle TPackerCW flip mode (probably not swap uv horizontaly)
|
||||
|
||||
public class SpriteCollectionAttachmentLoader : AttachmentLoader {
|
||||
namespace Spine.Unity.TK2D {
|
||||
public class SpriteCollectionAttachmentLoader : AttachmentLoader {
|
||||
private tk2dSpriteCollectionData sprites;
|
||||
private float u, v, u2, v2;
|
||||
private bool regionRotated;
|
||||
@ -161,5 +161,6 @@ public class SpriteCollectionAttachmentLoader : AttachmentLoader {
|
||||
public BoundingBoxAttachment NewBoundingBoxAttachment (Skin skin, String name) {
|
||||
return new BoundingBoxAttachment(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -30,14 +30,14 @@
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Spine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Spine/SkeletonAnimation")]
|
||||
[HelpURL("http://esotericsoftware.com/spine-unity-documentation#Controlling-Animation")]
|
||||
public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
||||
namespace Spine.Unity {
|
||||
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Spine/SkeletonAnimation")]
|
||||
[HelpURL("http://esotericsoftware.com/spine-unity-documentation#Controlling-Animation")]
|
||||
public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
||||
|
||||
/// <summary>
|
||||
/// This is the Spine.AnimationState object of this SkeletonAnimation. You can control animations through it.
|
||||
@ -189,4 +189,6 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,12 +5,11 @@
|
||||
* Full irrevocable rights and permissions granted to Esoteric Software
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Spine;
|
||||
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
||||
namespace Spine.Unity {
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
||||
|
||||
public enum MixMode { AlwaysMix, MixNext, SpineStyle }
|
||||
public MixMode[] layerMixModes = new MixMode[0];
|
||||
@ -91,13 +90,13 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
||||
var stateInfo = animator.GetCurrentAnimatorStateInfo(i);
|
||||
var nextStateInfo = animator.GetNextAnimatorStateInfo(i);
|
||||
|
||||
#if UNITY_5
|
||||
#if UNITY_5
|
||||
var clipInfo = animator.GetCurrentAnimatorClipInfo(i);
|
||||
var nextClipInfo = animator.GetNextAnimatorClipInfo(i);
|
||||
#else
|
||||
#else
|
||||
var clipInfo = animator.GetCurrentAnimationClipState(i);
|
||||
var nextClipInfo = animator.GetNextAnimationClipState(i);
|
||||
#endif
|
||||
#endif
|
||||
MixMode mode = layerMixModes[i];
|
||||
|
||||
if (mode == MixMode.AlwaysMix) {
|
||||
@ -111,11 +110,11 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
||||
float time = stateInfo.normalizedTime * info.clip.length;
|
||||
animationTable[GetAnimationClipNameHashCode(info.clip)].Mix(skeleton, Mathf.Max(0, time - deltaTime), time, stateInfo.loop, null, weight);
|
||||
}
|
||||
#if UNITY_5
|
||||
#if UNITY_5
|
||||
if (nextStateInfo.fullPathHash != 0) {
|
||||
#else
|
||||
#else
|
||||
if (nextStateInfo.nameHash != 0) {
|
||||
#endif
|
||||
#endif
|
||||
for (int c = 0; c < nextClipInfo.Length; c++) {
|
||||
var info = nextClipInfo[c];
|
||||
float weight = info.weight * layerWeight;
|
||||
@ -153,11 +152,11 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
||||
}
|
||||
|
||||
c = 0;
|
||||
#if UNITY_5
|
||||
#if UNITY_5
|
||||
if (nextStateInfo.fullPathHash != 0) {
|
||||
#else
|
||||
#else
|
||||
if (nextStateInfo.nameHash != 0) {
|
||||
#endif
|
||||
#endif
|
||||
//apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
|
||||
if (mode == MixMode.SpineStyle) {
|
||||
for (; c < nextClipInfo.Length; c++) {
|
||||
@ -212,4 +211,5 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
||||
|
||||
return clipNameHashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,10 +6,11 @@
|
||||
*****************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Spine;
|
||||
using Spine.Unity;
|
||||
|
||||
public static class SkeletonExtensions {
|
||||
namespace Spine.Unity {
|
||||
public static class SkeletonExtensions {
|
||||
|
||||
const float ByteToFloat = 1f / 255f;
|
||||
|
||||
@ -102,7 +103,6 @@ public static class SkeletonExtensions {
|
||||
}
|
||||
|
||||
public static Vector2 GetSkeletonSpacePosition (this Bone bone) {
|
||||
// TODO: This changes in v3.0
|
||||
return new Vector2(bone.worldX, bone.worldY);
|
||||
}
|
||||
|
||||
@ -126,33 +126,5 @@ public static class SkeletonExtensions {
|
||||
animation.Apply(skeleton, 0, time, loop, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Unity Sprite To Attachments
|
||||
public static Attachment AttachUnitySprite (this Skeleton skeleton, string slotName, Sprite sprite, string shaderName = "Spine/Skeleton") {
|
||||
var att = sprite.ToRegionAttachment(shaderName);
|
||||
skeleton.FindSlot(slotName).Attachment = att;
|
||||
return att;
|
||||
}
|
||||
|
||||
public static Attachment AddUnitySprite (this SkeletonData skeletonData, string slotName, Sprite sprite, string skinName = "", string shaderName = "Spine/Skeleton") {
|
||||
var att = sprite.ToRegionAttachment(shaderName);
|
||||
|
||||
var slotIndex = skeletonData.FindSlotIndex(slotName);
|
||||
Skin skin = skeletonData.defaultSkin;
|
||||
if (skinName != "")
|
||||
skin = skeletonData.FindSkin(skinName);
|
||||
|
||||
skin.AddAttachment(slotIndex, att.Name, att);
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
public static RegionAttachment ToRegionAttachment (this Sprite sprite, string shaderName = "Spine/Skeleton") {
|
||||
var loader = new SpriteAttachmentLoader(sprite, Shader.Find(shaderName));
|
||||
var att = loader.NewRegionAttachment(null, sprite.name, "");
|
||||
loader = null;
|
||||
return att;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@ -31,18 +31,18 @@
|
||||
#define SPINE_OPTIONAL_NORMALS
|
||||
#define SPINE_OPTIONAL_FRONTFACING
|
||||
#define SPINE_OPTIONAL_RENDEROVERRIDE
|
||||
//#define SPINE_OPTIONAL_SUBMESHRENDERER // Deprecated
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Spine;
|
||||
using Spine.Unity;
|
||||
using Spine.Unity.MeshGeneration;
|
||||
|
||||
/// <summary>Renders a skeleton.</summary>
|
||||
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
||||
[HelpURL("http://esotericsoftware.com/spine-unity-documentation#Rendering")]
|
||||
public class SkeletonRenderer : MonoBehaviour {
|
||||
namespace Spine.Unity {
|
||||
/// <summary>Renders a skeleton.</summary>
|
||||
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
||||
[HelpURL("http://esotericsoftware.com/spine-unity-documentation#Rendering")]
|
||||
public class SkeletonRenderer : MonoBehaviour {
|
||||
|
||||
public delegate void SkeletonRendererDelegate (SkeletonRenderer skeletonRenderer);
|
||||
public SkeletonRendererDelegate OnRebuild;
|
||||
@ -50,7 +50,7 @@ public class SkeletonRenderer : MonoBehaviour {
|
||||
public SkeletonDataAsset skeletonDataAsset;
|
||||
public String initialSkinName;
|
||||
|
||||
#region Advanced
|
||||
#region Advanced
|
||||
// Submesh Separation
|
||||
[UnityEngine.Serialization.FormerlySerializedAs("submeshSeparators")]
|
||||
[SpineSlot]
|
||||
@ -90,13 +90,16 @@ public class SkeletonRenderer : MonoBehaviour {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SPINE_OPTIONAL_SUBMESHRENDERER
|
||||
private Spine.Unity.Modules.SkeletonUtilitySubmeshRenderer[] submeshRenderers;
|
||||
#endif
|
||||
|
||||
// Custom Slot Material
|
||||
[System.NonSerialized] readonly Dictionary<Slot, Material> customSlotMaterials = new Dictionary<Slot, Material>();
|
||||
public Dictionary<Slot, Material> CustomSlotMaterials { get { return customSlotMaterials; } }
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
[System.NonSerialized] public bool valid;
|
||||
[System.NonSerialized] public Skeleton skeleton;
|
||||
@ -187,9 +190,12 @@ public class SkeletonRenderer : MonoBehaviour {
|
||||
skeleton.SetSkin(initialSkinName);
|
||||
|
||||
separatorSlots.Clear();
|
||||
for (int i = 0; i < separatorSlotNames.Length; i++) {
|
||||
for (int i = 0; i < separatorSlotNames.Length; i++)
|
||||
separatorSlots.Add(skeleton.FindSlot(separatorSlotNames[i]));
|
||||
}
|
||||
|
||||
#if SPINE_OPTIONAL_SUBMESHRENDERER
|
||||
submeshRenderers = GetComponentsInChildren<Spine.Unity.Modules.SkeletonUtilitySubmeshRenderer>();
|
||||
#endif
|
||||
|
||||
LateUpdate();
|
||||
|
||||
@ -210,6 +216,10 @@ public class SkeletonRenderer : MonoBehaviour {
|
||||
&& this.generateMeshOverride == null
|
||||
#endif
|
||||
|
||||
#if SPINE_OPTIONAL_SUBMESHRENDERER
|
||||
&& submeshRenderers.Length > 0
|
||||
#endif
|
||||
|
||||
)
|
||||
return;
|
||||
|
||||
@ -688,6 +698,18 @@ public class SkeletonRenderer : MonoBehaviour {
|
||||
|
||||
// Step 5. Miscellaneous
|
||||
// Add stuff here if you want
|
||||
|
||||
#if SPINE_OPTIONAL_SUBMESHRENDERER
|
||||
if (submeshRenderers.Length > 0) {
|
||||
for (int i = 0; i < submeshRenderers.Length; i++) {
|
||||
var submeshRenderer = submeshRenderers[i];
|
||||
if (submeshRenderer.submeshIndex < sharedMaterials.Length)
|
||||
submeshRenderer.SetMesh(meshRenderer, currentMesh, sharedMaterials[submeshRenderer.submeshIndex]);
|
||||
else
|
||||
submeshRenderer.GetComponent<Renderer>().enabled = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool CheckIfMustUpdateMeshStructure (SmartMesh.Instruction a, SmartMesh.Instruction b) {
|
||||
@ -964,6 +986,5 @@ public class SkeletonRenderer : MonoBehaviour {
|
||||
public int triangleCount;
|
||||
public int firstVertex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -10,11 +10,12 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Spine;
|
||||
|
||||
[CustomEditor(typeof(SkeletonUtilityBone)), CanEditMultipleObjects]
|
||||
public class SkeletonUtilityBoneInspector : Editor {
|
||||
namespace Spine.Unity.Editor {
|
||||
[CustomEditor(typeof(SkeletonUtilityBone)), CanEditMultipleObjects]
|
||||
public class SkeletonUtilityBoneInspector : UnityEditor.Editor {
|
||||
SerializedProperty mode, boneName, zPosition, position, rotation, scale, overrideAlpha, parentReference;
|
||||
// MITCH
|
||||
// SerializedProperty flip, flipX;
|
||||
// SerializedProperty flip, flipX;
|
||||
|
||||
//multi selected flags
|
||||
bool containsFollows, containsOverrides, multiObject;
|
||||
@ -38,8 +39,8 @@ public class SkeletonUtilityBoneInspector : Editor {
|
||||
parentReference = this.serializedObject.FindProperty("parentReference");
|
||||
|
||||
// MITCH
|
||||
// flip = this.serializedObject.FindProperty("flip");
|
||||
// flipX = this.serializedObject.FindProperty("flipX");
|
||||
// flip = this.serializedObject.FindProperty("flip");
|
||||
// flipX = this.serializedObject.FindProperty("flipX");
|
||||
|
||||
EvaluateFlags();
|
||||
|
||||
@ -149,7 +150,7 @@ public class SkeletonUtilityBoneInspector : Editor {
|
||||
EditorGUILayout.PropertyField(rotation);
|
||||
EditorGUILayout.PropertyField(scale);
|
||||
// MITCH
|
||||
// EditorGUILayout.PropertyField(flip);
|
||||
// EditorGUILayout.PropertyField(flip);
|
||||
|
||||
EditorGUI.BeginDisabledGroup(containsFollows);
|
||||
{
|
||||
@ -157,15 +158,15 @@ public class SkeletonUtilityBoneInspector : Editor {
|
||||
EditorGUILayout.PropertyField(parentReference);
|
||||
|
||||
// MITCH
|
||||
// EditorGUI.BeginDisabledGroup(multiObject || !flip.boolValue);
|
||||
// {
|
||||
// EditorGUI.BeginChangeCheck();
|
||||
// EditorGUILayout.PropertyField(flipX);
|
||||
// if (EditorGUI.EndChangeCheck()) {
|
||||
// FlipX(flipX.boolValue);
|
||||
// }
|
||||
// }
|
||||
// EditorGUI.EndDisabledGroup();
|
||||
// EditorGUI.BeginDisabledGroup(multiObject || !flip.boolValue);
|
||||
// {
|
||||
// EditorGUI.BeginChangeCheck();
|
||||
// EditorGUILayout.PropertyField(flipX);
|
||||
// if (EditorGUI.EndChangeCheck()) {
|
||||
// FlipX(flipX.boolValue);
|
||||
// }
|
||||
// }
|
||||
// EditorGUI.EndDisabledGroup();
|
||||
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
@ -233,12 +234,12 @@ public class SkeletonUtilityBoneInspector : Editor {
|
||||
}
|
||||
|
||||
// MITCH
|
||||
// void FlipX (bool state) {
|
||||
// utilityBone.FlipX(state);
|
||||
// if (Application.isPlaying == false) {
|
||||
// skeletonUtility.skeletonAnimation.LateUpdate();
|
||||
// }
|
||||
// }
|
||||
// void FlipX (bool state) {
|
||||
// utilityBone.FlipX(state);
|
||||
// if (Application.isPlaying == false) {
|
||||
// skeletonUtility.skeletonAnimation.LateUpdate();
|
||||
// }
|
||||
// }
|
||||
|
||||
void BoneSelectorContextMenu (string current, ExposedList<Bone> bones, string topValue, GenericMenu.MenuFunction2 callback) {
|
||||
GenericMenu menu = new GenericMenu();
|
||||
@ -351,4 +352,6 @@ public class SkeletonUtilityBoneInspector : Editor {
|
||||
|
||||
utilBone.gameObject.AddComponent<Rigidbody>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,8 +18,10 @@ using Spine;
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[CustomEditor(typeof(SkeletonUtility))]
|
||||
public class SkeletonUtilityInspector : Editor {
|
||||
|
||||
namespace Spine.Unity.Editor {
|
||||
[CustomEditor(typeof(SkeletonUtility))]
|
||||
public class SkeletonUtilityInspector : UnityEditor.Editor {
|
||||
|
||||
public static void AttachIcon (SkeletonUtilityBone utilityBone) {
|
||||
Skeleton skeleton = utilityBone.skeletonUtility.skeletonRenderer.skeleton;
|
||||
@ -68,11 +70,11 @@ public class SkeletonUtilityInspector : Editor {
|
||||
|
||||
|
||||
//GUI stuff
|
||||
#if UNITY_4_3
|
||||
#if UNITY_4_3
|
||||
static bool showSlots;
|
||||
#else
|
||||
#else
|
||||
static AnimBool showSlots;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void OnEnable () {
|
||||
skeletonUtility = (SkeletonUtility)target;
|
||||
@ -167,8 +169,8 @@ public class SkeletonUtilityInspector : Editor {
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
// if (GUILayout.Button(new GUIContent("Spawn Submeshes", SpineEditorUtilities.Icons.subMeshRenderer), GUILayout.Width(150), GUILayout.Height(24)))
|
||||
// skeletonUtility.SpawnSubRenderers(true);
|
||||
// if (GUILayout.Button(new GUIContent("Spawn Submeshes", SpineEditorUtilities.Icons.subMeshRenderer), GUILayout.Width(150), GUILayout.Height(24)))
|
||||
// skeletonUtility.SpawnSubRenderers(true);
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
@ -180,12 +182,12 @@ public class SkeletonUtilityInspector : Editor {
|
||||
SceneView.RepaintAll();
|
||||
}
|
||||
|
||||
#if UNITY_4_3
|
||||
#if UNITY_4_3
|
||||
showSlots = EditorGUILayout.Foldout(showSlots, "Slots");
|
||||
#else
|
||||
#else
|
||||
showSlots.target = EditorGUILayout.Foldout(showSlots.target, "Slots");
|
||||
if (EditorGUILayout.BeginFadeGroup(showSlots.faded)) {
|
||||
#endif
|
||||
#endif
|
||||
foreach (KeyValuePair<Slot, List<Attachment>> pair in attachmentTable) {
|
||||
|
||||
Slot slot = pair.Key;
|
||||
@ -239,12 +241,12 @@ public class SkeletonUtilityInspector : Editor {
|
||||
}
|
||||
#if UNITY_4_3
|
||||
|
||||
#else
|
||||
#else
|
||||
}
|
||||
EditorGUILayout.EndFadeGroup();
|
||||
if (showSlots.isAnimating)
|
||||
Repaint();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpawnHierarchyContextMenu () {
|
||||
@ -278,4 +280,6 @@ public class SkeletonUtilityInspector : Editor {
|
||||
Selection.activeGameObject = skeletonUtility.SpawnRoot(SkeletonUtilityBone.Mode.Override, true, true, true);
|
||||
AttachIconsToChildren(skeletonUtility.boneRoot);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, 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 (the "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 otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software 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; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) 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.
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Spine.Unity.Editor;
|
||||
|
||||
namespace Spine.Unity.Modules {
|
||||
[CustomEditor(typeof(SkeletonUtilitySubmeshRenderer))]
|
||||
public class SkeletonUtilitySubmeshRendererInspector : UnityEditor.Editor {
|
||||
public SpineInspectorUtility.SerializedSortingProperties sorting;
|
||||
|
||||
void OnEnable () {
|
||||
sorting = new SpineInspectorUtility.SerializedSortingProperties((target as Component).GetComponent<Renderer>());
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI () {
|
||||
EditorGUILayout.HelpBox("SkeletonUtilitySubmeshRenderer is now obsolete. We recommend using SkeletonRenderSeparator.", MessageType.Info);
|
||||
SpineInspectorUtility.SortingPropertyFields(sorting, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67418e462bd4dc24e8c234b92f1d4d9b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@ -10,12 +10,13 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Spine;
|
||||
|
||||
[RequireComponent(typeof(ISkeletonAnimation))]
|
||||
[ExecuteInEditMode]
|
||||
public class SkeletonUtility : MonoBehaviour {
|
||||
namespace Spine.Unity {
|
||||
[RequireComponent(typeof(ISkeletonAnimation))]
|
||||
[ExecuteInEditMode]
|
||||
public class SkeletonUtility : MonoBehaviour {
|
||||
|
||||
public static T GetInParent<T> (Transform origin) where T : Component {
|
||||
#if UNITY_4_3
|
||||
#if UNITY_4_3
|
||||
Transform parent = origin.parent;
|
||||
while(parent.GetComponent<T>() == null){
|
||||
parent = parent.parent;
|
||||
@ -24,9 +25,9 @@ public class SkeletonUtility : MonoBehaviour {
|
||||
}
|
||||
|
||||
return parent.GetComponent<T>();
|
||||
#else
|
||||
#else
|
||||
return origin.GetComponentInParent<T>();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
public static PolygonCollider2D AddBoundingBox (Skeleton skeleton, string skinName, string slotName, string attachmentName, Transform parent, bool isTrigger = true) {
|
||||
@ -381,4 +382,6 @@ public class SkeletonUtility : MonoBehaviour {
|
||||
return go;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,10 +11,11 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Spine;
|
||||
|
||||
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Spine/SkeletonUtilityBone")]
|
||||
public class SkeletonUtilityBone : MonoBehaviour {
|
||||
namespace Spine.Unity {
|
||||
/// <summary>Sets a GameObject's transform to match a bone on a Spine skeleton.</summary>
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Spine/SkeletonUtilityBone")]
|
||||
public class SkeletonUtilityBone : MonoBehaviour {
|
||||
|
||||
public enum Mode {
|
||||
Follow,
|
||||
@ -50,10 +51,10 @@ public class SkeletonUtilityBone : MonoBehaviour {
|
||||
protected Transform skeletonTransform;
|
||||
|
||||
// MITCH : nonuniform scale
|
||||
// private bool nonUniformScaleWarning;
|
||||
// public bool NonUniformScaleWarning {
|
||||
// get { return nonUniformScaleWarning; }
|
||||
// }
|
||||
// private bool nonUniformScaleWarning;
|
||||
// public bool NonUniformScaleWarning {
|
||||
// get { return nonUniformScaleWarning; }
|
||||
// }
|
||||
|
||||
private bool disableInheritScaleWarning;
|
||||
public bool DisableInheritScaleWarning {
|
||||
@ -116,15 +117,15 @@ public class SkeletonUtilityBone : MonoBehaviour {
|
||||
float skeletonFlipRotation = (skeleton.flipX ^ skeleton.flipY) ? -1f : 1f;
|
||||
|
||||
// MITCH : remove flipX
|
||||
// float flipCompensation = 0;
|
||||
// if (flip && (flipX || (flipX != bone.flipX)) && bone.parent != null) {
|
||||
// flipCompensation = bone.parent.WorldRotation * -2;
|
||||
// }
|
||||
// float flipCompensation = 0;
|
||||
// if (flip && (flipX || (flipX != bone.flipX)) && bone.parent != null) {
|
||||
// flipCompensation = bone.parent.WorldRotation * -2;
|
||||
// }
|
||||
|
||||
if (mode == Mode.Follow) {
|
||||
// MITCH : remove flipX
|
||||
// if (flip)
|
||||
// flipX = bone.flipX;
|
||||
// if (flip)
|
||||
// flipX = bone.flipX;
|
||||
|
||||
if (position)
|
||||
cachedTransform.localPosition = new Vector3(bone.x, bone.y, 0);
|
||||
@ -164,19 +165,19 @@ public class SkeletonUtilityBone : MonoBehaviour {
|
||||
float angle = Mathf.LerpAngle(bone.Rotation, cachedTransform.localRotation.eulerAngles.z, overrideAlpha);
|
||||
|
||||
// MITCH : remove flipX
|
||||
// float angle = Mathf.LerpAngle(bone.Rotation, cachedTransform.localRotation.eulerAngles.z, overrideAlpha) + flipCompensation;
|
||||
// if (flip) {
|
||||
//
|
||||
// if ((!flipX && bone.flipX)) {
|
||||
// angle -= flipCompensation;
|
||||
// }
|
||||
//
|
||||
// //TODO fix this...
|
||||
// if (angle >= 360)
|
||||
// angle -= 360;
|
||||
// else if (angle <= -360)
|
||||
// angle += 360;
|
||||
// }
|
||||
// float angle = Mathf.LerpAngle(bone.Rotation, cachedTransform.localRotation.eulerAngles.z, overrideAlpha) + flipCompensation;
|
||||
// if (flip) {
|
||||
//
|
||||
// if ((!flipX && bone.flipX)) {
|
||||
// angle -= flipCompensation;
|
||||
// }
|
||||
//
|
||||
// //TODO fix this...
|
||||
// if (angle >= 360)
|
||||
// angle -= 360;
|
||||
// else if (angle <= -360)
|
||||
// angle += 360;
|
||||
// }
|
||||
bone.Rotation = angle;
|
||||
bone.AppliedRotation = angle;
|
||||
}
|
||||
@ -206,19 +207,19 @@ public class SkeletonUtilityBone : MonoBehaviour {
|
||||
float angle = Mathf.LerpAngle(bone.Rotation, Quaternion.LookRotation(flipX ? Vector3.forward * -1 : Vector3.forward, parentReference.InverseTransformDirection(cachedTransform.up)).eulerAngles.z, overrideAlpha);
|
||||
|
||||
// MITCH : remove flipX
|
||||
// float angle = Mathf.LerpAngle(bone.Rotation, Quaternion.LookRotation(flipX ? Vector3.forward * -1 : Vector3.forward, parentReference.InverseTransformDirection(cachedTransform.up)).eulerAngles.z, overrideAlpha) + flipCompensation;
|
||||
// if (flip) {
|
||||
//
|
||||
// if ((!flipX && bone.flipX)) {
|
||||
// angle -= flipCompensation;
|
||||
// }
|
||||
//
|
||||
// //TODO fix this...
|
||||
// if (angle >= 360)
|
||||
// angle -= 360;
|
||||
// else if (angle <= -360)
|
||||
// angle += 360;
|
||||
// }
|
||||
// float angle = Mathf.LerpAngle(bone.Rotation, Quaternion.LookRotation(flipX ? Vector3.forward * -1 : Vector3.forward, parentReference.InverseTransformDirection(cachedTransform.up)).eulerAngles.z, overrideAlpha) + flipCompensation;
|
||||
// if (flip) {
|
||||
//
|
||||
// if ((!flipX && bone.flipX)) {
|
||||
// angle -= flipCompensation;
|
||||
// }
|
||||
//
|
||||
// //TODO fix this...
|
||||
// if (angle >= 360)
|
||||
// angle -= 360;
|
||||
// else if (angle <= -360)
|
||||
// angle += 360;
|
||||
// }
|
||||
bone.Rotation = angle;
|
||||
bone.AppliedRotation = angle;
|
||||
}
|
||||
@ -242,28 +243,28 @@ public class SkeletonUtilityBone : MonoBehaviour {
|
||||
}
|
||||
|
||||
// MITCH : remove flipX
|
||||
// public void FlipX (bool state) {
|
||||
// if (state != flipX) {
|
||||
// flipX = state;
|
||||
// if (flipX && Mathf.Abs(transform.localRotation.eulerAngles.y) > 90) {
|
||||
// skeletonUtility.skeletonAnimation.LateUpdate();
|
||||
// return;
|
||||
// } else if (!flipX && Mathf.Abs(transform.localRotation.eulerAngles.y) < 90) {
|
||||
// skeletonUtility.skeletonAnimation.LateUpdate();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// bone.FlipX = state;
|
||||
// transform.RotateAround(transform.position, skeletonUtility.transform.up, 180);
|
||||
// Vector3 euler = transform.localRotation.eulerAngles;
|
||||
// euler.x = 0;
|
||||
//
|
||||
// euler.y = bone.FlipX ? 180 : 0;
|
||||
// euler.y = 0;
|
||||
// transform.localRotation = Quaternion.Euler(euler);
|
||||
// }
|
||||
// public void FlipX (bool state) {
|
||||
// if (state != flipX) {
|
||||
// flipX = state;
|
||||
// if (flipX && Mathf.Abs(transform.localRotation.eulerAngles.y) > 90) {
|
||||
// skeletonUtility.skeletonAnimation.LateUpdate();
|
||||
// return;
|
||||
// } else if (!flipX && Mathf.Abs(transform.localRotation.eulerAngles.y) < 90) {
|
||||
// skeletonUtility.skeletonAnimation.LateUpdate();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// bone.FlipX = state;
|
||||
// transform.RotateAround(transform.position, skeletonUtility.transform.up, 180);
|
||||
// Vector3 euler = transform.localRotation.eulerAngles;
|
||||
// euler.x = 0;
|
||||
//
|
||||
// euler.y = bone.FlipX ? 180 : 0;
|
||||
// euler.y = 0;
|
||||
// transform.localRotation = Quaternion.Euler(euler);
|
||||
// }
|
||||
|
||||
public void AddBoundingBox (string skinName, string slotName, string attachmentName) {
|
||||
SkeletonUtility.AddBoundingBox(bone.skeleton, skinName, slotName, attachmentName, transform);
|
||||
@ -273,12 +274,13 @@ public class SkeletonUtilityBone : MonoBehaviour {
|
||||
#if UNITY_EDITOR
|
||||
void OnDrawGizmos () {
|
||||
// MITCH : nonuniform scale
|
||||
// if (NonUniformScaleWarning) {
|
||||
// Gizmos.DrawIcon(transform.position + new Vector3(0, 0.128f, 0), "icon-warning");
|
||||
// }
|
||||
// if (NonUniformScaleWarning) {
|
||||
// Gizmos.DrawIcon(transform.position + new Vector3(0, 0.128f, 0), "icon-warning");
|
||||
// }
|
||||
|
||||
if (DisableInheritScaleWarning)
|
||||
Gizmos.DrawIcon(transform.position + new Vector3(0, 0.128f, 0), "icon-warning");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -32,9 +32,9 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[RequireComponent(typeof(SkeletonUtilityBone)), ExecuteInEditMode]
|
||||
|
||||
public abstract class SkeletonUtilityConstraint : MonoBehaviour {
|
||||
namespace Spine.Unity {
|
||||
[RequireComponent(typeof(SkeletonUtilityBone)), ExecuteInEditMode]
|
||||
public abstract class SkeletonUtilityConstraint : MonoBehaviour {
|
||||
|
||||
protected SkeletonUtilityBone utilBone;
|
||||
protected SkeletonUtility skeletonUtility;
|
||||
@ -50,4 +50,5 @@ public abstract class SkeletonUtilityConstraint : MonoBehaviour {
|
||||
}
|
||||
|
||||
public abstract void DoUpdate ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License
|
||||
* Version 2.3
|
||||
*
|
||||
* Copyright (c) 2013-2015, 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 (the "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 otherwise create derivative works, improvements of the
|
||||
* Software or develop new applications using the Software 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; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) 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.
|
||||
*****************************************************************************/
|
||||
using UnityEngine;
|
||||
|
||||
namespace Spine.Unity.Modules {
|
||||
[ExecuteInEditMode]
|
||||
public class SkeletonUtilitySubmeshRenderer : MonoBehaviour {
|
||||
[System.NonSerialized]
|
||||
public Mesh mesh;
|
||||
public int submeshIndex = 0;
|
||||
public Material hiddenPassMaterial;
|
||||
Renderer cachedRenderer;
|
||||
MeshFilter filter;
|
||||
Material[] sharedMaterials;
|
||||
|
||||
void Awake () {
|
||||
cachedRenderer = GetComponent<Renderer>();
|
||||
filter = GetComponent<MeshFilter>();
|
||||
sharedMaterials = new Material[0];
|
||||
}
|
||||
|
||||
public void SetMesh (Renderer parentRenderer, Mesh mesh, Material mat) {
|
||||
if (cachedRenderer == null)
|
||||
return;
|
||||
|
||||
cachedRenderer.enabled = true;
|
||||
filter.sharedMesh = mesh;
|
||||
if (cachedRenderer.sharedMaterials.Length != parentRenderer.sharedMaterials.Length) {
|
||||
sharedMaterials = parentRenderer.sharedMaterials;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sharedMaterials.Length; i++) {
|
||||
if (i == submeshIndex)
|
||||
sharedMaterials[i] = mat;
|
||||
else
|
||||
sharedMaterials[i] = hiddenPassMaterial;
|
||||
}
|
||||
|
||||
cachedRenderer.sharedMaterials = sharedMaterials;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7820c1c2b0e52c6408de899d6939996e
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- parentRenderer: {instanceID: 0}
|
||||
- mesh: {instanceID: 0}
|
||||
- hiddenPassMaterial: {fileID: 2100000, guid: 43227e5adadc6f24bb4bf74b92a56fb4,
|
||||
type: 2}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -7,12 +7,13 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public abstract class SpineAttributeBase : PropertyAttribute {
|
||||
namespace Spine.Unity {
|
||||
public abstract class SpineAttributeBase : PropertyAttribute {
|
||||
public string dataField = "";
|
||||
public string startsWith = "";
|
||||
}
|
||||
}
|
||||
|
||||
public class SpineSlot : SpineAttributeBase {
|
||||
public class SpineSlot : SpineAttributeBase {
|
||||
public bool containsBoundingBoxes = false;
|
||||
|
||||
/// <summary>
|
||||
@ -29,9 +30,9 @@ public class SpineSlot : SpineAttributeBase {
|
||||
this.dataField = dataField;
|
||||
this.containsBoundingBoxes = containsBoundingBoxes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpineEvent : SpineAttributeBase {
|
||||
public class SpineEvent : SpineAttributeBase {
|
||||
/// <summary>
|
||||
/// Smart popup menu for Spine Events (Spine.EventData)
|
||||
/// </summary>
|
||||
@ -44,9 +45,9 @@ public class SpineEvent : SpineAttributeBase {
|
||||
this.startsWith = startsWith;
|
||||
this.dataField = dataField;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpineSkin : SpineAttributeBase {
|
||||
public class SpineSkin : SpineAttributeBase {
|
||||
/// <summary>
|
||||
/// Smart popup menu for Spine Skins
|
||||
/// </summary>
|
||||
@ -59,8 +60,8 @@ public class SpineSkin : SpineAttributeBase {
|
||||
this.startsWith = startsWith;
|
||||
this.dataField = dataField;
|
||||
}
|
||||
}
|
||||
public class SpineAnimation : SpineAttributeBase {
|
||||
}
|
||||
public class SpineAnimation : SpineAttributeBase {
|
||||
/// <summary>
|
||||
/// Smart popup menu for Spine Animations
|
||||
/// </summary>
|
||||
@ -73,9 +74,9 @@ public class SpineAnimation : SpineAttributeBase {
|
||||
this.startsWith = startsWith;
|
||||
this.dataField = dataField;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpineAttachment : SpineAttributeBase {
|
||||
public class SpineAttachment : SpineAttributeBase {
|
||||
public bool returnAttachmentPath = false;
|
||||
public bool currentSkinOnly = false;
|
||||
public bool placeholdersOnly = false;
|
||||
@ -142,9 +143,9 @@ public class SpineAttachment : SpineAttributeBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpineBone : SpineAttributeBase {
|
||||
public class SpineBone : SpineAttributeBase {
|
||||
/// <summary>
|
||||
/// Smart popup menu for Spine Bones
|
||||
/// </summary>
|
||||
@ -166,9 +167,11 @@ public class SpineBone : SpineAttributeBase {
|
||||
var data = skeletonDataAsset.GetSkeletonData(true);
|
||||
return data.FindBone(boneName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpineAtlasRegion : PropertyAttribute {
|
||||
public class SpineAtlasRegion : PropertyAttribute {
|
||||
//TODO: Standardize with Skeleton attributes
|
||||
//NOTE: For now, relies on locally scoped field named "atlasAsset" for source.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user