示例#1
0
 public RendererInspector(Renderer renderer)
 {
     _renderer          = renderer;
     _name              = _renderer.GetType().Name;
     _materialInspector = new MaterialInspector {
         AllowsMaterialRemoval = false
     };
     _materialInspector.SetTarget(renderer, renderer.GetType().GetField("Material"));
 }
            private void PropertyGrid_Loaded(object sender, RoutedEventArgs e)
            {
                PropertyGrid grid = sender as PropertyGrid;

                if (grid.DataContext != null && grid.DataContext.GetType() == typeof(DictionaryPropertyGridAdapter) && !isMaterialEditor)
                {
                    EditorTemplateDefinition tex = new EditorTemplateDefinition();
                    tex.EditingTemplate = FindResource("TextureEditor") as DataTemplate;
                    tex.TargetProperties.Add(new TargetPropertyType()
                    {
                        Type = typeof(Texture2D)
                    });
                    grid.EditorDefinitions.Add(tex);
                    grid.EditorDefinitions.Insert(0, tex);
                    isMaterialEditor = true;
                }
                if (Parent is MaterialInspector)
                {
                    MaterialInspector matEditor = Parent as MaterialInspector;
                    grid.IsReadOnly = matEditor.Material == Material.StandardMaterial;
                }
                grid.ExpandAllProperties();
            }
示例#3
0
            private static void OnMaterialPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
            {
                MaterialInspector materialInspector = source as MaterialInspector;

                materialInspector.MaterialUpdated();
            }