public void ExportSelection(string name, ExternalProceduralObjectsManager manager) { if (selection_objects == null) { return; } if (selection_objects.Count <= 1) { return; } string path = ProceduralObjectsMod.ExternalsConfigPath + name.ToFileName() + ".pobj"; if (File.Exists(path)) { return; } TextWriter tw = new StreamWriter(path); tw.WriteLine("externaltype = selection"); tw.WriteLine("name = " + name); foreach (KeyValuePair <CacheProceduralObject, Vector3> kvp in selection_objects) { tw.WriteLine("OBJECT"); tw.WriteLine("{"); tw.WriteLine("baseInfoType = " + kvp.Key.baseInfoType); tw.WriteLine("basePrefabName = " + kvp.Key.basePrefabName); tw.WriteLine("relativePosition = " + kvp.Value.ToString()); tw.WriteLine("isPloppableAsphalt = " + kvp.Key.isPloppableAsphalt.ToString()); // tw.WriteLine("scale = " + pobj.scale.ToString()); tw.WriteLine("customTexture = " + ((kvp.Key.customTexture == null) ? "null" : kvp.Key.customTexture.name)); tw.WriteLine("renderDistance = " + kvp.Key.renderDistance.ToString()); tw.WriteLine("rotation = " + kvp.Key.m_rotation.ToString()); if (kvp.Key.textParam != null) { if (kvp.Key.textParam.Count() > 0) { foreach (TextField field in kvp.Key.textParam.m_textFields) { tw.WriteLine(TextField.SaveString(field)); } } } tw.WriteLine("VERTICES " + kvp.Key.allVertices.Count()); for (int i = 0; i < kvp.Key.allVertices.Count(); i++) { tw.WriteLine("vertex " + i.ToString() + " = " + kvp.Key.allVertices[i].ToString()); } tw.WriteLine("}"); } tw.Close(); }
public void ExportSelection(string name, ExternalProceduralObjectsManager manager, bool staticImport) { if (selection_objects == null) { return; } if (selection_objects.Count <= 1) { return; } string path = ProceduralObjectsMod.ExternalsConfigPath + name.ToFileName() + ".pobj"; if (File.Exists(path)) { return; } TextWriter tw = new StreamWriter(path); tw.WriteLine("externaltype = " + (staticImport ? "static" : "selection")); tw.WriteLine("name = " + name); foreach (KeyValuePair <CacheProceduralObject, Vector3> kvp in selection_objects) { tw.WriteLine("OBJECT"); tw.WriteLine("{"); tw.WriteLine("baseInfoType = " + kvp.Key.baseInfoType); tw.WriteLine("basePrefabName = " + kvp.Key.basePrefabName); if (staticImport) { tw.WriteLine("absPosition = " + kvp.Key._staticPos.ToStringUnrounded()); } else { tw.WriteLine("relativePosition = " + kvp.Value.ToStringUnrounded()); } tw.WriteLine("isPloppableAsphalt = " + kvp.Key.isPloppableAsphalt.ToString()); // tw.WriteLine("scale = " + pobj.scale.ToString()); tw.WriteLine("parenting = " + kvp.Key.temp_id + ";" + kvp.Key.parent); tw.WriteLine("customTexture = " + ((kvp.Key.customTexture == null) ? "null" : kvp.Key.customTexture.name)); tw.WriteLine("renderDistance = " + kvp.Key.renderDistance.ToString()); tw.WriteLine("renderDistLocked = " + kvp.Key.renderDistLocked.ToString()); tw.WriteLine("rotation = " + kvp.Key.m_rotation.ToStringUnrounded()); tw.WriteLine("disableRecalculation = " + kvp.Key.disableRecalculation.ToString()); if (kvp.Key.tilingFactor != 8) { tw.WriteLine("tilingFactor = " + kvp.Key.tilingFactor.ToString()); } tw.WriteLine("color = " + ((SerializableColor)kvp.Key.m_color).ToString()); tw.WriteLine("flipFaces = " + kvp.Key.flipFaces.ToString()); tw.WriteLine("disableCastShadows = " + kvp.Key.disableCastShadows.ToString()); tw.WriteLine("normalsRecalc = " + kvp.Key.normalsRecalculation.ToString()); tw.WriteLine("visibility = " + kvp.Key.visibility.ToString()); if (kvp.Key.textParam != null) { if (kvp.Key.textParam.Count() > 0) { foreach (TextField field in kvp.Key.textParam.m_textFields) { tw.WriteLine(TextField.SaveString(field)); } } } if (kvp.Key.modules != null) { if (kvp.Key.modules.Count > 0) { ModuleManager.WriteModules(tw, kvp.Key.modules, false); } } if (kvp.Key.meshStatus == 1) { tw.WriteLine("ORIGINALMODEL"); } else { tw.WriteLine("VERTICES " + kvp.Key.allVertices.Count()); for (int i = 0; i < kvp.Key.allVertices.Count(); i++) { tw.WriteLine("vertex " + i.ToString() + " = " + kvp.Key.allVertices[i].ToStringUnrounded()); } } tw.WriteLine("}"); } tw.Close(); ProceduralUtils.ExportRequiredAssetsHTML(ProceduralObjectsMod.ExternalsConfigPath + name.ToFileName() + " - required assets.html", selection_objects.Keys.ToList()); }