/// <summary> /// Evento de clic en Reload /// </summary> void Export_ButtonClick(object sender, EventArgs e) { //saveSceneDialog var saveDialog = new SaveFileDialog(); saveDialog.DefaultExt = ".xml"; saveDialog.Filter = ".XML |*.xml"; saveDialog.AddExtension = true; saveDialog.Title = "Export Scene"; if (saveDialog.ShowDialog() == DialogResult.OK) { FileInfo fInfo = new FileInfo(saveDialog.FileName); string sceneName = fInfo.Name.Split('.')[0]; string saveDir = fInfo.DirectoryName; TgcScene exportScene = new TgcScene(sceneName, saveDir); foreach (TgcMesh m in bspMap.Meshes) { exportScene.Meshes.Add(m); } TgcSceneExporter exporter = new TgcSceneExporter(); exporter.exportSceneToXml(exportScene, saveDir); MessageBox.Show("Escena exportada a formato TGC satisfactoriamente.", "Export Scene", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Exporta todos los cuartos y paredes a un xml de TgcScene /// </summary> private void exportScene(string saveDir, string sceneName) { var scene = new TgcScene(sceneName, saveDir); foreach (var room in Rooms) { foreach (var wall in room.Walls) { scene.Meshes.AddRange(wall.ToMeshes()); } } var exporter = new TgcSceneExporter(); exporter.exportSceneToXml(scene, saveDir); MessageBox.Show(this, "Scene export OK", "Export Scene", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void export(List <TgcMesh> meshes, string name, string saveFolderPath) { TgcScene exportScene = new TgcScene(name, saveFolderPath); List <TgcMesh> parents = new List <TgcMesh>(); foreach (TgcMesh m in meshes) { if (m.ParentInstance != null && !parents.Contains(m.ParentInstance)) { parents.Add(m.ParentInstance); exportScene.Meshes.Add(m.ParentInstance); } exportScene.Meshes.Add(m); } TgcSceneExporter exporter = new TgcSceneExporter(); exporter.exportSceneToXml(exportScene, saveFolderPath); }
/// <summary> /// Exportar escena a XML /// </summary> private void exportSceneButton_Click(object sender, EventArgs e) { saveSceneDialog.Title = "Export Scene"; if (saveSceneDialog.ShowDialog() == DialogResult.OK) { FileInfo fInfo = new FileInfo(saveSceneDialog.FileName); string sceneName = fInfo.Name.Split('.')[0]; string saveDir = fInfo.DirectoryName; TgcScene exportScene = new TgcScene(sceneName, saveDir); foreach (SceneEditorMeshObject meshObject in meshObjects) { exportScene.Meshes.Add(meshObject.mesh); } TgcSceneExporter exporter = new TgcSceneExporter(); exporter.exportSceneToXml(exportScene, saveDir); MessageBox.Show(this, "Escena exportada a formato TGC satisfactoriamente.\n" + "El terreno no fue exportado", "Export Scene", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Exporta todos los cuartos y paredes a un xml de TgcScene /// </summary> private void exportScene(string saveDir, string sceneName) { TgcScene scene = new TgcScene(sceneName, saveDir); foreach (RoomsEditorRoom room in Rooms) { foreach (RoomsEditorWall wall in room.Walls) { int wallSegId = 0; foreach (TgcPlaneWall wall3d in wall.WallSegments) { scene.Meshes.Add(wall3d.toMesh(room.Name + "-" + wall.Name + "-" + wallSegId)); wallSegId++; } } } TgcSceneExporter exporter = new TgcSceneExporter(); exporter.exportSceneToXml(scene, saveDir); MessageBox.Show(this, "Scene export OK", "Export Scene", MessageBoxButtons.OK, MessageBoxIcon.Information); }