查看: 1158|回复: 0
打印 上一主题 下一主题

[经验分享] 代码修改fbx的压缩级别

[复制链接]

1

主题

1

听众

23

积分

设计初学者

Rank: 1

纳金币
305
精华
0
跳转到指定楼层
楼主
发表于 2016-5-26 19:48:31 |只看该作者 |倒序浏览
有时候需要修改下fbx文件的压缩级别,手动改太费事了。写个脚本,自动改
using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;
public class meshEdit : Editor
{
       
        [MenuItem("MLDJ/Utils/EditFbx")]
        public static void Removefbx()
        {
               
                UnityEngine.Object[] textures = GetSelectedfBX();
               

                foreach (UnityEngine.Object  texture in textures)  {

                        string path = AssetDatabase.GetAssetPath(texture);
                       
                        //Debug.Log("path: " + path);

               
                        ModelImporter  textureImporter = AssetImporter.GetAtPath(path) as ModelImporter;
                        if(textureImporter!=null)
                        {
                        textureImporter.meshCompression=ModelImporterMeshCompression.High;
                                textureImporter.normalImportMode=ModelImporterTangentSpaceMode.None;
                                textureImporter.tangentImportMode=ModelImporterTangentSpaceMode.None;
                                textureImporter.isReadable=false;

                        }
                       
                        AssetDatabase.ImportAsset(path);
                       
                }
        }
               
        static UnityEngine.Object[] GetSelectedfBX()
               
        {
               
                return Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
               
        }       

}


分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-9-24 01:16 , Processed in 0.581092 second(s), 33 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部