public GenericMaterialEditor() : base() { Text = "Material Editor"; Size = new Size(300, 600); menu = new SBMenuBar(); { var file = new SBToolStripMenuItem("Material"); { var delete = new SBToolStripMenuItem("Delete Selected"); delete.Click += DeleteMaterial; file.DropDownItems.Add(delete); var import = new SBToolStripMenuItem("Import Material"); import.Click += ImportMaterial; file.DropDownItems.Add(import); var export = new SBToolStripMenuItem("Export Material"); export.Click += ExportMaterial; file.DropDownItems.Add(export); } menu.Items.Add(file); } //_viewport = new GLControl(); //_viewport.Size = new Size(400, 400); //_viewport.Dock = DockStyle.Top; MinimumSize = new Size(240, 240); ApplicationSettings.SkinControl(this); //Controls.Add(_viewport); viewport = new GLViewport(); viewport.OnRenderFrame += Render; viewport.Dock = DockStyle.Top; viewport.MinimumSize = new Size(240, 240); materialList = new SBListView(); materialList.Dock = DockStyle.Top; materialList.MinimumSize = new Size(240, 180); materialList.MultiSelect = false; materialList.View = View.LargeIcon; materialList.HideSelection = false; materialList.SelectedIndexChanged += SelectedMaterialChanged; toolTips = new ToolTip(); TopMost = true; mainPanel = new Panel(); mainPanel.AutoSize = true; mainPanel.AutoScroll = true; mainPanel.Dock = DockStyle.Fill; vectorSection = new SBPopoutPanel(PopoutSide.Bottom, "Vectors", "Vectors"); vectorSection.Dock = DockStyle.Top; floatSection = new SBPopoutPanel(PopoutSide.Bottom, "Floats", "Floats"); floatSection.Dock = DockStyle.Top; boolSection = new SBPopoutPanel(PopoutSide.Bottom, "Bools", "Bools"); boolSection.Dock = DockStyle.Top; mainPanel.Controls.Add(vectorSection); mainPanel.Controls.Add(floatSection); mainPanel.Controls.Add(boolSection); typeLabel = new Label(); typeLabel.Dock = DockStyle.Top; materialLabel = new GenericBindingTextBox <string>(); materialLabel.Dock = DockStyle.Top; materialName = new GenericBindingTextBox <string>(); materialName.Dock = DockStyle.Top; Controls.Add(mainPanel); //Controls.Add(viewport); Controls.Add(materialName); Controls.Add(materialLabel); Controls.Add(materialList); Controls.Add(typeLabel); Controls.Add(menu); ResizeEnd += onResize; FormClosing += Editor_FormClosing; }
public MainForm() { InitializeComponent(); ApplicationSettings.Init(); ApplicationSettings.SkinControl(this); // Editors that are forms ApplicationSettingsEditor = new SBRenderSettingsEditor(); MaterialEditor = new GenericMaterialEditor(); projectTree = new SBProjectTree(); projectTree.Dock = DockStyle.Fill; LeftPane = new SBPopoutPanel(PopoutSide.Left, ">", "<"); LeftPane.Dock = DockStyle.Left; LeftPane.Contents.Add(projectTree); BottomPane = new SBPopoutPanel(PopoutSide.Bottom, "Open Console", "Close Console"); BottomPane.Dock = DockStyle.Bottom; BottomPane.Contents.Add(SBConsole.Console); MenuBar = new SBMenuBar(); { var ts = new SBToolStripMenuItem("File"); { var open = new SBToolStripMenuItem("Open"); { var folder = new SBToolStripMenuItem("Folder"); folder.Click += projectTree.OpenFolder; folder.ShortcutKeys = Keys.O | Keys.Control | Keys.Shift | Keys.Alt; open.DropDownItems.Add(folder); var scene = new SBToolStripMenuItem("Scene"); scene.Click += OpenFile; scene.ShortcutKeys = Keys.O | Keys.Control; open.DropDownItems.Add(scene); } ts.DropDownItems.Add(open); } { var open = new SBToolStripMenuItem("Import"); { var scene = new SBToolStripMenuItem("Model"); scene.Click += ImportToScene; open.DropDownItems.Add(scene); var animimport = new SBToolStripMenuItem("Animation Into Scene"); animimport.Click += ImportAnimationToScene; open.DropDownItems.Add(animimport); var skeletonimport = new SBToolStripMenuItem("Skeleton To Model"); skeletonimport.Click += ImportSkeletonToScene; open.DropDownItems.Add(skeletonimport); } ts.DropDownItems.Add(open); } { var open = new SBToolStripMenuItem("Export"); { var folder = new SBToolStripMenuItem("Scene to File(s)"); folder.Click += SaveScene; open.DropDownItems.Add(folder); var animexport = new SBToolStripMenuItem("Animation to File"); animexport.Click += ExportAnimationToFile; open.DropDownItems.Add(animexport); var skeletonexport = new SBToolStripMenuItem("Skeleton to File"); skeletonexport.Click += ExportSkeletonToFile; open.DropDownItems.Add(skeletonexport); } ts.DropDownItems.Add(open); } { var closeWkspc = new SBToolStripMenuItem("Clear Workspace"); closeWkspc.Click += CloseWorkspace; ts.DropDownItems.Add(closeWkspc); } MenuBar.Items.Add(ts); var view = new SBToolStripMenuItem("View"); { var rsettings = new SBToolStripMenuItem("Application Settings"); rsettings.Click += OpenRenderSettings; view.DropDownItems.Add(rsettings); var meditor = new SBToolStripMenuItem("Material Editor"); meditor.Click += OpenMaterialEditor; view.DropDownItems.Add(meditor); } MenuBar.Items.Add(view); var viewport = new SBToolStripMenuItem("Camera"); { var resetCamera = new SBToolStripMenuItem("Reset Camera Position"); resetCamera.Click += Viewport_ResetCameraPosition; viewport.DropDownItems.Add(resetCamera); var rsettings = new SBToolStripMenuItem("Render Viewport to File"); rsettings.Click += ExportRenderToFile; viewport.DropDownItems.Add(rsettings); } MenuBar.Items.Add(viewport); } MenuBar.Dock = DockStyle.Top; viewportPanel = new SBViewportPanel(); viewportPanel.Dock = DockStyle.Fill; Controls.Add(viewportPanel); Controls.Add(BottomPane); Controls.Add(LeftPane); Controls.Add(MenuBar); FormClosing += MainForm_FormClosing; InitializeImportTypes(); if (ApplicationSettings.LastOpenedPath != "") { projectTree.SetRoot(ApplicationSettings.LastOpenedPath); } OpenTKResources.Init(); }
public MainForm() { InitializeComponent(); ApplicationSettings.Init(); ApplicationSettings.SkinControl(this); // Editors that are forms ApplicationSettingsEditor = new SBRenderSettingsEditor(); MaterialEditor = new GenericMaterialEditor(); projectTree = new SBProjectTree(); projectTree.Dock = DockStyle.Fill; LeftPane = new SBPopoutPanel(PopoutSide.Left, ">", "<"); LeftPane.Dock = DockStyle.Left; LeftPane.Contents.Add(projectTree); BottomPane = new SBPopoutPanel(PopoutSide.Bottom, "Open Console", "Close Console"); BottomPane.Dock = DockStyle.Bottom; BottomPane.Contents.Add(SBConsole.Console); MenuBar = new SBMenuBar(); { var ts = new SBToolStripMenuItem("File"); { var open = new SBToolStripMenuItem("Open"); { var folder = new SBToolStripMenuItem("Folder"); folder.Click += OpenFolder; folder.ShortcutKeys = Keys.O | Keys.Control | Keys.Shift | Keys.Alt; open.DropDownItems.Add(folder); var scene = new SBToolStripMenuItem("Scene"); scene.Click += OpenFile; scene.ShortcutKeys = Keys.O | Keys.Control; open.DropDownItems.Add(scene); } ts.DropDownItems.Add(open); } { var open = new SBToolStripMenuItem("Import"); { var scene = new SBToolStripMenuItem("Model Into Scene"); scene.Click += ImportToScene; open.DropDownItems.Add(scene); var animimport = new SBToolStripMenuItem("Animation Into Scene"); animimport.Click += ImportAnimationToScene; open.DropDownItems.Add(animimport); } ts.DropDownItems.Add(open); } { var open = new SBToolStripMenuItem("Export"); { var folder = new SBToolStripMenuItem("Scene to File(s)"); folder.Click += SaveScene; open.DropDownItems.Add(folder); var animexport = new SBToolStripMenuItem("Animation to File"); animexport.Click += ExportAnimationToFile; open.DropDownItems.Add(animexport); } ts.DropDownItems.Add(open); } { var closeWkspc = new SBToolStripMenuItem("Clear Workspace"); closeWkspc.Click += CloseWorkspace; ts.DropDownItems.Add(closeWkspc); } MenuBar.Items.Add(ts); var view = new SBToolStripMenuItem("View"); { var rsettings = new SBToolStripMenuItem("Render Settings"); rsettings.Click += OpenRenderSettings; view.DropDownItems.Add(rsettings); var meditor = new SBToolStripMenuItem("Material Editor"); meditor.Click += OpenMaterialEditor; view.DropDownItems.Add(meditor); } MenuBar.Items.Add(view); var viewport = new SBToolStripMenuItem("Camera"); { var resetCamera = new SBToolStripMenuItem("Reset Camera Position"); resetCamera.Click += Viewport_ResetCameraPosition; viewport.DropDownItems.Add(resetCamera); var rsettings = new SBToolStripMenuItem("Render Viewport to File"); rsettings.Click += ExportRenderToFile; viewport.DropDownItems.Add(rsettings); } MenuBar.Items.Add(viewport); } MenuBar.Dock = DockStyle.Top; Viewport = new SBViewport(); Viewport.Dock = DockStyle.Fill; BoneTree = new SBBoneTree(); BoneTree.MaximumSize = RightBarSize; BoneTree.Dock = DockStyle.Top; MeshList = new SBMeshList(); MeshList.MaximumSize = RightBarSize; MeshList.Dock = DockStyle.Top; BoneEditor = new SBBoneEditor(); BoneEditor.Dock = DockStyle.Fill; MeshPanel = new SBMeshPanel(); MeshPanel.Dock = DockStyle.Fill; RightPane = new SBPopoutPanel(PopoutSide.Right, "<", ">"); RightPane.Dock = DockStyle.Right; animationBar = new SBAnimationBar(); animationBar.Dock = DockStyle.Bottom; animationBar.Frame.Bind(Viewport, "Frame"); animationBar.Visible = false; ResetControls(); Controls.Add(Viewport); Controls.Add(animationBar); Controls.Add(BottomPane); Controls.Add(RightPane); Controls.Add(LeftPane); Controls.Add(MenuBar); RenderTimer = new Timer(); RenderTimer.Interval = 1000 / 120; RenderTimer.Tick += new EventHandler(InvalidateRender); RenderTimer.Start(); FormClosing += MainForm_FormClosing; InitializeImportTypes(); if (ApplicationSettings.LastOpenedPath != "") { projectTree.SetRoot(ApplicationSettings.LastOpenedPath); } }