/// <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(); }
private static void _RemoveTex(FileInfo fileInfo) { Material mat = EditorTool.Trans2Object <Material>(fileInfo); if (mat != null) { mat.SetTexture(Albedo, null); mat.SetTexture(AO, null); mat.SetTexture(Metallic, null); mat.SetTexture(Normal, null); mat.SetTexture(Emission, null); } }
/// <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(); }
private static void _AddTex(FileInfo fileInfo, List <FileInfo> texs) { Material mat = EditorTool.Trans2Object <Material>(fileInfo); string matName = NameSetting(fileInfo.Name); if (mat != null) { foreach (var tex in texs) { if (NameCompare(matName, tex.Name)) { Texture t = EditorTool.Trans2Object <Texture>(tex); if (t != null) { SelectTex(mat, t); } } } MatSetting(mat); } }