Skip to content

Commit e503fa3

Browse files
committed
cleaned up commented out export editor code
1 parent 972f1cf commit e503fa3

File tree

1 file changed

+0
-118
lines changed

1 file changed

+0
-118
lines changed

Editor/ZOExportOBJEditor.cs

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -59,125 +59,7 @@ public static void DoExport(bool makeSubmeshes, string directoryPath, bool zeroP
5959
}
6060
ZOExportOBJ exportOBJ = new ZOExportOBJ();
6161
exportOBJ.ExportToDirectory(gameObject, directoryPath, makeSubmeshes, zeroPosition);
62-
63-
// string meshName = gameObject.name;
64-
65-
// ZOExportOBJ.Start();
66-
67-
// StringBuilder meshString = new StringBuilder();
68-
69-
// meshString.Append("#" + meshName + ".obj"
70-
// + "\n#" + System.DateTime.Now.ToLongDateString()
71-
// + "\n#" + System.DateTime.Now.ToLongTimeString()
72-
// + "\n#-------"
73-
// + "\n\n");
74-
75-
// meshString.AppendLine($"mtllib {meshName}.mtl");
76-
77-
// Transform transform = gameObject.transform;
78-
79-
// Vector3 originalPosition = transform.position;
80-
// if (zeroPosition == true) {
81-
// transform.position = Vector3.zero;
82-
// }
83-
84-
// if (!makeSubmeshes) {
85-
// meshString.Append("g ").Append(transform.name).Append("\n");
86-
// }
87-
// meshString.Append(ProcessTransform(transform, makeSubmeshes));
88-
89-
90-
// string objFilePath = Path.Combine(directoryPath, $"{meshName}.obj");
91-
92-
// WriteToFile(meshString.ToString(), objFilePath);
93-
94-
// transform.position = originalPosition;
95-
96-
97-
// // export materials and textures
98-
// StringBuilder mtlFileString = new StringBuilder();
99-
// HashSet<string> materialNames = new HashSet<string>();
100-
// MeshFilter meshFilter = transform.GetComponent<MeshFilter>();
101-
// if (meshFilter != null) {
102-
// Material[] materials = meshFilter.GetComponent<Renderer>().sharedMaterials;
103-
// foreach (Material material in materials) {
104-
// if (materialNames.Contains(material.name) == false) {
105-
// string materialString = ZOExportOBJ.MaterialToString(material);
106-
// mtlFileString.Append(materialString);
107-
// materialNames.Add(material.name);
108-
109-
// // handle texture
110-
// if (material.HasProperty("_MainTex")) {
111-
// string assetPath = AssetDatabase.GetAssetPath(material.GetTexture("_MainTex"));
112-
// if (string.IsNullOrEmpty(assetPath) == false) {
113-
// string texName = Path.GetFileName(assetPath);
114-
// File.Copy(assetPath, Path.Combine(directoryPath, texName));
115-
// }
116-
// }
117-
// }
118-
// }
119-
// }
120-
121-
122-
// // go through the children materials
123-
// for (int i = 0; i < transform.childCount; i++) {
124-
// Transform child = transform.GetChild(i);
125-
// meshFilter = child.GetComponent<MeshFilter>();
126-
127-
// if (meshFilter != null) {
128-
// // meshString.Append(ZOObjExporterScript.MeshToString(meshFilter, transform));
129-
// Material[] materials = meshFilter.GetComponent<Renderer>().sharedMaterials;
130-
// foreach (Material material in materials) {
131-
// if (materialNames.Contains(material.name) == false) {
132-
// string materialString = ZOExportOBJ.MaterialToString(material);
133-
// mtlFileString.Append(materialString);
134-
// materialNames.Add(material.name);
135-
// // handle texture
136-
// if (material.HasProperty("_MainTex")) {
137-
// string assetPath = AssetDatabase.GetAssetPath(material.GetTexture("_MainTex"));
138-
// if (string.IsNullOrEmpty(assetPath) == false) {
139-
// string texName = Path.GetFileName(assetPath);
140-
// File.Copy(assetPath, Path.Combine(directoryPath, texName));
141-
// }
142-
// }
143-
// }
144-
// }
145-
// }
146-
// }
147-
// string mtlFilePath = Path.Combine(directoryPath, $"{meshName}.mtl");
148-
// WriteToFile(mtlFileString.ToString(), mtlFilePath);
149-
150-
// ZOExportOBJ.End();
151-
// Debug.Log("Exported Mesh: " + objFilePath);
15262
}
15363

154-
// static string ProcessTransform(Transform transform, bool makeSubmeshes) {
155-
// StringBuilder meshString = new StringBuilder();
156-
157-
// meshString.Append("#" + transform.name
158-
// + "\n#-------"
159-
// + "\n");
160-
161-
// if (makeSubmeshes) {
162-
// meshString.Append("g ").Append(transform.name).Append("\n");
163-
// }
164-
165-
// MeshFilter meshFilter = transform.GetComponent<MeshFilter>();
166-
// if (meshFilter != null) {
167-
// meshString.Append(ZOExportOBJ.MeshToString(meshFilter, transform));
168-
// }
169-
170-
// for (int i = 0; i < transform.childCount; i++) {
171-
// meshString.Append(ProcessTransform(transform.GetChild(i), makeSubmeshes));
172-
// }
173-
174-
// return meshString.ToString();
175-
// }
176-
177-
// static void WriteToFile(string s, string filename) {
178-
// using (StreamWriter sw = new StreamWriter(filename)) {
179-
// sw.Write(s);
180-
// }
181-
// }
18264
}
18365
}

0 commit comments

Comments
 (0)