public void Export() { List <ExporterEntry> entries = new List <ExporterEntry>(); Transform[] transforms = Selection.GetTransforms(SelectionMode.TopLevel); if (transforms.Length == 0) { var scene = SceneManager.GetActiveScene(); List <GameObject> rootObjects = new List <GameObject>(); scene.GetRootGameObjects(rootObjects); transforms = new Transform[rootObjects.Count]; for (int i = 0; i < rootObjects.Count; i += 1) { transforms[i] = rootObjects[i].transform; } } foreach (Transform tr in transforms) { var go = tr.gameObject; if (go.GetComponent <SeinNode>() == null) { go.AddComponent <SeinNode>(); } } if (!ExporterSettings.Export.splitChunks) { List <Transform> allTrans = new List <Transform>(); foreach (var rootTrans in transforms) { allTrans.AddRange(rootTrans.GetComponentsInChildren <Transform>()); } entries.Add(new ExporterEntry { path = ExporterSettings.Export.GetExportPath(), name = ExporterSettings.Export.name, transforms = allTrans.ToArray() }); } else { foreach (Transform tr in transforms) { entries.Add(new ExporterEntry { path = ExporterSettings.Export.GetExportPath(tr.name), name = ExporterUtils.CleanPath(tr.name), transforms = tr.GetComponentsInChildren <Transform>() }); } } _export.Export(entries); }
public void Export() { List <ExporterEntry> entries = new List <ExporterEntry>(); Transform[] transforms = Selection.GetTransforms(SelectionMode.TopLevel); foreach (Transform tr in transforms) { var go = tr.gameObject; if (go.GetComponent <SeinNode>() == null) { go.AddComponent <SeinNode>(); } } if (!ExporterSettings.Export.splitChunks) { entries.Add(new ExporterEntry { path = ExporterSettings.Export.GetExportPath(), name = ExporterSettings.Export.name, transforms = Selection.GetTransforms(SelectionMode.Deep) }); } else { foreach (Transform tr in transforms) { entries.Add(new ExporterEntry { path = ExporterSettings.Export.GetExportPath(tr.name), name = ExporterSettings.Export.name, transforms = tr.GetComponentsInChildren <Transform>() }); } } _export.Export(entries); }