コード例 #1
0
ファイル: LabelManager.cs プロジェクト: y-ya/simple_card
        static void RemoveAllLabel()
        {
            using (var progress = new EditorProgress("RemoveAllLabel")) {
                progress.UpdateProgress("get all file", 0);
                var all = FileUtilExtra.allAssets;

                progress.UpdateProgress("collect scene file", 0.5f);
                var sceneList = GetAllSceneFile(all);

                int currentSceneCount = 1;
                progress.progressMax = sceneList.Count;

                foreach (var asset in sceneList)
                {
                    string label = CreateLabelName(asset.name);
                    var    sceneReferenceList = new List <Object> (EditorUtility.CollectDependencies(new Object[] { asset }));

                    progress.UpdateProgress(
                        string.Format(" update label fileName:{0} items count:{1}", asset.name, sceneReferenceList.Count),
                        currentSceneCount++);

                    foreach (var obj in all)
                    {
                        RemoveLabel(obj, label);
                    }
                    RemoveLabel(asset, label);
                }
            }
        }
コード例 #2
0
ファイル: LabelManager.cs プロジェクト: y-ya/simple_card
        static void RemoveSceneLabel()
        {
            using (var progress = new EditorProgress("RemoveSceneLabel")) {
                progress.UpdateProgress("collect scene file", 0.5f);
                var sceneList = GetAllSceneFile(Selection.objects);

                int currentSceneCount = 1;
                progress.progressMax = sceneList.Count;


                foreach (var asset in sceneList)
                {
                    progress.UpdateProgress(string.Format(" update label {0}", asset.name), currentSceneCount++);
                    Debug.Log(string.Format(" update label {0}", asset.name));

                    var    scene = new Object[] { asset };
                    string label = CreateLabelName(asset.name);

                    var sceneReferenceList = new List <Object> (EditorUtility.CollectDependencies(scene));
                    foreach (var obj in sceneReferenceList)
                    {
                        RemoveLabel(obj, label);
                    }
                    RemoveLabel(asset, label);
                }
            }
        }
コード例 #3
0
ファイル: LabelManager.cs プロジェクト: y-ya/simple_card
        static void AddSceneLabel()
        {
            using (var progress = new EditorProgress("UpdateSceneLabel")) {
                progress.UpdateProgress("collect scene file", 0.5f);

                var sceneList         = GetAllSceneFile(Selection.objects);
                int currentSceneCount = 1;
                progress.progressMax = sceneList.Count;

                var all = FileUtilExtra.allAssets;

                foreach (var asset in sceneList)
                {
                    var scene = new Object[] { asset };
                    var sceneReferenceList = new List <Object> (EditorUtility.CollectDependencies(scene));

                    string label = CreateLabelName(asset.name);

                    progress.UpdateProgress(
                        string.Format(" update label fileName:{0} items count:{1}", asset.name, sceneReferenceList.Count),
                        currentSceneCount++);

                    foreach (var obj in all)
                    {
                        if (sceneReferenceList.Contains(obj))
                        {
                            AddLabel(obj, label);
                        }
                        else
                        {
                            RemoveLabel(obj, label);
                        }
                    }
                    AddLabel(asset, label);
                }
            }
        }
コード例 #4
0
ファイル: LabelManager.cs プロジェクト: y-ya/simple_card
        static void RemoveDirLabel()
        {
            using (var progress = new EditorProgress("RemoveDirecotryLabel")) {
                progress.UpdateProgress("remove labels", 0);
                string label = CreateLabelName(Selection.activeObject.name);

                var current = FileUtilExtra.currentAssets;
                progress.progressMax = current.Count;

                foreach (var obj in current)
                {
                    RemoveLabel(obj, label);
                }
            }
        }
コード例 #5
0
ファイル: LabelManager.cs プロジェクト: y-ya/simple_card
        static void AddLbelDir()
        {
            using (var progress = new EditorProgress("AddDirectoryLabel")) {
                progress.UpdateProgress("add labels", 0);
                string label = CreateLabelName(Selection.activeObject.name);

                var current = FileUtilExtra.currentAssets;
                progress.progressMax = current.Count;

                foreach (var obj in current)
                {
                    AddLabel(obj, label);
                }
            }
        }
コード例 #6
0
ファイル: LabelManager.cs プロジェクト: y-ya/simple_card
    void OnGUI()
    {
        text = EditorGUILayout.TextField("remove label name", text);

        if (GUILayout.Button("remove labels"))
        {
            var all = TW.FileUtilExtra.allAssets;
            using (var progress = new TW.EditorProgress("RemoveLabels")) {
                progress.progressMax = all.Count;
                int currentAsset = 1;

                foreach (var asset in all)
                {
                    progress.UpdateProgress("clean up ", currentAsset++);
                    TW.LabelManager.RemoveLabel(asset, text);
                }
            }
        }
    }