Beispiel #1
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
                });
            }
        }
Beispiel #2
0
        public void LoadGeometry(IIndexItem modelTag, string fileName)
        {
            if (!CanOpenTag(modelTag))
            {
                throw new NotSupportedException($"{modelTag.ClassName} tags are not supported.");
            }

            if (DirectContentTags.Any(t => modelTag.ClassCode.ToLower() == t))
            {
                IRenderGeometry geometry;
                if (ContentFactory.TryGetGeometryContent(modelTag, out geometry))
                {
                    LoadGeometry(geometry, fileName);
                    return;
                }
                else
                {
                    throw new ArgumentException($"Could not load geometry from tag", nameof(modelTag));
                }
            }

            TabModel.ToolTip = fileName;
            TabModel.Header  = Utils.GetFileName(fileName);

            ClearChildren();
            modelId = modelTag.Id;
            modelFactory.LoadTag(modelTag, false);

            element       = modelFactory.CreateObjectModel(modelId);
            AvailableLods = objectModel.Variants;
            modelGroup.Children.Add(element);
            SetVariant(Math.Max(0, AvailableLods.ToList().IndexOf(objectModel.DefaultVariant)));

            renderGeometry = null;
            IsExportable   = false;
        }