public void SetPostprocessor(PostprocessorAssetType assetType, string guid) { if (this.assetType != assetType || this.guid != guid) { this.assetType = assetType; this.guid = guid; postprocessorWidget = null; switch (assetType) { case PostprocessorAssetType.SpriteAtlas: case PostprocessorAssetType.Sprite: case PostprocessorAssetType.Texture: postprocessorWidget = new TexturePostprocessorBaseWidget(this.guid, true); break; case PostprocessorAssetType.Model: postprocessorWidget = new ModelPostprocessorWidget(this.guid, true); break; } if (postprocessorWidget != null) { postprocessorWidget.OnChanged += HandleOnChanged; } } }
public void Set(PostprocessorAssetType assetType, string path, string guid, bool forceUpdate = true) { if (folders == null) { folders = new List <AssetPostprocessorFolder>(); } var index = folders.FindIndex((x) => x.path == path); if (index >= 0) { folders[index] = new AssetPostprocessorFolder() { assetType = assetType, path = path, guid = guid, }; } else { folders.Add(new AssetPostprocessorFolder() { assetType = assetType, path = path, guid = guid, }); } EditorUtility.SetDirty(this); if (forceUpdate) { AssetDatabase.SaveAssets(); } }
public void SetAssetType(PostprocessorAssetType assetType) { if (this.assetType != assetType) { this.assetType = assetType; Refresh(); } }
public Task(string guid, string folder, PostprocessorAssetType assetType, List <string> folders) { this.guid = guid; this.path = AssetDatabase.GUIDToAssetPath(this.guid); this.folder = folder; this.assetType = assetType; this.folders = folders; }
public void SetAssetType(PostprocessorAssetType assetType) { if (this.assetType == assetType) { return; } this.assetType = assetType; Refresh(); }
public List <string> GetPaths(PostprocessorAssetType assetType) { var query = folders.FindAll((x) => x.assetType == assetType); List <string> paths = new List <string>(); for (int i = 0; i < query.Count; i++) { paths.Add(query[i].path); } return(paths); }
public string Get(PostprocessorAssetType assetType, string path) { var list = folders?.FindAll((x) => x.assetType == assetType && path.StartsWith(x.path)); if (list != null && list.Count > 0) { list.Sort((lhs, rhs) => { return(-lhs.path.Length.CompareTo(rhs.path.Length)); }); return(list[0].guid); } return(string.Empty); }
public void Remove(PostprocessorAssetType assetType, string path) { if (folders != null) { var index = folders.FindIndex((x) => x.path == path && x.assetType == assetType); if (index >= 0) { folders.RemoveAt(index); EditorUtility.SetDirty(this); } } }
private void ShowToolbar() { toolbarRect = new Rect(toolBarHeight + 10, splitterWidth, 80 * assetTypeOptions.Length, toolBarHeight); var documentRect = new Rect(5, splitterWidth, toolBarHeight, toolBarHeight); if (GUI.Button(documentRect, documentIcon)) { Application.OpenURL(documentUrl); } selectAssetType = (PostprocessorAssetType)GUI.Toolbar(toolbarRect, (int)selectAssetType, assetTypeOptions); ShowFixTool(toolbarRect); }
private string[] GetAssetGuids(PostprocessorAssetType assetType) { if (string.IsNullOrEmpty(this.folder)) { return(null); } var assetGuids = AssetDatabase.FindAssets(Helper.GetAssetSearchFilterByAssetType(this.assetType), new string[] { this.folder }); return(assetGuids); }
public void SetFolder(PostprocessorAssetType assetType, string path) { if (this.assetType != assetType || this.folder != path) { this.assetType = assetType; this.folder = path; selectState = AssetState.None; var guid = postprocessorUtils.Get(this.assetType, this.folder); var assetPath = AssetDatabase.GUIDToAssetPath(guid); soAssetPostprocessor = AssetDatabase.LoadAssetAtPath <SoAssetPostprocessor>(assetPath); postprocessorGuid = guid; Refresh(true); } }
public static void SetDefaultSettings(PostprocessorAssetType assetType, TextureImporter importer) { importer.alphaIsTransparency = importer.DoesSourceTextureHaveAlpha(); importer.sRGBTexture = true; importer.isReadable = false; importer.mipmapEnabled = false; importer.streamingMipmaps = false; importer.filterMode = FilterMode.Bilinear; importer.wrapMode = TextureWrapMode.Clamp; if (assetType == PostprocessorAssetType.Texture) { importer.npotScale = TextureImporterNPOTScale.ToNearest; } }
public static SoAssetPostprocessor Create(PostprocessorAssetType assetType) { switch (assetType) { case PostprocessorAssetType.SpriteAtlas: return(SoSpriteAtlasPostprocessor.Create()); case PostprocessorAssetType.Sprite: return(SoSpritePostprocessor.Create()); case PostprocessorAssetType.Texture: return(SoTexturePostprocessor.Create()); case PostprocessorAssetType.Model: return(SoModelPostprocessor.Create()); } return(null); }
public static SoAssetPostprocessor GetDefault(PostprocessorAssetType assetType) { switch (assetType) { case PostprocessorAssetType.SpriteAtlas: return(SoSpriteAtlasPostprocessor.GetDefaultSoPostprocessor()); case PostprocessorAssetType.Sprite: return(SoSpritePostprocessor.GetDefaultSoPostprocessor()); case PostprocessorAssetType.Texture: return(SoTexturePostprocessor.GetDefaultSoPostprocessor()); case PostprocessorAssetType.Model: return(SoModelPostprocessor.GetDefaultSoPostprocessor()); } return(null); }
public static AssetListItem Get(PostprocessorAssetType assetType, string path, int depth, string displayName) { switch (assetType) { case PostprocessorAssetType.SpriteAtlas: return(new AssetListSpriteAtlasItem(path, depth, displayName)); case PostprocessorAssetType.Sprite: return(new AssetSpriteItem(path, depth, displayName)); case PostprocessorAssetType.Texture: return(new AssetTextureItem(path, depth, displayName)); case PostprocessorAssetType.Model: return(new AssetModelItem(path, depth, displayName)); default: throw new ArgumentOutOfRangeException(nameof(assetType), assetType, null); } return(null); }