//public static void MakeSpineSplitSprite(string path) //{ // OptimizingSpineResource(path); //} // 打所有图集 //public static void MakeAllAtlas() //{ // DirectoryInfo root = new DirectoryInfo(PATH_ATLAS); // int count = root.GetDirectories().Length; // int index = 0; // foreach (DirectoryInfo atlas in root.GetDirectories()) // { // index++; // ExportAtlasWithoutProgress(PATH_ATLAS + "/" + atlas.Name, atlas.Name); // EditorUtility.DisplayProgressBar(index + "/" + count, atlas.Name, (float)index / (float)count); // } // EditorUtility.ClearProgressBar(); // Debug.Log("Build All Atlas Completed"); //} #endregion public static void ExportAtlas(string path, string name, bool isCompress = true, bool isSplitChannel = true) { bool trim = true; int totalCount = 5; int current = 0; EditorUtility.DisplayProgressBar(name, "MAKE_ATLAS", (++current) / totalCount); AtlasEditorHelper.BuildMakeAtlas(name, path, PATH_TP_TEMP, trim); EditorUtility.DisplayProgressBar(name, "SPLIT_CHANNEL", (++current) / totalCount); string pathSplitDst = string.Format("{0}/{1}", PATH_ATLAS_TP, name); AtlasEditorHelper.BuildSplitChannel(name, PATH_TP_TEMP, pathSplitDst, isCompress, isSplitChannel); EditorUtility.DisplayProgressBar(name, "CREATE_MATERIAL", (++current) / totalCount); AtlasEditorHelper.BuildCreateMaterial(name, PATH_ATLAS_TP, isSplitChannel); EditorUtility.DisplayProgressBar(name, "IMPORT_SPRITE", (++current) / totalCount); AtlasEditorHelper.BuildImportSprite(name, path, PATH_TP_TEMP, PATH_ATLAS_TP, isCompress); EditorUtility.DisplayProgressBar(name, "CREATE_PREFAB", (++current) / totalCount); AtlasEditorHelper.BuildCreateSpritePrefab(name, PATH_TP_TEMP, PATH_ATLAS_TP); EditorUtility.ClearProgressBar(); }
//public static void MakeOnlyTP(Object obj) //{ // string sorPath = AssetDatabase.GetAssetPath(obj); // string name = Path.GetFileNameWithoutExtension(sorPath); // ExportOnlyTP(sorPath, name); //} //private static void ExportOnlyTP(string path, string name) //{ // int totalCount = 1; // int current = 0; // bool trim = true; // AtlasEditorHelper.PlayProgressBar(name, "MAKE_ATLAS", (++current) / totalCount); // AtlasEditorHelper.BuildMakeAtlas(name, path, path, trim); // AtlasEditorHelper.ClearProgressBar(); //} //拆分通道 public static void BuildSplitChannel(string path) { if (File.Exists(path)) { //int index = path.LastIndexOf("/"); string name = Path.GetFileNameWithoutExtension(path); string p = Path.GetDirectoryName(path); AtlasEditorHelper.BuildSplitChannel(name, p, p, false); } else { DirectoryInfo root = new DirectoryInfo(path); FileInfo[] files = root.GetFiles(); foreach (FileInfo info in files) { string name = info.Name; name = name.Replace(".png", ""); AtlasEditorHelper.BuildSplitChannel(name, path, path, false); } } Debug.Log("SplitPngChannel Completed"); }