private void OnModelLoadedCallback(ModelLoadingManager.Result result, M3D.Graphics.Ext3D.ModelRendering.Model model, PrintDetails.ObjectDetails details) { if (result == ModelLoadingManager.Result.Success) { IncFilesOptimizing(); modelLoadedQueue.Enqueue(new ModelLoadingManager.ModelLoadDetails(model, details)); } else { DecFilesLoading(); informationbox.AddMessageToQueue("Unable to load model."); } }
private void on_UpdateTimerTick(object sender, EventArgs e) { while (modelLoadedQueue.TryDequeue(out ModelLoadDetails result) && !shutdown.Value) { M3D.Graphics.Ext3D.ModelRendering.Model model = result.model; if (model != null) { printerview.AddModel(model, result.details); } DecFilesOptimizing(); DecFilesLoading(); } }
private bool ImportModel(string filename, ModelLoadingManager.OnModelLoadedDel loadedCallback, ModelLoadingManager.LoadFailedCallback onFailCallback, PrintDetails.ObjectDetails objectDetails) { IncFilesLoading(); try { long num = 0; using (var streamReader = new StreamReader(filename)) { num = streamReader.BaseStream.Length; } if (num > 10485760L) { informationbox.AddMessageToQueue("Fairly complex and may slow down this program"); } M3D.Graphics.Ext3D.ModelRendering.Model model = printerview.GetModel(filename); if (model == null) { var state = new ModelLoadingManager.AsyncModelLoadData(filename, loadedCallback, onFailCallback, objectDetails); if (settings.CurrentAppearanceSettings.ShowRemoveModelWarning && printerview.ModelLoaded && (objectDetails == null || objectDetails.printerSettingsXMLFile == null || objectDetails.printerViewXMLFile == null)) { DecFilesLoading(); messagebox.AddXMLMessageToQueue(new PopupMessageBox.MessageDataXML(new SpoolerMessage(), Resources.removeModelDialog, new PopupMessageBox.XMLButtonCallback(RemoveModelButtonCallback), state)); return(true); } if (printerview.ModelLoaded && !settings.CurrentAppearanceSettings.UseMultipleModels) { printerview.RemovePrintableModels(); } StartLoadModelThread(state); } else { modelLoadedQueue.Enqueue(new ModelLoadingManager.ModelLoadDetails(model, objectDetails)); } } catch (Exception ex) { DecFilesLoading(); ShowFileLoadingExeption(ex, filename, onFailCallback); return(false); } return(true); }
public ModelLoadDetails(M3D.Graphics.Ext3D.ModelRendering.Model model, PrintDetails.ObjectDetails details) { this.model = model; this.details = details; }