public MaterialEditorView() { InitializeComponent(); viewModel = new MaterialEditorViewModel(this); // Setup for the combo boxes. ShaderSource = new ObservableCollection <KeyValuePair <MtrlShader, string> >(); ShaderSource.Add(new KeyValuePair <MtrlShader, string>(MtrlShader.Standard, "Standard")); ShaderSource.Add(new KeyValuePair <MtrlShader, string>(MtrlShader.Glass, "Glass")); ShaderSource.Add(new KeyValuePair <MtrlShader, string>(MtrlShader.Skin, "Skin")); ShaderSource.Add(new KeyValuePair <MtrlShader, string>(MtrlShader.Hair, "Hair")); ShaderSource.Add(new KeyValuePair <MtrlShader, string>(MtrlShader.Iris, "Iris")); ShaderSource.Add(new KeyValuePair <MtrlShader, string>(MtrlShader.Furniture, "Furniture")); ShaderSource.Add(new KeyValuePair <MtrlShader, string>(MtrlShader.DyeableFurniture, "Dyeable Furniture")); ShaderComboBox.ItemsSource = ShaderSource; ShaderComboBox.DisplayMemberPath = "Value"; ShaderComboBox.SelectedValuePath = "Key"; PresetSource = new ObservableCollection <KeyValuePair <MtrlShaderPreset, string> >(); PresetSource.Add(new KeyValuePair <MtrlShaderPreset, string>(MtrlShaderPreset.Default, "Default")); PresetComboBox.ItemsSource = PresetSource; PresetComboBox.DisplayMemberPath = "Value"; PresetComboBox.SelectedValuePath = "Key"; PasteMaterialButton.IsEnabled = _copiedMaterial != null; Dictionary <bool, string> TransparencySource = new Dictionary <bool, string>(); TransparencySource.Add(true, "Enabled"); TransparencySource.Add(false, "Disabled"); TransparencyComboBox.ItemsSource = TransparencySource; TransparencyComboBox.DisplayMemberPath = "Value"; TransparencyComboBox.SelectedValuePath = "Key"; Dictionary <bool, string> BackfacesSource = new Dictionary <bool, string>(); BackfacesSource.Add(true, "Show Backfaces"); BackfacesSource.Add(false, "Hide Backfaces"); BackfacesComboBox.ItemsSource = BackfacesSource; BackfacesComboBox.DisplayMemberPath = "Value"; BackfacesComboBox.SelectedValuePath = "Key"; Dictionary <bool, string> ColorsetSource = new Dictionary <bool, string>(); ColorsetSource.Add(true, "Enabled"); ColorsetSource.Add(false, "Disabled"); ColorsetComboBox.ItemsSource = ColorsetSource; ColorsetComboBox.DisplayMemberPath = "Value"; ColorsetComboBox.SelectedValuePath = "Key"; ColorsetComboBox.IsEnabled = false; DisableButton.IsEnabled = false; DisableButton.Visibility = Visibility.Hidden; SaveButton.Click += SaveButton_Click; }
public void UpdateItems() { Items = null; var doc = Editor.Current.Shell.ActiveDocument; IEnumerable <Type> types; if ((_materialEditor = doc as MaterialEditorViewModel) != null) { types = new Type[0]; _mode = Mode.Expressions; DisplayName = "Material Expressions"; } else if ((_scriptEditor = doc as CodeEditorViewModel) != null) { // TODO: code snippets. types = new Type[0]; _mode = Mode.Snippets; DisplayName = "Code Snippets"; } else if ((_viewportEditor = doc as ViewportViewModel) != null) { types = Inst.TypeDictionary.Values.Where(t => !t.IsAbstract && t.IsPublic && t.GetCustomAttribute <UncreatableAttribute>() == null && !typeof(Service).IsAssignableFrom(t.Type)).Select(t => t.Type); _mode = Mode.Objects; DisplayName = "Advanced Objects"; } else { types = new Type[0]; } var entries = types.Select(t => new ObjectEntry(t)); var items = CollectionViewSource.GetDefaultView(entries); items.Filter = FilterFunc; items.SortDescriptions.Add(new SortDescription(nameof(ObjectEntry.Name), ListSortDirection.Ascending)); Items = items; }
public void SetUp() { materialEditor = new MockMaterialEditorViewModel(); mockService = new MockService("Test", "Test"); viewModel = new MaterialEditorViewModel(mockService); }
public void SetUp() { mockService = new MockService("TestUser", "MaterialTests"); materialEditor = new MaterialEditorViewModel(mockService); }