public void LoadPC(MegaCachePointCloud mod, string filename, int first, int last, int step) { if (mod.image == null) { mod.image = ScriptableObject.CreateInstance <MegaCachePCImage>(); } if (mod.image && mod.image.frames.Count > 0) { if (!EditorUtility.DisplayDialog("Add to or Replace", "Add new Frames to existing list, or Replace All", "Add", "Replace")) { mod.image.frames.Clear(); mod.image.maxpoints = 0; } } if (step < 1) { step = 1; } for (int i = first; i <= last; i += step) { float a = (float)(i + 1 - first) / (last - first); if (!EditorUtility.DisplayCancelableProgressBar("Loading Clouds", "Frame " + i, a)) { MegaCachePCFrame fr = mod.LoadFrame(filename, i); if (fr != null) { mod.image.frames.Add(fr); if (fr.points.Length > mod.image.maxpoints) { mod.image.maxpoints = fr.points.Length; } } else { EditorUtility.DisplayDialog("Can't Load File", "Could not load frame " + i + " of sequence! Import Stopped.", "OK"); break; } } else { break; } } EditorUtility.ClearProgressBar(); }
public void LoadPC(MegaCachePointCloud mod, string filename, int first, int last, int step) { if ( mod.image == null ) { mod.image = ScriptableObject.CreateInstance<MegaCachePCImage>(); } if ( mod.image && mod.image.frames.Count > 0 ) { if ( !EditorUtility.DisplayDialog("Add to or Replace", "Add new Frames to existing list, or Replace All", "Add", "Replace") ) { mod.image.frames.Clear(); mod.image.maxpoints = 0; } } if ( step < 1 ) step = 1; for ( int i = first; i <= last; i += step ) { float a = (float)(i + 1 - first) / (last - first); if ( !EditorUtility.DisplayCancelableProgressBar("Loading Clouds", "Frame " + i, a) ) { MegaCachePCFrame fr = mod.LoadFrame(filename, i); if ( fr != null ) { mod.image.frames.Add(fr); if ( fr.points.Length > mod.image.maxpoints ) { mod.image.maxpoints = fr.points.Length; } } else { EditorUtility.DisplayDialog("Can't Load File", "Could not load frame " + i + " of sequence! Import Stopped.", "OK"); break; } } else break; } EditorUtility.ClearProgressBar(); }