private static void SetTex(bool isAdd) { string path = EditorTool.GetSelectionPath(true); SystemIOTool.GetFileInfoList(path, mats, matSuffix); if (isAdd) { SystemIOTool.GetFileInfoList(path, texs, texSuffix); } for (int i = 0; i < mats.Count; i++) { FileInfo fileInfo = mats[i]; if (isAdd) { EditorUtility.DisplayProgressBar("AddTex", "给材质添加贴图ing", 1f * i / mats.Count); _AddTex(fileInfo, texs); } else { EditorUtility.DisplayProgressBar("RemoveTex", "给材质移除贴图ing", 1f * i / mats.Count); _RemoveTex(fileInfo); } AssetDatabase.RemoveUnusedAssetBundleNames(); } EditorUtility.ClearProgressBar(); }
/// <summary> /// 创建选中对象的assetbundle /// </summary> /// <param name="path">对象的路径</param> /// <param name="outputPath">输出路径</param> public static void BuildSelectionAB(string outputPath) { string path = EditorTool.GetSelectionPath(); List <string> paths = new List <string>() { path }; BuildTargetAB(paths, outputPath); EditorUtility.ClearProgressBar(); }
private static void SetReadWrite(bool isEnable) { models = SystemIOTool.GetTargetPaths(EditorTool.GetSelectionPath(), false, modelSuffix); for (int i = 0; i < models.Count; i++) { EditorUtility.DisplayProgressBar("SetRead&Write", "设置模型的Read&Write属性", 1f * i / models.Count); ModelImporter m = AssetImporter.GetAtPath(models[i]) as ModelImporter; m.isReadable = isEnable; AssetDatabase.ImportAsset(models[i]); } EditorUtility.ClearProgressBar(); }
/// <summary> /// 清空资源的AssetBundle名字 /// </summary> public static void ClearABName() { string folderPath = EditorTool.GetSelectionPath(true); List <string> paths = SystemIOTool.GetTargetPaths(folderPath); int count = paths.Count; for (int i = 0; i < paths.Count; i++) { EditorUtility.DisplayProgressBar("EditorHelper", "Clearing AssetBundle Names", 1f * i / count); SetABName(paths[i], null); } AssetDatabase.RemoveUnusedAssetBundleNames(); EditorUtility.ClearProgressBar(); }
/// <summary> /// 设置MipMaps /// </summary> private static void SetMipMaps(bool isOpen) { texs = SystemIOTool.GetTargetPaths(EditorTool.GetSelectionPath(), false, texSuffix); for (int i = 0; i < texs.Count; i++) { EditorUtility.DisplayProgressBar("SetMipMaps", "设置贴图的MipMaps属性", 1f * i / texs.Count); TextureImporter t = AssetImporter.GetAtPath(texs[i]) as TextureImporter; t.mipmapEnabled = isOpen; TextureImporterSettings tis = new TextureImporterSettings(); t.ReadTextureSettings(tis); tis.ApplyTextureType(tis.textureType); t.SetTextureSettings(tis); AssetDatabase.ImportAsset(texs[i]); } EditorUtility.ClearProgressBar(); }