public SBMeshList() : base() { Text = "Object List"; Dock = DockStyle.Fill; ApplicationSettings.SkinControl(this); meshObjectList = new SBListView(); meshObjectList.CheckBoxes = true; meshObjectList.View = View.Details; meshObjectList.Scrollable = true; meshObjectList.HeaderStyle = ColumnHeaderStyle.None; ColumnHeader header = new ColumnHeader(); header.Text = ""; header.Name = "Meshes"; header.Width = 1000; meshObjectList.Columns.Add(header); meshObjectList.LabelEdit = true; meshObjectList.HideSelection = false; meshObjectList.AfterLabelEdit += listview_AfterLabelEdit; meshObjectList.ItemChecked += CheckChanged; meshObjectList.MouseUp += SelectedChanged; meshObjectList.Dock = DockStyle.Top; meshObjectList.Size = new System.Drawing.Size(400, 200); MeshPanel = new SBMeshPanel(); MeshPanel.Dock = DockStyle.Fill; DeleteButton = new SBButton("Delete Selected Mesh"); DeleteButton.Click += (sender, args) => { if (MessageBox.Show("Delete Selected Mesh", "This cannot be undone", MessageBoxButtons.OKCancel) == DialogResult.OK) { MeshPanel.DeleteSelectedMesh(); LoadFromScene(MeshPanel.SelectedScene); } }; DeleteButton.Dock = DockStyle.Top; HideVISButton = new SBButton("Hide VIS Objects"); HideVISButton.Dock = DockStyle.Top; HideVISButton.Click += (sender, args) => { HideVISObjects(); }; MoveUpButton = new SBButton("Move Selected Up"); MoveUpButton.Dock = DockStyle.Top; MoveUpButton.Click += (sender, args) => { if (meshObjectList.Items.Count > 0 && !meshObjectList.Items[0].Selected) { foreach (ListViewItem lvi in meshObjectList.SelectedItems) { if (lvi.Index > 0) { int index = lvi.Index - 1; meshObjectList.Items.RemoveAt(lvi.Index); meshObjectList.Items.Insert(index, lvi); } } RefreshMeshItemsFromList(); } }; MoveDownButton = new SBButton("Move Selected Down"); MoveDownButton.Dock = DockStyle.Top; MoveDownButton.Click += (sender, args) => { if (meshObjectList.Items.Count > 0 && !meshObjectList.Items[meshObjectList.Items.Count - 1].Selected) { foreach (ListViewItem lvi in meshObjectList.SelectedItems) { if (lvi.Index < meshObjectList.Items.Count) { int index = lvi.Index + 1; meshObjectList.Items.RemoveAt(lvi.Index); meshObjectList.Items.Insert(index, lvi); } } RefreshMeshItemsFromList(); } }; Controls.Add(MeshPanel); Controls.Add(MoveDownButton); Controls.Add(MoveUpButton); Controls.Add(DeleteButton); Controls.Add(new Splitter() { Dock = DockStyle.Top, Height = 10 }); Controls.Add(meshObjectList); Controls.Add(HideVISButton); }
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); } }