瀏覽代碼

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

badlogic 8 年之前
父節點
當前提交
798f7c584f
共有 1 個文件被更改,包括 26 次插入21 次删除
  1. 26 21
      spine-unity/Assets/spine-unity/Asset Types/Editor/SkeletonDataAssetInspector.cs

+ 26 - 21
spine-unity/Assets/spine-unity/Asset Types/Editor/SkeletonDataAssetInspector.cs

@@ -198,6 +198,32 @@ namespace Spine.Unity.Editor {
 				EditorGUILayout.LabelField("spine-tk2d", EditorStyles.boldLabel);
 				EditorGUILayout.LabelField("spine-tk2d", EditorStyles.boldLabel);
 				EditorGUILayout.PropertyField(spriteCollection, true);
 				EditorGUILayout.PropertyField(spriteCollection, true);
 				#endif
 				#endif
+
+				{
+					bool hasNulls = false;
+					foreach (var a in m_skeletonDataAsset.atlasAssets) {
+						if (a == null) {
+							hasNulls = true;
+							break;
+						}
+					}
+					if (hasNulls) {
+						if (m_skeletonDataAsset.atlasAssets.Length == 1) {
+							EditorGUILayout.HelpBox("Atlas array cannot have null entries!", MessageType.None);
+						} else {
+							EditorGUILayout.HelpBox("Atlas array should not have null entries!", MessageType.Error);
+							if (SpineInspectorUtility.CenteredButton(SpineInspectorUtility.TempContent("Remove null entries"))) {
+								var trimmedAtlasAssets = new List<AtlasAsset>();
+								foreach (var a in m_skeletonDataAsset.atlasAssets) {
+									if (a != null) trimmedAtlasAssets.Add(a);
+								}
+								m_skeletonDataAsset.atlasAssets = trimmedAtlasAssets.ToArray();
+								serializedObject.Update();
+							}
+						}
+
+					}
+				}
 			}
 			}
 
 
 			if (EditorGUI.EndChangeCheck()) {
 			if (EditorGUI.EndChangeCheck()) {
@@ -446,25 +472,6 @@ namespace Spine.Unity.Editor {
 		void RepopulateWarnings () {
 		void RepopulateWarnings () {
 			warnings.Clear();
 			warnings.Clear();
 
 
-			// Clear null entries.
-			{
-				bool hasNulls = false;
-				foreach (var a in m_skeletonDataAsset.atlasAssets) {
-					if (a == null) {
-						hasNulls = true;
-						break;
-					}
-				}
-				if (hasNulls) {
-					var trimmedAtlasAssets = new List<AtlasAsset>();
-					foreach (var a in m_skeletonDataAsset.atlasAssets) {
-						if (a != null) trimmedAtlasAssets.Add(a);
-					}
-					m_skeletonDataAsset.atlasAssets = trimmedAtlasAssets.ToArray();
-				}
-				serializedObject.Update();
-			}
-
 			if (skeletonJSON.objectReferenceValue == null) {
 			if (skeletonJSON.objectReferenceValue == null) {
 				warnings.Add("Missing Skeleton JSON");
 				warnings.Add("Missing Skeleton JSON");
 			} else {
 			} else {
@@ -475,8 +482,6 @@ namespace Spine.Unity.Editor {
 					bool searchForSpineAtlasAssets = true;
 					bool searchForSpineAtlasAssets = true;
 					bool isSpriteCollectionNull = spriteCollection.objectReferenceValue == null;
 					bool isSpriteCollectionNull = spriteCollection.objectReferenceValue == null;
 					if (!isSpriteCollectionNull) searchForSpineAtlasAssets = false;
 					if (!isSpriteCollectionNull) searchForSpineAtlasAssets = false;
-					//else
-					//	warnings.Add("Your sprite collection may have missing images.");
 					#else
 					#else
 					const bool searchForSpineAtlasAssets = true;
 					const bool searchForSpineAtlasAssets = true;
 					#endif
 					#endif