// Token: 0x06004323 RID: 17187 RVA: 0x00160DB0 File Offset: 0x0015F1B0 public static string MaterialToFile(Material material, string filename, string root) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("# Exported from PrimitivesPro, Unity3D asset"); stringBuilder.AppendLine("# http://u3d.as/4gQ"); stringBuilder.AppendLine("--------------------------------------------"); stringBuilder.AppendLine(); stringBuilder.AppendLine("newmtl default"); stringBuilder.AppendLine("Ka 0.6 0.6 0.6"); stringBuilder.AppendLine("Kd 0.6 0.6 0.6"); stringBuilder.AppendLine("Ks 0.9 0.9 0.9"); stringBuilder.AppendLine("d 1.0"); stringBuilder.AppendLine("Ns 0.0"); stringBuilder.AppendLine("illum 2"); if (material.name.Length > 0) { string text = ObjExporter.FindTextureFile(material.name); if (text != null) { try { File.Copy(text, root + "/" + Path.GetFileName(text), true); stringBuilder.AppendLine("map_Kd " + Path.GetFileName(text)); } catch (Exception ex) { Debug.Log("Error copy texture file! " + ex.Message); } } } return(stringBuilder.ToString()); }
// Token: 0x06004322 RID: 17186 RVA: 0x00160CD8 File Offset: 0x0015F0D8 public static void MeshToFile(MeshFilter mf, string rootPath, string filename, bool exportMaterial) { string path = rootPath + "/" + filename + ".obj"; using (StreamWriter streamWriter = new StreamWriter(path)) { streamWriter.Write(ObjExporter.MeshToString(mf)); } if (mf.GetComponent <Renderer>() && mf.GetComponent <Renderer>().sharedMaterial) { string text = rootPath + "/" + mf.GetComponent <Renderer>().sharedMaterial.name + ".mtl"; using (StreamWriter streamWriter2 = new StreamWriter(text)) { streamWriter2.Write(ObjExporter.MaterialToFile(mf.GetComponent <Renderer>().sharedMaterial, text, rootPath)); } } }