- 最后登录
- 2016-5-26
- 注册时间
- 2014-3-28
- 阅读权限
- 10
- 积分
- 23
- 纳金币
- 305
- 精华
- 0
|
有时候需要修改下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);
}
}
|
|