/// <summary> /// clean a node of isolated vertices and map id errors /// </summary> /// <param name="nodeView"></param> public static void CleanMesh(NodeView nodeView) { if (!nodeView.IsValidWorkingNode) { return; } NodeAnalyzer.RemoveIsoVerts(nodeView); NodeAnalyzer.FixMaterialIDs(nodeView); nodeView.ResetMiscErrors(); }
/// <summary> /// start the mesh inspection /// </summary> /// <returns></returns> public async Task InspectMesh() { // select the current node inside the datagrid MainWindow.Instance.SetRowSelection(this); this.InspectionRunning = true; this.Reset(); string strErrorString = string.Empty; bool bFaulted = false; try { this.ConvertToMesh(); await NodeAnalyzer.Analyze(this); } catch (Exception e) { bFaulted = true; strErrorString = string.Format("Current Node caused an excpetion and will be skipped. \n {0}", e.InnerException.Message); } if (bFaulted) { await MainWindow.Instance.ShowMessageAsync("ERROR", strErrorString); } // update the ui with the new possible changes await NodeView.ms_dispatcher.BeginInvoke(new Action(() => { if (this.ContainsErrors) { this.OnPropertyChanged(() => this.DegTriCount); this.OnPropertyChanged(() => this.BadSMGTriCount); this.OnPropertyChanged(() => this.DegUVTriCount); } }), DispatcherPriority.Loaded); this.InspectionProgress = 100; this.InspectionRunning = false; }
/// <summary> /// analyze a nodeview if it contains errors /// </summary> /// <param name="nodeView"></param> /// <returns></returns> internal static async Task Analyze(NodeView nodeView) { if (!nodeView.IsValidWorkingNode) { return; } sNodeData nodeData = new sNodeData(); await Task.Run(() => nodeData.SetData(nodeView)); if (!nodeData.IsValid) { return; } await Task.WhenAll ( NodeAnalyzer.CheckMisc(nodeData), NodeAnalyzer.CheckDegTris(nodeData), NodeAnalyzer.CheckBadSMGTris(nodeData), NodeAnalyzer.CheckDegUVTris(nodeData) ); }
private static async Task CheckMisc(sNodeData nodeData) { await Task.WhenAll(NodeAnalyzer.CheckIsoUVVerts(nodeData), NodeAnalyzer.CheckMatIds(nodeData)); }