Пример #1
0
        public override bool EditComponent(ITypeDescriptorContext context, object component, IServiceProvider provider, IWin32Window owner)
        {
            if (editorDialog == null)
            {
                editorDialog = new GlslScriptEditorDialog();
                editorDialog.InitialDirectory = Environment.CurrentDirectory;
                foreach (var example in GetShaderExamples())
                {
                    editorDialog.ScriptExamples.Add(example);
                }

                editorDialog.FormClosed += (sender, e) => editorDialog = null;
                editorDialog.Load       += (sender, e) =>
                {
                    if (editorDialog.Owner != null)
                    {
                        editorDialog.Icon     = editorDialog.Owner.Icon;
                        editorDialog.ShowIcon = true;
                    }
                };

                editorDialog.Show(owner);
            }
            else
            {
                if (editorDialog.WindowState == FormWindowState.Minimized)
                {
                    editorDialog.WindowState = FormWindowState.Normal;
                }
                editorDialog.Activate();
            }
            return(false);
        }
 public ShaderConfigurationEditorDialog()
 {
     InitializeComponent();
     glslEditor              = new GlslScriptEditorDialog();
     glslEditor.FormClosing += glslEditor_FormClosing;
     shaderButton.Tag        = shaderCollectionEditor;
     meshButton.Tag          = meshCollectionEditor;
     textureButton.Tag       = textureCollectionEditor;
     shaderCollectionEditor.CollectionItemType  = typeof(ShaderConfiguration);
     shaderCollectionEditor.NewItemTypes        = new[] { typeof(MaterialConfiguration), typeof(ViewportEffectConfiguration), typeof(ComputeProgramConfiguration) };
     meshCollectionEditor.CollectionItemType    = typeof(MeshConfiguration);
     meshCollectionEditor.NewItemTypes          = new[] { typeof(MeshConfiguration), typeof(TexturedQuad), typeof(TexturedModel) };
     textureCollectionEditor.CollectionItemType = typeof(TextureConfiguration);
     textureCollectionEditor.NewItemTypes       = new[] { typeof(Texture2D), typeof(Cubemap), typeof(ImageTexture), typeof(ImageCubemap) };
 }