Esempio n. 1
0
            public void Begin()
            {
                var directories = GetParentDirectories(folder, path);
                var contains    = false;

                for (int i = 0; i < directories.Count; i++)
                {
                    if (folders.Contains(directories[i]))
                    {
                        contains = true;
                        break;
                    }
                }

                if (directories.Count == 0 || !contains)
                {
                    Item = AssetListItem.Get(assetType, path, 0, Path.GetFileNameWithoutExtension(path));
                }

                IsDone = true;
            }
Esempio n. 2
0
        private void ShowDetail(Rect rect, AssetListItem item)
        {
            GUI.Box(rect, string.Empty, GUI.skin.box);
            GUILayout.BeginArea(rect);
            itemDetailScrollPosition = GUILayout.BeginScrollView(itemDetailScrollPosition);
            var oldRichText = EditorStyles.helpBox.richText;

            if (item.WarnLogic.value)
            {
                EditorStyles.helpBox.richText = true;
                EditorGUILayout.HelpBox(item.WarnLogic.message, MessageType.Warning);
            }

            if (item.ErrorLogic.value)
            {
                EditorGUILayout.HelpBox(item.ErrorLogic.message, MessageType.Error);
            }

            EditorStyles.helpBox.richText = oldRichText;
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
Esempio n. 3
0
        public void Refresh(bool forceUpdate = false)
        {
            if (this.assetType == PostprocessorAssetType.Sprite)
            {
                AssetSpriteItem.ClearSpriteAtlasFile();
            }
            var assetGuids = GetAssetGuids(this.assetType);

            if (!forceUpdate)
            {
                if (!IsRequireRefreshAsset(assetGuids))
                {
                    for (int i = 0; i < treeViewItems.Count; i++)
                    {
                        treeViewItems[i].SetDirty();
                    }

                    return;
                }
            }

            treeViewItems.Clear();
            oldAssetGuids = assetGuids;
            if (assetGuids != null)
            {
                List <Task> tasks   = new List <Task>();
                var         folders = postprocessorUtils.GetPaths(this.assetType);
                for (int i = 0; i < assetGuids.Length; i++)
                {
                    tasks.Add(new Task(assetGuids[i], this.folder, this.assetType, folders));
                }

                foreach (var task in tasks)
                {
                    ThreadPool.QueueUserWorkItem(x => { task.Begin(); });
                }

                var completeCount = 0;
                var taskTotal     = tasks.Count;
                while (completeCount < taskTotal)
                {
                    completeCount = 0;
                    foreach (var task in tasks)
                    {
                        completeCount += task.IsDone ? 1 : 0;
                    }
                }

                AssetListItem lastItem = null;
                foreach (var task in tasks)
                {
                    if (task.Item != null)
                    {
                        var item = task.Item;
                        if (lastItem == null || lastItem.Path != item.Path)
                        {
                            treeViewItems.Add(item);
                            lastItem = item;
                        }
                    }
                }
            }

            Reload();
        }