// 递归创建目录 static public void recurseCreateStreamDirectory(string pathAndName) { string curpath = ""; string leftpath = ""; string fullpath = ""; leftpath = pathAndName.Substring(Application.streamingAssetsPath.Length + 1); int slashIdx = 0; slashIdx = leftpath.IndexOf("/"); while (slashIdx != -1) { if (curpath.Length > 0) { curpath += "/"; } curpath += leftpath.Substring(0, slashIdx); leftpath = leftpath.Substring(slashIdx + 1, leftpath.Length - slashIdx - 1); fullpath = getStreamingDataPath(curpath); UtilPath.createDirectory(fullpath); slashIdx = leftpath.IndexOf("/"); } }
public static void buildImage(BuildOptions option = BuildOptions.None) { string outputImagePath = ExportUtil.getImagePath("", ResExportSys.m_instance.m_targetPlatform); UtilPath.deleteDirectory(outputImagePath); UtilPath.createDirectory(outputImagePath); string[] levelsPath = new string[1]; // 打包第一个启动场景目录 levelsPath[0] = "Assets/Scenes/Start.unity"; string targetName = ExportUtil.GetBuildTargetName(ResExportSys.m_instance.m_targetPlatform /*EditorUserBuildSettings.activeBuildTarget*/); if (targetName == null) { return; } // Build and copy AssetBundles. //option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None; PlayerParam param = new PlayerParam(); param.m_levels = levelsPath; param.m_locationPath = outputImagePath + targetName; param.m_target = ResExportSys.m_instance.m_targetPlatform; param.m_options = option; ExportUtil.BuildPlayer(param); }
public void exportSubMeshBoneFile(SkelMeshParam param, ref string xmlStr) { List <string> pathList = new List <string>(); pathList.Add(param.m_inPath); pathList.Add(param.m_name); string resPath = ExportUtil.getRelDataPath(UtilPath.combine(pathList.ToArray())); GameObject go = AssetDatabase.LoadAssetAtPath(resPath, ExportUtil.convResStr2Type(m_resType)) as GameObject; string ret = ""; if (go != null) { SkinnedMeshRenderer render = go.transform.Find(m_name).gameObject.GetComponent <SkinnedMeshRenderer>(); if (render != null) { foreach (Transform tran in render.bones) { if (ret.Length > 0) { ret += ","; } ret += tran.gameObject.name; } } } xmlStr += string.Format(" <SubMesh name=\"{0}\" bonelist=\"{1}\" />\n", m_part, ret); }
public void exportSubMeshBone(SkelMeshParam param, XmlDocument xmlDocSave, XmlElement meshXml) { XmlElement subMeshXml = xmlDocSave.CreateElement("SubMesh"); meshXml.AppendChild(subMeshXml); List <string> pathList = new List <string>(); pathList.Add(param.m_inPath); pathList.Add(param.m_name); string resPath = ExportUtil.getRelDataPath(UtilPath.combine(pathList.ToArray())); GameObject go = AssetDatabase.LoadAssetAtPath(resPath, ExportUtil.convResStr2Type(m_resType)) as GameObject; string ret = ""; if (go != null) { SkinnedMeshRenderer render = go.transform.Find(m_name).gameObject.GetComponent <SkinnedMeshRenderer>(); if (render != null) { foreach (Transform tran in render.bones) { if (ret.Length > 0) { ret += ","; } ret += tran.gameObject.name; } } } subMeshXml.SetAttribute("bonelist", ret); }
protected void addResListItem(string srcFullPath, string destFullPath) { ResListItem item = new ResListItem(); item.m_srcName = ExportUtil.rightSubStr(srcFullPath, m_srcRoot); if (m_unity3dExtNameList.IndexOf(UtilPath.getFileExt(srcFullPath)) != -1) // 如果需要打包成 unity3d { item.m_destName = string.Format("{0}{1}", item.m_srcName.Substring(0, item.m_srcName.IndexOf('.')), UtilApi.DOTUNITY3D); } else { item.m_destName = item.m_srcName; } if (m_destRoot.Length > 0) { item.m_destName = string.Format("{0}/{1}", m_destRoot, item.m_destName); } // 如果是 unity 扩展名字的场景文件,需要在原始文件名字前面添加 Scenes 子目录 if (UtilPath.getFileExt(item.m_srcName) == "unity") { item.m_srcName = string.Format("Scenes/{0}", item.m_srcName); } ResExportSys.m_instance.m_pResourcesCfgPackData.m_exportResList.addItem(item); }
protected void exportSkinsFile_OneSubMeshOneFile() { foreach (Mesh mesh in m_meshList) { foreach (SubMesh subMesh in mesh.m_subMeshList) { string xmlStr = "<?xml version='1.0' encoding='utf-8' ?>\n<Root>\n"; xmlStr += string.Format(" <Mesh name=\"{0}\" >\n", UtilPath.getFileNameNoExt(mesh.skelMeshParam.m_name)); subMesh.exportSubMeshBoneFile(mesh.skelMeshParam, ref xmlStr); xmlStr += " </Mesh>\n"; xmlStr += "</Root>"; string xmlName = string.Format("{0}.xml", UtilPath.getFileNameNoExt(subMesh.m_part)); //string xmlPath = string.Format("{0}/{1}/{2}", m_outPath, m_modelTypes.modelTypeDic[mesh.skelMeshParam.m_modelType].subPath, xmlName); string xmlPath = string.Format("{0}/{1}", m_outPath, xmlName); xmlPath = ExportUtil.getDataPath(xmlPath); UtilPath.deleteFile(xmlPath); FileStream fileStream = new FileStream(xmlPath, FileMode.CreateNew); byte[] data = new UTF8Encoding().GetBytes(xmlStr); //开始写入 fileStream.Write(data, 0, data.Length); //清空缓冲区、关闭流 fileStream.Flush(); fileStream.Close(); fileStream.Dispose(); } } }
public void exportSplatTexture_NotRun() { string path = Application.streamingAssetsPath; int idx = 0; SplatPrototype splatLayer = null; Texture2D writeTex = null; Color color; for (idx = 0; idx < terrainData.splatPrototypes.Length; ++idx) { splatLayer = terrainData.splatPrototypes[idx]; writeTex = new Texture2D(splatLayer.texture.width, splatLayer.texture.height, TextureFormat.RGB24, false); for (int imageY = 0; imageY < splatLayer.texture.height; ++imageY) { for (int imageX = 0; imageX < splatLayer.texture.width; ++imageX) { // 这个纹理是不能读写的,需要使用 AssetDatabase.GetAssetPath 读取纹理目录 color = splatLayer.texture.GetPixel(imageX, imageY); writeTex.SetPixel(imageX, imageY, color); } } UtilPath.saveTex2File(splatLayer.texture, path + "/SplatTextures" + idx + ".png"); } }
public void exportScaleHeightMap() { string fileName = string.Format("{0}/{1}.png", Application.dataPath, "heightmap"); int w = terrainData.heightmapWidth; int h = terrainData.heightmapHeight; Vector3 meshScale = terrainData.size; float tRes = Mathf.Pow(2, (int)saveResolution); meshScale = new Vector3(meshScale.x / (w - 1) * tRes, meshScale.y, meshScale.z / (h - 1) * tRes); float[,] tData = terrainData.GetHeights(0, 0, w, h); w = (int)((w - 1) / tRes + 1); h = (int)((h - 1) / tRes + 1); Vector3[] tVertices = new Vector3[w * h]; float height = 0; Texture2D heightMap = new Texture2D(w, h, TextureFormat.BGRA32, true); Color color = new Color(0, 0, 0, 0); for (int idy = 0; idy < h; idy++) { for (int idx = 0; idx < w; idx++) { //tVertices[y * w + x] = Vector3.Scale(meshScale, new Vector3(x, (int)(tData[(int)(x * tRes), (int)(y * tRes)]), y)) + terrainPos; height = tData[(int)(idy * tRes), (int)(idx * tRes)]; color = new Color(height, height, height, height); heightMap.SetPixel(idx, idy, color); } } UtilPath.saveTex2File(heightMap, fileName); }
public void exportHeightMap() { string fileName = string.Format("{0}/Resources/Materials/Textures/Terrain/{1}_{2}.png", Application.dataPath, mHeightMapNamePrefix, mTerrainId); int w = terrainData.heightmapWidth; int h = terrainData.heightmapHeight; Vector3 meshScale = terrainData.size; float[,] tData = terrainData.GetHeights(0, 0, w, h); //float fx = 0; //float fy = 0; Color color = new Color(0, 0, 0, 0); float height = 0; Texture2D heightMap = new Texture2D(w, h, TextureFormat.BGRA32, true); for (int idy = 0; idy < h; ++idy) { for (int idx = 0; idx < w; ++idx) { height = tData[idy, idx]; // 这个是插值的高度 //fx = ((float)idx) / w; //fy = ((float)idy) / h; //height = terrainData.GetInterpolatedHeight(fx, fy); //height /= meshScale.z; color = new Color(height, height, height, height); heightMap.SetPixel(idx, idy, color); } } UtilPath.saveTex2File(heightMap, fileName); }
// 导出高度数据 public void exportHeightData() { string fileName = string.Format("{0}/Resources/TerrainData/{1}_{2}.bytes", Application.dataPath, mHeightMapNamePrefix, mTerrainId); int w = terrainData.heightmapWidth; int h = terrainData.heightmapHeight; Vector3 meshScale = terrainData.size; float tRes = Mathf.Pow(2, (int)saveResolution); meshScale = new Vector3(meshScale.x / (w - 1) * tRes, meshScale.y, meshScale.z / (h - 1) * tRes); Vector2 uvScale = new Vector2(1.0f / (w - 1), 1.0f / (h - 1)); float[,] tData = terrainData.GetHeights(0, 0, w, h); w = (int)((w - 1) / tRes + 1); h = (int)((h - 1) / tRes + 1); Vector3[] tVertices = new Vector3[w * h]; float height = 0; ByteBuffer buffer = new ByteBuffer(); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { height = tData[(int)(y * tRes), (int)(x * tRes)]; buffer.writeFloat(height); } } UtilPath.saveByte2File(fileName, buffer.dynBuff.buff); }
// 打包自己指定资源 public static void BuildCustomAssetBundles() { // Choose the output path according to the build target. string outputPath = ExportUtil.getStreamingDataPath(""); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } AssetBundleParam param = new AssetBundleParam(); param.m_buildList = new AssetBundleBuild[1]; param.m_buildList[0].assetBundleName = "TestExportPrefab"; param.m_buildList[0].assetBundleVariant = UtilApi.UNITY3D; param.m_buildList[0].assetNames = new string[1]; param.m_buildList[0].assetNames[0] = "Assets/TestAssets/TestPrefab.prefab"; // 这个目录一定要是 Assets 下面写,并且加上扩展名字 param.m_pathName = outputPath; param.m_assetBundleOptions = 0; param.m_targetPlatform = EditorUserBuildSettings.activeBuildTarget; ExportUtil.BuildAssetBundle(param); // 打包成 unity3d 后文件名字会变成小写,这里修改一下 UtilPath.modifyFileNameToCapital(outputPath, "TestExportPrefab"); }
public static void createPublishProductOutputPath() { // 删除输出目录 UtilPath.deleteDirectory(ExportUtil.getPkgOutPath()); // 创建输出目录 UtilPath.createDirectory(ExportUtil.getPkgOutPath()); }
protected void packOneLevelPack(PackParam param) { string resPath = ""; List <string> nameList = new List <string>(); List <string> pathList = new List <string>(); foreach (PackItem packItem in m_packList) { pathList.Clear(); pathList.Add(param.m_inPath); pathList.Add(packItem.m_path); resPath = ExportUtil.getRelDataPath(UtilPath.combine(pathList.ToArray())); nameList.Add(resPath); } StreamedSceneAssetBundleParam bundleParam = new StreamedSceneAssetBundleParam(); bundleParam.m_levels = nameList.ToArray(); pathList.Clear(); pathList.Add(param.m_outPath); pathList.Add(m_name); bundleParam.m_locationPath = ExportUtil.getStreamingDataPath(UtilPath.combine(pathList.ToArray())); ExportUtil.BuildStreamedSceneAssetBundle(bundleParam); }
public static void createPrefab(string name) { string path = "Assets/Resources/Atlas"; string prefabName = "Common"; string prefabExtName = "prefab"; string resFullPath = string.Format("{0}.{1}", Path.Combine(path, prefabName), prefabExtName); resFullPath = UtilPath.normalPath(resFullPath); Type[] comArr = new Type[1]; comArr[0] = typeof(Image); GameObject prefabRootGo = new GameObject(prefabName, comArr); Image image = prefabRootGo.GetComponent <Image>(); Sprite[] allSpritesArr = AtlasPrefabUtil.loadAllSprite(); image.sprite = allSpritesArr[0]; // 创建预制,并且添加到编辑器中,以便进行检查 PrefabUtility.CreatePrefab(resFullPath, prefabRootGo, ReplacePrefabOptions.ConnectToPrefab); //UnityEngine.Object emptyPrefab = PrefabUtility.CreateEmptyPrefab(resFullPath); //PrefabUtility.ReplacePrefab(prefabRootGo, emptyPrefab, ReplacePrefabOptions.ConnectToPrefab); //刷新编辑器 AssetDatabase.Refresh(); }
protected void packOneLevelPack() { string resPath = ""; List <string> nameList = new List <string>(); List <string> pathList = new List <string>(); List <string> filesList = UtilPath.GetAll(ExportUtil.getDataPath(m_packParam.m_inPath)); string ext = ""; string nameNoExt = ""; string tmpStr = ""; StreamedSceneAssetBundleParam bundleParam = new StreamedSceneAssetBundleParam(); foreach (string filePath in filesList) { ext = UtilPath.getFileExt(filePath); nameNoExt = UtilPath.getFileNameNoExt(filePath); if (ExportUtil.isArrContainElem(ext, m_packParam.m_extArr)) { resPath = ExportUtil.convFullPath2AssetsPath(filePath); nameList.Add(resPath); bundleParam.m_levels = nameList.ToArray(); pathList.Clear(); pathList.Add(m_packParam.m_outPath); tmpStr = string.Format("{0}{1}", nameNoExt, UtilApi.DOTUNITY3D); pathList.Add(tmpStr); bundleParam.m_locationPath = ExportUtil.getStreamingDataPath(UtilPath.combine(pathList.ToArray())); ExportUtil.BuildStreamedSceneAssetBundle(bundleParam); } } }
public void exportAlphaMap() { float[,,] splatmapData = terrainData.GetAlphamaps(0, 0, terrainData.alphamapWidth, terrainData.alphamapHeight); int alphamapWidth = terrainData.alphamapWidth; int alphamapHeight = terrainData.alphamapHeight; int alphamapLayers = terrainData.alphamapLayers; int channel = 4; int channelIdx = 0; float r = 0; float g = 0; float b = 0; float a = 0; string fileName = ""; Color color = new Color(0, 0, 0, 0); Texture2D alphaMap = new Texture2D(alphamapWidth, alphamapHeight, TextureFormat.BGRA32, true); int imageIdx = 0; while (channelIdx < alphamapLayers) { r = 0; g = 0; b = 0; a = 0; for (int idy = 0; idy < alphamapHeight; ++idy) { for (int idx = 0; idx < alphamapWidth; ++idx) { r = splatmapData[idx, alphamapHeight - 1 - idy, channelIdx]; if (channelIdx + 1 < alphamapLayers) { g = splatmapData[idx, alphamapHeight - 1 - idy, channelIdx + 1]; } if (channelIdx + 2 < alphamapLayers) { b = splatmapData[idx, alphamapHeight - 1 - idy, channelIdx + 2]; } if (channelIdx + 3 < alphamapLayers) { a = splatmapData[idx, alphamapHeight - 1 - idy, channelIdx + 3]; } color = new Color(r, g, b, a); alphaMap.SetPixel(idx, idy, color); } } fileName = string.Format("{0}/{1}_{2}.png", Application.dataPath, "AlphaMap", imageIdx); UtilPath.saveTex2File(alphaMap, fileName); imageIdx += 1; channelIdx += channel; } }
public AssetBundleNameDirData(string path, AssetBundleNameXmlPath xmlPath) { m_dirPath = path; m_xmlPath = xmlPath; m_fullDirPath = ExportUtil.getDataPath(m_dirPath); m_fullDirPath = UtilPath.normalPath(m_fullDirPath); m_filesList = new List <AssetBundleNameFileData>(); }
public void packPack() { if (!string.IsNullOrEmpty(m_destRoot)) { UtilPath.createDirectory(Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, m_destRoot)); } UtilPath.recursiveTraversalDir(m_srcFullPath, handleFile, handleDir); }
public DirData(string path, AtlasXmlPath xmlPath) { m_dirPath = path; m_xmlPath = xmlPath; m_fullDirPath = ExportUtil.getDataPath(m_dirPath); m_fullDirPath = UtilPath.normalPath(m_fullDirPath); m_filesList = new List <FileData>(); }
protected void packOneBundlePack() { string resPath = ""; List <string> assetNamesList = new List <string>(); List <Object> objList = new List <Object>(); UnityEngine.Object go; List <string> pathList = new List <string>(); List <string> filesList = UtilPath.GetAll(ExportUtil.getDataPath(m_packParam.m_inPath)); string ext = ""; string nameNoExt = ""; #if UNITY_4_6 string tmpStr = ""; #endif AssetBundleParam bundleParam = new AssetBundleParam(); foreach (string filePath in filesList) { objList.Clear(); assetNamesList.Clear(); ext = UtilPath.getFileExt(filePath); nameNoExt = UtilPath.getFileNameNoExt(filePath); if (ExportUtil.isArrContainElem(ext, m_packParam.m_extArr)) { resPath = ExportUtil.convFullPath2AssetsPath(filePath); assetNamesList.Add(resPath); go = AssetDatabase.LoadAssetAtPath(resPath, ExportUtil.convResStr2Type(ExportUtil.convExt2ResStr(ext))); if (go) { objList.Add(go); #if UNITY_5 bundleParam.m_buildList = new AssetBundleBuild[1]; bundleParam.m_buildList[0].assetBundleName = nameNoExt; bundleParam.m_buildList[0].assetBundleVariant = UtilApi.UNITY3D; bundleParam.m_buildList[0].assetNames = assetNamesList.ToArray(); pathList.Clear(); pathList.Add(m_packParam.m_outPath); bundleParam.m_pathName = ExportUtil.getStreamingDataPath(UtilPath.combine(pathList.ToArray())); #elif UNITY_4_6 || UNITY_4_5 bundleParam.m_assets = objList.ToArray(); pathList.Clear(); pathList.Add(m_packParam.m_outPath); tmpStr = string.Format("{0}{1}", nameNoExt, ExportUtil.DOTUNITY3D); pathList.Add(tmpStr); bundleParam.m_pathName = ExportUtil.getStreamingDataPath(ExportUtil.combine(pathList.ToArray())); #endif ExportUtil.BuildAssetBundle(bundleParam); } else { LoggerTool.error(string.Format("AssetDatabase.LoadAssetAtPath 不能加载资源 {0}", filePath)); } } } }
public static void restoreResources() { string restorePath = ExportUtil.getDataPath(""); string bakPath = ExportUtil.getPkgWorkPath(""); UtilPath.createDirectory(restorePath); UtilPath.recurseCopyDirectory(bakPath, restorePath); UtilPath.deleteDirectory(bakPath); }
// 导出 Splat 地形 Xml 配置文件 public void exportSplatXml() { string path = string.Format("{0}/{1}/{2}.xml", Application.dataPath, "Resources/TerrainData", mTerrainId); int idx = 0; string fileName = ""; SplatPrototype splatLayer = null; Vector2 tileSize; string resPath = ""; string xmlStr = ""; string tmp = ""; // 头信息 xmlStr += "<?xml version='1.0' encoding='utf-8' ?>\r\n"; // 开始标签 xmlStr += "<Config>\r\n"; // 输出 Splat 贴图名字 for (idx = 0; idx < terrainData.splatPrototypes.Length; ++idx) { splatLayer = terrainData.splatPrototypes[idx]; resPath = AssetDatabase.GetAssetPath(splatLayer.texture); // 保存目录 fileName = UtilPath.getFileNameNoPath(resPath); tileSize = splatLayer.tileSize; tmp = string.Format("\t<SplatMapName name=\"Materials/Textures/Terrain/{0}\" worldSize=\"{1}\" />\r\n", fileName, tileSize.x / 2); xmlStr += tmp; } // 输出 Alpha Map for (idx = 0; idx < terrainData.alphamapTextures.Length; ++idx) { tmp = string.Format("\t<AlphaMapName name=\"Materials/Textures/Terrain/{0}_{1}_{2}.png\" />\r\n", "AlphaMap", mTerrainId, idx); xmlStr += tmp; } // 输出高度数据 tmp = string.Format("\t<HeightDataName name=\"TerrainData/{0}_{1}.bytes\" />\r\n", mHeightMapNamePrefix, mTerrainId); xmlStr += tmp; // 输出地形大小信息 tmp = string.Format("\t<WorldSize Width=\"{0}\" Depth=\"{1}\" Height=\"{2}\" />\r\n", terrainData.size.x, terrainData.size.z, terrainData.size.y); xmlStr += tmp; // 输出批次大小 tmp = string.Format("\t<BatchSize Max=\"{0}\" Min=\"{1}\" />\r\n", 9, 5); xmlStr += tmp; // 输出高度图分辨率 tmp = string.Format("\t<HeightMapResolution Size=\"{0}\" />\r\n", terrainData.heightmapResolution); xmlStr += tmp; // 结束标签 xmlStr += "</Config>"; UtilPath.saveStr2File(xmlStr, path, Encoding.UTF8); }
public void createDir(string parentPath) { string path = ""; //path = ExportUtil.getDataPath(string.Format("{0}/{1}", parentPath, m_subPath)); path = ExportUtil.getDataPath(m_subPath); if (!UtilPath.existDirectory(path)) { UtilPath.recurseCreateDirectory(path); } }
// 导出 AlphaMap public void exportAlphaMap_a() { string fileName = ""; Texture2D[] alphamapTextures = terrainData.alphamapTextures; for (int idx = 0; idx < alphamapTextures.Length; ++idx) { fileName = string.Format("{0}/{1}_{2}.png", Application.dataPath, "AlphaMap", idx); UtilPath.saveTex2File(alphamapTextures[idx], fileName); } }
// 拷贝文件到 StreamingAssets 目录下 public static void CopyAssetBundlesTo(string srcPath, BuildTarget target) { string platForm = GetPlatformFolderForAssetBundles(target); UtilPath.deleteDirectory(Application.streamingAssetsPath); UtilPath.createDirectory(Application.streamingAssetsPath); // 放入平台单独的目录下 //CreateDirectory(Path.Combine(Application.streamingAssetsPath, platForm)); //copyDirectory(srcPath, Path.Combine(Application.streamingAssetsPath, platForm)); UtilPath.recurseCopyDirectory(srcPath, Application.streamingAssetsPath); }
public static void pkgResources() { ResExportSys.m_instance.m_targetPlatform = BuildTarget.StandaloneWindows; ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = ExportUtil.getStreamingDataPath(""); ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = UtilPath.normalPath(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath); UtilPath.deleteDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath); UtilPath.createDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath); ResExportSys.m_instance.parseResourceXml(); ResExportSys.m_instance.packResourceList(); }
protected void onFindFile(string path, string name) { path = UtilPath.normalPath(path); string extName = UtilPath.getFileExt(path); if (m_xmlPath.includeExtList.IndexOf(extName) != -1) // 如果在包含的扩展名列表中 { AssetBundleNameFileData file = new AssetBundleNameFileData(path, this); m_filesList.Add(file); file.buildData(); } }
public void exportMeshBone(XmlDocument xmlDocSave, XmlElement root) { XmlElement meshXml = xmlDocSave.CreateElement("Mesh"); root.AppendChild(meshXml); meshXml.SetAttribute("name", UtilPath.getFileNameNoExt(m_skelMeshParam.m_name)); foreach (SubMesh subMesh in m_subMeshList) { subMesh.exportSubMeshBone(m_skelMeshParam, xmlDocSave, meshXml); } }
protected void onFindFile(string path, string name) { path = UtilPath.normalPath(path); string extName = UtilPath.getFileExt(path); if (m_xmlPath.ignoreExtList.IndexOf(extName) == -1) // 如果没有在或略的扩展名列表中 { FileData file = new FileData(path, this); m_filesList.Add(file); file.buildData(); } }
public void exportAlphaTexture() { string path = ""; int idx = 0; while (idx < terrainData.alphamapTextures.Length) { path = string.Format("{0}/Resources/Materials/Textures/Terrain/{1}_{2}_{3}.png", Application.dataPath, mAlphaMapNamePrefix, mTerrainId, idx); UtilPath.saveTex2File(terrainData.alphamapTextures[0], path); ++idx; } }