Example #1
0
        private void Mesh_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Parent")
            {
                //clean the root
                RootLevel.Where(x => x.Parent != null).ToList().All(x => RootLevel.Remove(x));

                // add the mesh to the root if necessary
                if (((MeshViewModel)sender).Parent == null && !RootLevel.Contains(((MeshViewModel)sender)))
                {
                    RootLevel.Add((MeshViewModel)sender);
                }
            }
        }
Example #2
0
        public void RemoveMesh(MeshViewModel mesh)
        {
            foreach (MeshViewModel vm in mesh.Children)
            {
                vm.Parent = mesh.Parent;
            }

            if (mesh.Parent == null)
            {
                RootLevel.Remove(mesh);
            }
            else
            {
                mesh.Parent.Children.Remove(mesh);
            }
        }