Beispiel #1
0
        public void SetMenuTree(OdinMenuTree tree)
        {
            TextureImpoterCfg.Instance.Load();
            var texImporterView = new TextureImpoterView();

            tree.Add(TAB_TEXTURE, texImporterView, EditorIcons.SettingsCog);
            var dict = AMTool.GetDictionary(TextureImpoterCfg.Instance.TextureSettings);

            foreach (var item in dict)
            {
                string path = item.Key.Replace(Application.dataPath, TAB_TEXTURE);
                tree.Add(path, item.Value);
            }

            tree.Selection.SelectionChanged -= OnSelectionItemChange;
            tree.Selection.SelectionChanged += OnSelectionItemChange;
        }
Beispiel #2
0
        //-------特殊导入方案
        /// <summary>
        /// 检查当前设置是否适合包含的资源
        /// </summary>
        public void CheckSettingIllegel()
        {
            Dictionary <string, TextureSetting> dict = AMTool.GetDictionary(TextureSettings);
            float         count          = 0;
            StringBuilder nullBuilder    = new StringBuilder();
            StringBuilder illegelBuilder = new StringBuilder();

            foreach (var item in dict)
            {
                EditorUtility.DisplayProgressBar("检查", item.Value.RelPath, count++ / dict.Count);
                if (item.Value.Children.Count > 0 || !item.Value.IsActive)
                {
                    continue;
                }

                bool hasAlpha = item.Value.AndroidImporterFormat == TextureImporterFormat.ETC2_RGBA8 ||
                                item.Value.IOSImporterFormat == TextureImporterFormat.PVRTC_RGBA4;
                string[] fs = Directory.GetFiles(AMTool.GetAbsPath(item.Value.RelPath), "*.*", SearchOption.TopDirectoryOnly);
                foreach (var f in fs)
                {
                    if (Path.GetExtension(f).Equals(".meta"))
                    {
                        continue;
                    }

                    string          relPath  = AMTool.GetUnityPath(f);
                    TextureImporter importer = AssetImporter.GetAtPath(relPath) as TextureImporter;
                    if (importer == null)
                    {
                        nullBuilder.AppendLine(relPath);
                        continue;
                    }
                    if (importer.DoesSourceTextureHaveAlpha() == hasAlpha)
                    {
                        continue;
                    }

                    illegelBuilder.AppendLine(relPath);
                }
            }
            Debug.LogError(illegelBuilder.ToString());
            Debug.LogError("---------------TextureImporter-NULL----------------");
            Debug.LogError(nullBuilder.ToString());
            EditorUtility.ClearProgressBar();
        }