/// <summary> /// Update 3D scene visibility and footer statistics after in-place changes to the /// tree (i.e. removal of node). /// </summary> private void FinishUpdatingTree() { CountMeshes(); UpdateSceneVisibilityFilter(); UpdateStatistics(); _scene.RequestRenderRefresh(); }
private void DeleteVertexComponent <T>(string name, Expression <Func <Mesh, T> > property) where T : new() { var expr = (MemberExpression)property.Body; var prop = (PropertyInfo)expr.Member; T oldValue = (T)prop.GetValue(_mesh, null); var mesh = _mesh; _scene.UndoStack.PushAndDo(String.Format("Mesh \"{0}\": delete {1}", _meshName, name), () => prop.SetValue(mesh, new T(), null), () => prop.SetValue(mesh, oldValue, null), () => { _scene.RequestRenderRefresh(); if (mesh == _mesh) // Only update UI if the dialog instance still displays the mesh. { UpdateVertexItems(); } }); }
/// <summary> /// Update normals and create an UndoStack entry for the operation. /// </summary> private void Commit() { StopUpdateThread(); if (Math.Abs(_lastCompletedUpdateAngle - _thresholdAngleInDegrees) > 0.001f) { UpdateNormals(_thresholdAngleInDegrees); } var meshesToProcess = _meshesToProcess.Select(_ => _).ToList(); var originalMeshes = _meshesToProcess.Select(entry => MeshUtil.ShallowCopy(entry.Mesh)).ToList(); _scene.UndoStack.PushAndDo("Compute Normals", () => { foreach (var entry in meshesToProcess) { MeshUtil.ShallowCopy(entry.Mesh, entry.PreviewMesh); } }, () => { meshesToProcess.ZipAction(originalMeshes, (entry, origMesh) => { MeshUtil.ShallowCopy(entry.Mesh, origMesh); }); }, () => { foreach (var entry in meshesToProcess) { _scene.SetOverrideMesh(entry.Mesh, null); } _scene.RequestRenderRefresh(); }); _committed = true; }