Ver Fonte

[unity] Some cleanup.

pharan há 8 anos atrás
pai
commit
5d22bef460

+ 32 - 5
spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentUtility.cs → spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentTools.cs

@@ -33,17 +33,43 @@ using System.Collections.Generic;
 
 namespace Spine.Unity.Modules.AttachmentTools {
 	public static class AttachmentRegionExtensions {
+		#region Get
+		/// <summary>
+		/// Tries to get the region (image) of a renderable attachment. If the attachment is not renderable, it returns null.</summary>
+		public static AtlasRegion GetRegion (this Attachment attachment) {
+			var regionAttachment = attachment as RegionAttachment;
+			if (regionAttachment != null)
+				return regionAttachment.RendererObject as AtlasRegion;
+
+			var meshAttachment = attachment as MeshAttachment;
+			if (meshAttachment != null)
+				return meshAttachment.RendererObject as AtlasRegion;
+
+			return null;
+		}
+
+		/// <summary>Gets the region (image) of a RegionAttachment</summary>
+		public static AtlasRegion GetRegion (this RegionAttachment regionAttachment) {
+			return regionAttachment.RendererObject as AtlasRegion;
+		}
+
+		/// <summary>Gets the region (image) of a MeshAttachment</summary>
+		public static AtlasRegion GetRegion (this MeshAttachment meshAttachment) {
+			return meshAttachment.RendererObject as AtlasRegion;
+		}
+		#endregion
+
+		#region Set
 		/// <summary>
 		/// Tries to set the region (image) of a renderable attachment. If the attachment is not renderable, nothing is applied.</summary>
 		public static void SetRegion (this Attachment attachment, AtlasRegion region, bool updateOffset = true) {
 			var regionAttachment = attachment as RegionAttachment;
-			if (regionAttachment != null) {
+			if (regionAttachment != null)
 				regionAttachment.SetRegion(region, updateOffset);
-			} else {
-				var meshAttachment = attachment as MeshAttachment;
-				if (meshAttachment != null)
+
+			var meshAttachment = attachment as MeshAttachment;
+			if (meshAttachment != null)
 					meshAttachment.SetRegion(region, updateOffset);
-			}
 		}
 
 		/// <summary>Sets the region (image) of a RegionAttachment</summary>
@@ -83,6 +109,7 @@ namespace Spine.Unity.Modules.AttachmentTools {
 
 			if (updateUVs) attachment.UpdateUVs();
 		}
+		#endregion
 
 		#region Runtime RegionAttachments
 		/// <summary>

+ 0 - 0
spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentUtility.cs.meta → spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentTools.cs.meta


+ 0 - 0
spine-unity/Assets/spine-unity/Modules/CustomMaterials/readme.txt → spine-unity/Assets/spine-unity/Modules/CustomMaterials/SkeletonRendererCustomMaterials.txt


+ 0 - 0
spine-unity/Assets/spine-unity/Modules/CustomMaterials/readme.txt.meta → spine-unity/Assets/spine-unity/Modules/CustomMaterials/SkeletonRendererCustomMaterials.txt.meta


+ 0 - 49
spine-unity/Assets/spine-unity/SkeletonUtility/Editor/SkeletonUtilitySubmeshRendererInspector.cs

@@ -1,49 +0,0 @@
-/******************************************************************************
- * 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.
- *****************************************************************************/
-
-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 - 8
spine-unity/Assets/spine-unity/SkeletonUtility/Editor/SkeletonUtilitySubmeshRendererInspector.cs.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 67418e462bd4dc24e8c234b92f1d4d9b
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 

+ 0 - 71
spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtilitySubmeshRenderer.cs

@@ -1,71 +0,0 @@
-/******************************************************************************
- * 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.
- *****************************************************************************/
-
-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 - 14
spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtilitySubmeshRenderer.cs.meta

@@ -1,14 +0,0 @@
-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: