Beispiel #1
0
        public override void SetImporterByConfig(AssetImporter assetImporter, AssetItemConfigBase config)
        {
            AudioImporter importer         = (AudioImporter)assetImporter;
            List <string> setFiledInfoList = new List <string>()
            {
                "forceToMono",
            };
            bool dirty = false;

            foreach (var item in setFiledInfoList)
            {
                dirty |= TrySetField(item, config, importer);
            }

            setFiledInfoList.Clear();
            setFiledInfoList.Add("quality");
            setFiledInfoList.Add("loadType");
            //装箱后操作
            object defaultSample = importer.defaultSampleSettings;

            foreach (var item in setFiledInfoList)
            {
                dirty |= TrySetField(item, config, defaultSample);
            }
            importer.defaultSampleSettings = (AudioImporterSampleSettings)defaultSample;

            if (dirty)
            {
                assetImporter.SaveAndReimport();
            }
        }
Beispiel #2
0
        public override void DrawAssetConfigGUI(AssetItemConfigBase assetItemConfigBase)
        {
            AudioConfig audioConfig = (AudioConfig)assetItemConfigBase;

            audioConfig.forceToMono = EditorGUILayout.Toggle("强制单声道", audioConfig.forceToMono);
            audioConfig.quality     = EditorGUILayout.Slider("音频质量", audioConfig.quality * 100f, 0, 100f) / 100f;
            audioConfig.loadType    = (AudioClipLoadType)EditorGUILayout.EnumPopup("加载方式", audioConfig.loadType);
        }
        public override void DrawAssetConfigGUI(AssetItemConfigBase assetItemConfigBase)
        {
            AtlasOrFontConfig config = (AtlasOrFontConfig)assetItemConfigBase;

            // per platform settings
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Max Texture Size");
            config.maxTextureSize =
                EditorGUILayout.IntPopup(config.maxTextureSize, sizeStrings, sizes);
            EditorGUILayout.EndHorizontal();

            // mip maps
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Generate Mip Maps");
            config.mipmapEnabled = EditorGUILayout.Toggle(config.mipmapEnabled);
            EditorGUILayout.EndHorizontal();

            //read write enabled
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Read/Write Enabled");
            config.isReadable = EditorGUILayout.Toggle(config.isReadable);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Alpha Mip");
            config.alphaMip = EditorGUILayout.Toggle(config.alphaMip);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Strip Alpha Channel");
            config.stripAlpha = EditorGUILayout.Toggle(config.stripAlpha);
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(20);
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Standalone TextureFormat");
                config.standalone = (TextureImporterFormat)EditorGUILayout.EnumPopup(config.standalone);
                EditorGUILayout.EndHorizontal();
            }

            GUILayout.Space(5);
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Android TextureFormat");
                config.Android = (TextureImporterFormat)EditorGUILayout.EnumPopup(config.Android);
                EditorGUILayout.EndHorizontal();
            }

            GUILayout.Space(5);
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("iOS TextureFormat");
                config.iOS = (TextureImporterFormat)EditorGUILayout.EnumPopup(config.iOS);
                EditorGUILayout.EndHorizontal();
            }
        }
        public override void DrawAssetConfigGUI(AssetItemConfigBase assetItemConfigBase)
        {
            MeshImprotConfig config = (MeshImprotConfig)assetItemConfigBase;

            config.isReadable        = EditorGUILayout.Toggle("readWriteEnabled", config.isReadable);
            config.optimizeMesh      = EditorGUILayout.Toggle("optimiseMesh", config.optimizeMesh);
            config.importBlendShapes = EditorGUILayout.Toggle("importBlendShapes", config.importBlendShapes);
            config.importNormals     = (ModelImporterNormals)EditorGUILayout.EnumPopup("importNormals", config.importNormals);
            config.importTangents    = (ModelImporterTangents)EditorGUILayout.EnumPopup("importTangents", config.importTangents);
        }
Beispiel #5
0
        public override void SetImporterByConfig(AssetImporter assetImporter, AssetItemConfigBase config)
        {
            TextureImporter importer         = (TextureImporter)assetImporter;
            TextureConfig   textureConfig    = (TextureConfig)config;
            List <string>   setFiledInfoList = new List <string>()
            {
                "maxTextureSize", "isReadable", "mipmapEnabled"
            };
            bool dirty = false;

            foreach (var item in setFiledInfoList)
            {
                dirty |= TrySetField(item, config, importer);
            }


            if (textureConfig.eachPlatform)
            {
                foreach (KeyValuePair <string, BuildTarget> keyValuePair in buildTargets)
                {
                    var format = textureConfig.GetFormatByTarget(keyValuePair.Value);
                    int maxTextureSize;
                    TextureImporterFormat oldFormat;
                    if (importer.GetPlatformTextureSettings(keyValuePair.Key, out maxTextureSize, out oldFormat) == false ||
                        oldFormat != format ||
                        maxTextureSize != textureConfig.maxTextureSize)
                    {
                        importer.SetPlatformTextureSettings(keyValuePair.Key, textureConfig.maxTextureSize, format);
                        dirty = true;
                    }
                }
            }
            else
            {
                if (textureConfig.textureFormat != importer.textureFormat)
                {
                    dirty = true;
                    importer.textureFormat = textureConfig.textureFormat;
                }
            }


            if (importer.textureType != TextureImporterType.Default)
            {
                importer.textureType = TextureImporterType.Default;
                dirty = true;
            }
            if (dirty)
            {
                assetImporter.SaveAndReimport();
            }
        }
        public override void SetImporterByConfig(AssetImporter assetImporter, AssetItemConfigBase config)
        {
            IEnumerable <string> texPaths = null;

            if (assetImporter is TextureImporter)
            {
                texPaths = new[] { assetImporter.assetPath };
            }
            else
            {
                texPaths = AssetDatabase.GetDependencies(assetImporter.assetPath)
                           .Where(item => item.Contains(Path.GetFileNameWithoutExtension(assetImporter.assetPath)) && AssetImporter.GetAtPath(item) is TextureImporter);
            }

            foreach (string path in texPaths)
            {
                TextureImporter   importer         = (TextureImporter)AssetImporter.GetAtPath(path);
                AtlasOrFontConfig atlasConfig      = (AtlasOrFontConfig)config;
                List <string>     setFiledInfoList = new List <string>()
                {
                    "maxTextureSize", "mipmapEnabled", "isReadable"
                };
                bool dirty = false;
                foreach (var item in setFiledInfoList)
                {
                    dirty |= TrySetField(item, config, importer);
                }
                foreach (KeyValuePair <string, BuildTarget> keyValuePair in buildTargets)
                {
                    var format = atlasConfig.GetFormatByTarget(keyValuePair.Value);
                    int maxTextureSize;
                    TextureImporterFormat oldFormat;
                    if (importer.GetPlatformTextureSettings(keyValuePair.Key, out maxTextureSize, out oldFormat) == false ||
                        oldFormat != format ||
                        maxTextureSize != atlasConfig.maxTextureSize)
                    {
                        importer.SetPlatformTextureSettings(keyValuePair.Key, atlasConfig.maxTextureSize, format);
                        dirty = true;
                    }
                }
                if (importer.textureType != TextureImporterType.Default)
                {
                    importer.textureType = TextureImporterType.Default;
                    dirty = true;
                }
                if (dirty)
                {
                    importer.SaveAndReimport();
                }
            }
        }
        public override void SetImporterByConfig(AssetImporter assetImporter, AssetItemConfigBase config)
        {
            ModelImporter importer         = (ModelImporter)assetImporter;
            List <string> setFiledInfoList = new List <string>()
            {
                "animationCompression", "importMaterials"
            };
            bool dirty = false;

            foreach (var item in setFiledInfoList)
            {
                dirty |= TrySetField(item, config, importer);
            }
            if (dirty)
            {
                assetImporter.SaveAndReimport();
            }
        }
Beispiel #8
0
        public override void DrawAssetConfigGUI(AssetItemConfigBase assetItemConfigBase)
        {
            var config = (TextureConfig)assetItemConfigBase;

            config.maxTextureSize = EditorGUILayout.IntPopup("maxTextureSize", config.maxTextureSize, textureSizeText, textureSize);
            config.isReadable     = EditorGUILayout.Toggle("isReadable", config.isReadable);
            config.mipmapEnabled  = EditorGUILayout.Toggle("mipmapEnabled", config.mipmapEnabled);
            config.eachPlatform   = EditorGUILayout.Toggle("每个平台单独设置", config.eachPlatform);
            if (config.eachPlatform)
            {
                config.standalone = (TextureImporterFormat)EditorGUILayout.EnumPopup("standalone", config.standalone);
                config.iOS        = (TextureImporterFormat)EditorGUILayout.EnumPopup("iOS", config.iOS);
                config.Android    = (TextureImporterFormat)EditorGUILayout.EnumPopup("Android", config.Android);
            }
            else
            {
                config.textureFormat = (TextureImporterFormat)EditorGUILayout.EnumPopup("TextureFormat", config.textureFormat);
            }
        }
        public override void SetImporterByConfig(AssetImporter assetImporter, AssetItemConfigBase config)
        {
            ModelImporter importer         = (ModelImporter)assetImporter;
            List <string> setFiledInfoList = new List <string>()
            {
                "isReadable", "optimizeMesh", "importBlendShapes", "importNormals", "importTangents", "importMaterials"
            };
            bool dirty = false;

            foreach (var item in setFiledInfoList)
            {
                dirty |= TrySetField(item, config, importer);
            }

            if (dirty)
            {
                assetImporter.SaveAndReimport();
            }
        }
Beispiel #10
0
        public override void DrawAssetConfigGUI(AssetItemConfigBase assetItemConfigBase)
        {
            AnimationConfig config = (AnimationConfig)assetItemConfigBase;

            config.animationCompression = (ModelImporterAnimationCompression)EditorGUILayout.EnumPopup("动画压缩模式:", config.animationCompression);
        }
Beispiel #11
0
 public abstract void SetImporterByConfig(AssetImporter assetImporter, AssetItemConfigBase config);
Beispiel #12
0
 public abstract void DrawAssetConfigGUI(AssetItemConfigBase assetItemConfigBase);