static UMAEditorUtilities() { FriendlyNames.Add(typeof(SlotDataAsset), "Slot"); FriendlyNames.Add(typeof(OverlayDataAsset), "Overlay"); FriendlyNames.Add(typeof(RaceData), "Race"); FriendlyNames.Add(typeof(UMATextRecipe), "Text Recipe"); FriendlyNames.Add(typeof(UMAWardrobeRecipe), "Wardrobe Recipe"); FriendlyNames.Add(typeof(UMAWardrobeCollection), "Wardrobe Collection"); FriendlyNames.Add(typeof(AnimatorController), "Animator Controller"); FriendlyNames.Add(typeof(TextAsset), "Text"); FriendlyNames.Add(typeof(DynamicUMADnaAsset), "Dynamic DNA"); icon = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/UMA/InternalDataStore/UmaIndex.png"); showIndexedTypes = EditorPrefs.GetBool("BoolUMAShowTypes", true); showUnindexedTypes = EditorPrefs.GetBool("BoolUMAShowUnindexed", true); if (icon == null) { Debug.Log("Unable to load texture icon"); } UMAAssetIndexer ai = UMAAssetIndexer.Instance; if (showIndexedTypes) { EditorApplication.projectWindowItemOnGUI += DrawItems; } }
public bool Prepare() { Index = UMAAssetIndexer.Instance; foreach (Type t in Index.GetTypes()) { Index.ClearAddressableFlags(t); } Recipes = new List <UMAPackedRecipeBase>(); return(true); }
private static void RunCallbacks() { if (!ranOnce) { FriendlyNames = new Dictionary <Type, string>(); FriendlyNames.Add(typeof(SlotDataAsset), "Slot"); FriendlyNames.Add(typeof(OverlayDataAsset), "Overlay"); FriendlyNames.Add(typeof(RaceData), "Race"); FriendlyNames.Add(typeof(UMATextRecipe), "Text Recipe"); FriendlyNames.Add(typeof(UMAWardrobeRecipe), "Wardrobe Recipe"); FriendlyNames.Add(typeof(UMAWardrobeCollection), "Wardrobe Collection"); FriendlyNames.Add(typeof(AnimatorController), "Animator Controller"); FriendlyNames.Add(typeof(TextAsset), "Text"); FriendlyNames.Add(typeof(DynamicUMADnaAsset), "Dynamic DNA"); string[] iconTextures = AssetDatabase.FindAssets("t:texture UmaIndex"); if (iconTextures != null && iconTextures.Length > 0) { icon = AssetDatabase.LoadAssetAtPath <Texture2D>(AssetDatabase.GUIDToAssetPath(iconTextures[0])); } else { if (Debug.isDebugBuild) { Debug.LogWarning("Unable to load texture icon"); } } showIndexedTypes = EditorPrefs.GetBool("BoolUMAShowTypes", true); showUnindexedTypes = EditorPrefs.GetBool("BoolUMAShowUnindexed", false); UMAAssetIndexer ai = UMAAssetIndexer.Instance; if (showIndexedTypes && ai != null) { EditorApplication.projectWindowItemOnGUI += DrawItems; } ranOnce = true; return; } }
// Start is called before the first frame update static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { string UMAVER = "UMA " + UmaAboutWindow.umaVersion; if (BuildPipeline.isBuildingPlayer || UnityEditorInternal.InternalEditorUtility.inBatchMode || Application.isPlaying) { return; } if (EditorPrefs.GetString("UMA_VERSION", "0") != UmaAboutWindow.umaVersion) { UMAAssetIndexer UAI = UMAAssetIndexer.Instance; if (UAI == null) { return; } int chosen = EditorUtility.DisplayDialogComplex("UMA " + UmaAboutWindow.umaVersion, "New UMA version imported. The global index should be rebuilt or restored (if you made a backup). (If you don't know what this means, choose 'Rebuild Index')", "Rebuild Index", "Restore from backup", "Do nothing"); switch (chosen) { case 0: UAI.Clear(); UAI.BuildStringTypes(); UAI.AddEverything(false); Resources.UnloadUnusedAssets(); EditorUtility.DisplayDialog(UMAVER, "Index rebuild complete", "OK"); break; case 1: string filename = EditorUtility.OpenFilePanel("Restore", "", "bak"); if (!string.IsNullOrEmpty(filename)) { try { string backup = System.IO.File.ReadAllText(filename); EditorUtility.DisplayProgressBar(UMAVER, "Restoring index", 0); if (!UAI.Restore(backup)) { EditorUtility.DisplayDialog(UMAVER, "Error: Unable to restore index. Please review the console for more information.", "OK"); } else { EditorUtility.DisplayDialog(UMAVER, "Restore successful.", "OK"); } backup = ""; } catch (Exception ex) { Debug.LogException(ex); EditorUtility.DisplayDialog("Error", "Error reading backup: " + ex.Message, "OK"); } EditorUtility.ClearProgressBar(); } break; default: EditorUtility.DisplayDialog("UMA " + UmaAboutWindow.umaVersion, "You can rebuild or restore the library from the Global Library window accessable from the UMA menu above.", "OK"); break; } EditorPrefs.SetString("UMA_VERSION", UmaAboutWindow.umaVersion); } }