void LoadShape(float scale) { MegaShape ms = (MegaShape)target; string filename = EditorUtility.OpenFilePanel("Shape File", lastpath, "spl"); if ( filename == null || filename.Length < 1 ) return; lastpath = filename; // Clear what we have 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; else ms.splines.Clear(); ParseFile(filename, ShapeCallback); ms.Scale(scale, startspline); ms.MaxTime = 0.0f; for ( int s = 0; s < ms.splines.Count; s++ ) { if ( ms.splines[s].animations != null ) { for ( int a = 0; a < ms.splines[s].animations.Count; a++ ) { MegaControl con = ms.splines[s].animations[a].con; if ( con != null ) { float t = con.Times[con.Times.Length - 1]; if ( t > ms.MaxTime ) ms.MaxTime = t; } } } } ms.imported = true; }
void LoadShape(float scale) { MegaShape ms = (MegaShape)target; //Modifiers mod = mr.GetComponent<Modifiers>(); // Do this at start and store string filename = EditorUtility.OpenFilePanel("Shape File", lastpath, "spl"); if (filename == null || filename.Length < 1) { return; } lastpath = filename; // Clear what we have ms.splines.Clear(); ParseFile(filename, ShapeCallback); ms.Scale(scale); ms.MaxTime = 0.0f; for (int s = 0; s < ms.splines.Count; s++) { if (ms.splines[s].animations != null) { for (int a = 0; a < ms.splines[s].animations.Count; a++) { MegaControl con = ms.splines[s].animations[a].con; if (con != null) { float t = con.Times[con.Times.Length - 1]; if (t > ms.MaxTime) { ms.MaxTime = t; } } } } } }