void LoadSVG(float scale) { MegaShape ms = (MegaShape)target; string filename = EditorUtility.OpenFilePanel("SVG File", lastpath, "svg"); if ( filename == null || filename.Length < 1 ) return; lastpath = filename; bool opt = true; if ( ms.splines != null && ms.splines.Count > 0 ) opt = EditorUtility.DisplayDialog("Spline Import Option", "Splines already present, do you want to 'Add' or 'Replace' splines with this file?", "Add", "Replace"); int startspline = 0; if ( opt ) startspline = ms.splines.Count; StreamReader streamReader = new StreamReader(filename); string text = streamReader.ReadToEnd(); streamReader.Close(); MegaShapeSVG svg = new MegaShapeSVG(); svg.importData(text, ms, scale, opt, startspline); //.splines[0]); ms.imported = true; }
void Export(MegaShape shape) { string filename = EditorUtility.SaveFilePanel("Export Shape to SVG", "", shape.name, ".svg"); if ( filename.Length > 0 ) { string data = MegaShapeSVG.Export(shape, (int)xaxis, (int)yaxis, strokewidth, strokecol); System.IO.File.WriteAllText(filename, data); } }
void LoadSVG(float scale) { MegaShape ms = (MegaShape)target; string filename = EditorUtility.OpenFilePanel("SVG File", lastpath, "svg"); if ( filename == null || filename.Length < 1 ) return; lastpath = filename; bool opt = true; if ( ms.splines != null && ms.splines.Count > 0 ) opt = EditorUtility.DisplayDialog("Spline Import Option", "Splines already present, do you want to 'Add' or 'Replace' splines with this file?", "Add", "Replace"); int startspline = 0; if ( opt ) startspline = ms.splines.Count; StreamReader streamReader = new StreamReader(filename); string text = streamReader.ReadToEnd(); streamReader.Close(); MegaShapeSVG svg = new MegaShapeSVG(); svg.importData(text, ms, scale, opt, startspline); //.splines[0]); ms.imported = true; }