コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 public void SetAssetType(PostprocessorAssetType assetType)
 {
     if (this.assetType != assetType)
     {
         this.assetType = assetType;
         Refresh();
     }
 }
コード例 #4
0
 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;
 }
コード例 #5
0
        public void SetAssetType(PostprocessorAssetType assetType)
        {
            if (this.assetType == assetType)
            {
                return;
            }

            this.assetType = assetType;
            Refresh();
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 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);
         }
     }
 }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
 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);
     }
 }
コード例 #12
0
 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;
     }
 }
コード例 #13
0
        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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
ファイル: AssetListItem.cs プロジェクト: linyichie/Game
        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);
        }