void writeTempModelsToZip(ZipArchive zip) { SceneObjectsXML sceneObjects = new SceneObjectsXML(); BBoundingBox objectAABB = new BBoundingBox(); objectAABB.empty(); string baseDir = CoreGlobals.getWorkPaths().mGameDirectory; if (mIncludeObjects) { //searalize an XML file to memorystream holding position and model names List <EditorObject> editObjs = SimGlobals.getSimMain().getEditorObjects(false, SimMain.eFilterTypes.cFilterAll, -1, false); for (int objIdx = 0; objIdx < editObjs.Count; objIdx++) { if (editObjs[objIdx] == null) { continue; } if (editObjs[objIdx].GetType() == typeof(SimObject)) { SimObject obj = editObjs[objIdx] as SimObject; if (obj.IgnoreToAO) { continue; } if (obj != null && obj.ProtoObject != null) { string grannyName = obj.ProtoObject.getGrannyFileName(); if (grannyName == "") { continue; } if (grannyName.Contains(baseDir)) { grannyName = grannyName.Remove(0, baseDir.Length); } //if this GR2 isn't already listed, then list it. if (!sceneObjects.objectGR2Names.Contains(grannyName)) { sceneObjects.objectGR2Names.Add(grannyName); } //add our instance ObjectInstanceXML inst = new ObjectInstanceXML(); inst.GR2Filename = grannyName; inst.setOrientation(obj.getMatrix()); sceneObjects.objectinstances.Add(inst); //add our transformed BB to the global BB list if (obj != null && obj.mVisual != null) { if (!obj.IgnoreToAO) { objectAABB.addPoint(obj.mAABB.max + obj.getPosition()); objectAABB.addPoint(obj.mAABB.min + obj.getPosition()); } } } } } sceneObjects.aabbmin = TextVectorHelper.ToString(objectAABB.min); sceneObjects.aabbmax = TextVectorHelper.ToString(objectAABB.max); } //write it to an XML stream AbstractFile md = zip.CreateFile("modelPositions.xml", true); Stream stream = md.OpenWrite(true); XmlSerializer s = new XmlSerializer(typeof(SceneObjectsXML), new Type[] { }); s.Serialize(stream, sceneObjects); stream.Close(); //Create a folder and copy our GR2s into it //AbstractFolder fold = zip.CreateFolder("models"); //if (mIncludeObjects) //{ // for (int modelIdx = 0; modelIdx < sceneObjects.objectGR2Names.Count; modelIdx++) // { // if (mWorkerThread.CancellationPending) // return; // try // { // if (fullGR2Names[modelIdx] == "") // continue; // DiskFile modelFile = new DiskFile(fullGR2Names[modelIdx]); // modelFile.CopyTo(fold, true); // } // catch (Exception e) // { // continue; // } // } //} }