Пример #1
0
        void Display(NodeVm rootNodeVm)
        {
            var tvis = rootNodeVm.ToTreeViewItem();

            TreeViewItems.Clear();
            TreeViewItems.Add(tvis);
        }
Пример #2
0
        internal void RefreshValues()
        {
            if (!DispatcherHelper.UIDispatcher.CheckAccess())
            {
                DispatcherHelper.RunAsync(RefreshValues);
                return;
            }
            if (!ViewModelLocator.GameLoader.ValidGame)
            {
                TreeViewItems.Clear();
                return;
            }

            var path = ViewModelLocator.GameLoader.GamePath;
            var di   = new DirectoryInfo(path);

            foreach (var d in di.GetDirectories().OrderBy(x => x.Name))
            {
                if (!object.Equals((d.Attributes & FileAttributes.System), FileAttributes.System) &&
                    !object.Equals((d.Attributes & FileAttributes.Hidden), FileAttributes.Hidden))
                {
                    TreeViewItems.Add(new AssetTreeViewItemViewModel(d));
                }
            }

            foreach (var f in di.GetFiles().OrderBy(x => x.Name))
            {
                TreeViewItems.Add(new AssetTreeViewItemViewModel(f));
            }
        }
Пример #3
0
 public void Dispose()
 {
     TreeViewItems.Clear();
     ClearChildren();
     modelGroup.Dispose();
     renderer.Dispose();
     modelFactory.Dispose();
     GC.Collect();
 }
Пример #4
0
        /// <summary>
        /// Closes the module.
        /// </summary>
        /// <remarks>Documented by Dev08, 2009-07-15</remarks>
        private void CloseModule()
        {
            SettingsManagerLogic.CloseLearningModule();

            TreeViewItems.Clear();
            treeViewLearningModule.ItemsSource = null;
            ExtensionList.Clear();
            EnableControls(false);
        }
Пример #5
0
        private void SetLod(int index)
        {
            TreeViewItems.Clear();
            ClearChildren();

            element = modelFactory.CreateRenderModel(modelId, index);
            modelGroup.Children.Add(element);

            AddRenderModelNodes(renderModel.Regions, r => r.Permutations);
            AddRenderModelNodes(renderModel.InstanceGroups, g => g.Instances);
        }
Пример #6
0
        public void RefreshTree()
        {
            log.Info("Refreshing the database tree.");
            var databasePaths = TreeViewItems.Select(x => x.DatabasePath).ToList();

            TreeViewItems.Clear();

            var schemaMapper = new SchemaToViewModelMapper();

            foreach (var path in databasePaths)
            {
                TreeViewItems.Add(schemaMapper.MapSchemaToViewModel(path));
            }
        }
Пример #7
0
 protected void OnIsExpandedChanged(bool oldValue)
 {
     if (IsExpanded)
     {
         try
         {
             TreeViewItems.Clear();
             DirectoryInfo.EnumerateDirectories().ToList().ForEach(f => TreeViewItems.Add(Create(f)));
         }
         catch (UnauthorizedAccessException)
         {
             //无权限
         }
     }
 }
Пример #8
0
        private void SetVariant(int index)
        {
            TreeViewItems.Clear();

            var variantName = AvailableLods.Skip(index).FirstOrDefault();

            objectModel.SetVariant(variantName);

            foreach (var child in objectModel.Children.OfType <IMeshNode>())
            {
                TreeViewItems.Add(new TreeItemModel {
                    Header = child.Name, IsChecked = true, Tag = child
                });
            }
        }
Пример #9
0
 public void Dispose()
 {
     TreeViewItems.Clear();
     renderer.Dispose();
     GC.Collect();
 }
Пример #10
0
        private void SetLod(int index)
        {
            model = geometry.ReadGeometry(index);
            var meshes = GetMeshes(model).ToList();

            TreeViewItems.Clear();
            modelGroup.Children.Clear();
            foreach (var region in model.Regions)
            {
                var regNode = new TreeItemModel {
                    Header = region.Name, IsChecked = true
                };

                foreach (var perm in region.Permutations)
                {
                    var mesh = meshes.ElementAtOrDefault(perm.MeshIndex);
                    if (mesh == null || perm.MeshCount <= 0)
                    {
                        continue;
                    }

                    var permNode = new TreeItemModel {
                        Header = perm.Name, IsChecked = true
                    };
                    regNode.Items.Add(permNode);

                    var tGroup = new Transform3DGroup();

                    if (perm.TransformScale != 1)
                    {
                        var tform = new ScaleTransform3D(perm.TransformScale, perm.TransformScale, perm.TransformScale);

                        tform.Freeze();
                        tGroup.Children.Add(tform);
                    }

                    if (!perm.Transform.IsIdentity)
                    {
                        var tform = new MatrixTransform3D(new Matrix3D
                        {
                            M11 = perm.Transform.M11,
                            M12 = perm.Transform.M12,
                            M13 = perm.Transform.M13,

                            M21 = perm.Transform.M21,
                            M22 = perm.Transform.M22,
                            M23 = perm.Transform.M23,

                            M31 = perm.Transform.M31,
                            M32 = perm.Transform.M32,
                            M33 = perm.Transform.M33,

                            OffsetX = perm.Transform.M41,
                            OffsetY = perm.Transform.M42,
                            OffsetZ = perm.Transform.M43
                        });

                        tform.Freeze();
                        tGroup.Children.Add(tform);
                    }

                    Model3DGroup permGroup;
                    if (tGroup.Children.Count == 0 && perm.MeshCount == 1)
                    {
                        permGroup = meshes[perm.MeshIndex];
                    }
                    else
                    {
                        permGroup = new Model3DGroup();
                        for (int i = 0; i < perm.MeshCount; i++)
                        {
                            if (tGroup.Children.Count > 0)
                            {
                                (permGroup.Transform = tGroup).Freeze();

                                permGroup.Children.Add(meshes[perm.MeshIndex + i]);
                                permGroup.Freeze();
                            }
                            else
                            {
                                permGroup.Children.Add(meshes[perm.MeshIndex + i]);
                            }
                        }
                    }

                    permNode.Tag = new MeshTag(permGroup, perm);
                    modelGroup.Children.Add(permGroup);
                }

                if (regNode.HasItems)
                {
                    TreeViewItems.Add(regNode);
                }
            }

            renderer.ScaleToContent(new[] { modelGroup });
        }