public static IsSpineData ( |
||
asset | ||
Résultat | bool |
void RepopulateWarnings() { warnings.Clear(); if (skeletonJSON.objectReferenceValue == null) { warnings.Add("Missing Skeleton JSON"); } else { if (SpineEditorUtilities.IsSpineData((TextAsset)skeletonJSON.objectReferenceValue) == false) { warnings.Add("Skeleton data file is not a valid JSON or binary file."); } else { #if SPINE_TK2D bool searchForSpineAtlasAssets = true; bool isSpriteCollectionNull = spriteCollection.objectReferenceValue == null; if (!isSpriteCollectionNull) { searchForSpineAtlasAssets = false; } #else const bool searchForSpineAtlasAssets = true; #endif if (searchForSpineAtlasAssets) { bool detectedNullAtlasEntry = false; var atlasList = new List <Atlas>(); var actualAtlasAssets = m_skeletonDataAsset.atlasAssets; for (int i = 0; i < actualAtlasAssets.Length; i++) { if (m_skeletonDataAsset.atlasAssets[i] == null) { detectedNullAtlasEntry = true; break; } else { atlasList.Add(actualAtlasAssets[i].GetAtlas()); } } if (detectedNullAtlasEntry) { warnings.Add("AtlasAsset elements should not be null."); } else { // Get requirements. var missingPaths = SpineEditorUtilities.GetRequiredAtlasRegions(AssetDatabase.GetAssetPath((TextAsset)skeletonJSON.objectReferenceValue)); foreach (var atlas in atlasList) { for (int i = 0; i < missingPaths.Count; i++) { if (atlas.FindRegion(missingPaths[i]) != null) { missingPaths.RemoveAt(i); i--; } } } #if SPINE_TK2D if (missingPaths.Count > 0) { warnings.Add("Missing regions. SkeletonDataAsset requires tk2DSpriteCollectionData or Spine AtlasAssets."); } #endif foreach (var str in missingPaths) { warnings.Add("Missing Region: '" + str + "'"); } } } } } }
void RepopulateWarnings() { 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) { warnings.Add("Missing Skeleton JSON"); } else { if (SpineEditorUtilities.IsSpineData((TextAsset)skeletonJSON.objectReferenceValue) == false) { warnings.Add("Skeleton data file is not a valid JSON or binary file."); } else { #if !SPINE_TK2D bool detectedNullAtlasEntry = false; var atlasList = new List <Atlas>(); var actualAtlasAssets = m_skeletonDataAsset.atlasAssets; for (int i = 0; i < actualAtlasAssets.Length; i++) { if (m_skeletonDataAsset.atlasAssets[i] == null) { detectedNullAtlasEntry = true; break; } else { atlasList.Add(actualAtlasAssets[i].GetAtlas()); } } if (detectedNullAtlasEntry) { warnings.Add("AtlasAsset elements should not be null."); } else { // Get requirements. var missingPaths = SpineEditorUtilities.GetRequiredAtlasRegions(AssetDatabase.GetAssetPath((TextAsset)skeletonJSON.objectReferenceValue)); foreach (var atlas in atlasList) { for (int i = 0; i < missingPaths.Count; i++) { if (atlas.FindRegion(missingPaths[i]) != null) { missingPaths.RemoveAt(i); i--; } } } foreach (var str in missingPaths) { warnings.Add("Missing Region: '" + str + "'"); } } #else if (spriteCollection.objectReferenceValue == null) { warnings.Add("SkeletonDataAsset requires tk2DSpriteCollectionData."); } // else // warnings.Add("Your sprite collection may have missing images."); #endif } } }
void RepopulateWarnings() { warnings.Clear(); if (skeletonJSON.objectReferenceValue == null) { warnings.Add("Missing Skeleton JSON"); } else { if (SpineEditorUtilities.IsSpineData((TextAsset)skeletonJSON.objectReferenceValue) == false) { warnings.Add("Skeleton data file is not a valid JSON or binary file."); } else { #if !SPINE_TK2D bool detectedNullAtlasEntry = false; var atlasList = new List <Atlas>(); for (int i = 0; i < atlasAssets.arraySize; i++) { if (atlasAssets.GetArrayElementAtIndex(i).objectReferenceValue == null) { detectedNullAtlasEntry = true; break; } else { atlasList.Add(((AtlasAsset)atlasAssets.GetArrayElementAtIndex(i).objectReferenceValue).GetAtlas()); } } if (detectedNullAtlasEntry) { warnings.Add("AtlasAsset elements should not be null."); } else { // Get requirements. var missingPaths = SpineEditorUtilities.GetRequiredAtlasRegions(AssetDatabase.GetAssetPath((TextAsset)skeletonJSON.objectReferenceValue)); foreach (var atlas in atlasList) { for (int i = 0; i < missingPaths.Count; i++) { if (atlas.FindRegion(missingPaths[i]) != null) { missingPaths.RemoveAt(i); i--; } } } foreach (var str in missingPaths) { warnings.Add("Missing Region: '" + str + "'"); } } #else if (spriteCollection.objectReferenceValue == null) { warnings.Add("SkeletonDataAsset requires tk2DSpriteCollectionData."); } else { warnings.Add("Your sprite collection may have missing images."); } #endif } } }