diff --git a/PCK-Studio/Forms/Editor/ModelEditor.Designer.cs b/PCK-Studio/Forms/Editor/ModelEditor.Designer.cs index 055afc8a..1f4b62a3 100644 --- a/PCK-Studio/Forms/Editor/ModelEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/ModelEditor.Designer.cs @@ -38,12 +38,12 @@ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.importToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showModelBoundsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.modelViewport = new PckStudio.Rendering.ModelRenderer(); this.namedTexturesTreeView = new System.Windows.Forms.TreeView(); this.textureImageList = new System.Windows.Forms.ImageList(this.components); - this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.showModelBoundsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.modelContextMenu.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); @@ -63,7 +63,7 @@ this.modelTreeView.Name = "modelTreeView"; this.modelTreeView.PathSeparator = "."; this.tableLayoutPanel1.SetRowSpan(this.modelTreeView, 2); - this.modelTreeView.Size = new System.Drawing.Size(239, 440); + this.modelTreeView.Size = new System.Drawing.Size(287, 440); this.modelTreeView.TabIndex = 0; this.modelTreeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.modelTreeView_BeforeSelect); // @@ -96,6 +96,7 @@ this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22); this.removeToolStripMenuItem.Text = "Remove"; this.removeToolStripMenuItem.Visible = false; + this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); // // menuStrip1 // @@ -106,7 +107,7 @@ this.viewToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(20, 60); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(635, 24); + this.menuStrip1.Size = new System.Drawing.Size(660, 24); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; // @@ -135,61 +136,6 @@ this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.modelTreeView, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.modelViewport, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.namedTexturesTreeView, 1, 1); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(20, 84); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(635, 446); - this.tableLayoutPanel1.TabIndex = 2; - // - // modelViewport - // - this.modelViewport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.modelViewport.Dock = System.Windows.Forms.DockStyle.Fill; - this.modelViewport.Location = new System.Drawing.Point(248, 3); - this.modelViewport.MouseSensetivity = 0.01F; - this.modelViewport.Name = "modelViewport"; - this.modelViewport.RefreshRate = 120; - this.modelViewport.Size = new System.Drawing.Size(384, 261); - this.modelViewport.TabIndex = 1; - this.modelViewport.VSync = true; - // - // namedTexturesTreeView - // - this.namedTexturesTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.namedTexturesTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.namedTexturesTreeView.Dock = System.Windows.Forms.DockStyle.Fill; - this.namedTexturesTreeView.ForeColor = System.Drawing.SystemColors.Window; - this.namedTexturesTreeView.FullRowSelect = true; - this.namedTexturesTreeView.HideSelection = false; - this.namedTexturesTreeView.ImageIndex = 0; - this.namedTexturesTreeView.ImageList = this.textureImageList; - this.namedTexturesTreeView.Location = new System.Drawing.Point(248, 270); - this.namedTexturesTreeView.Name = "namedTexturesTreeView"; - this.namedTexturesTreeView.SelectedImageIndex = 0; - this.namedTexturesTreeView.ShowLines = false; - this.namedTexturesTreeView.ShowPlusMinus = false; - this.namedTexturesTreeView.ShowRootLines = false; - this.namedTexturesTreeView.Size = new System.Drawing.Size(384, 173); - this.namedTexturesTreeView.TabIndex = 2; - this.namedTexturesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.namedTexturesTreeView_AfterSelect); - // - // textureImageList - // - this.textureImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; - this.textureImageList.ImageSize = new System.Drawing.Size(36, 36); - this.textureImageList.TransparentColor = System.Drawing.Color.Transparent; - // // viewToolStripMenuItem // this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -207,20 +153,76 @@ this.showModelBoundsToolStripMenuItem.Text = "Show Model Bounds"; this.showModelBoundsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.showModelBoundsToolStripMenuItem_CheckedChanged); // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.modelViewport, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.namedTexturesTreeView, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.modelTreeView, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(20, 84); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(660, 446); + this.tableLayoutPanel1.TabIndex = 2; + // + // modelViewport + // + this.modelViewport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + this.modelViewport.Dock = System.Windows.Forms.DockStyle.Fill; + this.modelViewport.Location = new System.Drawing.Point(296, 3); + this.modelViewport.MouseSensetivity = 0.01F; + this.modelViewport.Name = "modelViewport"; + this.modelViewport.RefreshRate = 120; + this.modelViewport.RenderModelBounds = false; + this.modelViewport.Size = new System.Drawing.Size(361, 261); + this.modelViewport.TabIndex = 1; + this.modelViewport.VSync = true; + // + // namedTexturesTreeView + // + this.namedTexturesTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); + this.namedTexturesTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.namedTexturesTreeView.Dock = System.Windows.Forms.DockStyle.Fill; + this.namedTexturesTreeView.ForeColor = System.Drawing.SystemColors.Window; + this.namedTexturesTreeView.FullRowSelect = true; + this.namedTexturesTreeView.HideSelection = false; + this.namedTexturesTreeView.ImageIndex = 0; + this.namedTexturesTreeView.ImageList = this.textureImageList; + this.namedTexturesTreeView.Location = new System.Drawing.Point(296, 270); + this.namedTexturesTreeView.Name = "namedTexturesTreeView"; + this.namedTexturesTreeView.SelectedImageIndex = 0; + this.namedTexturesTreeView.ShowLines = false; + this.namedTexturesTreeView.ShowPlusMinus = false; + this.namedTexturesTreeView.ShowRootLines = false; + this.namedTexturesTreeView.Size = new System.Drawing.Size(361, 173); + this.namedTexturesTreeView.TabIndex = 2; + this.namedTexturesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.namedTexturesTreeView_AfterSelect); + // + // textureImageList + // + this.textureImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; + this.textureImageList.ImageSize = new System.Drawing.Size(36, 36); + this.textureImageList.TransparentColor = System.Drawing.Color.Transparent; + // // ModelEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(675, 550); + this.ClientSize = new System.Drawing.Size(700, 550); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(550, 450); + this.MinimumSize = new System.Drawing.Size(700, 550); this.Name = "ModelEditor"; this.Style = MetroFramework.MetroColorStyle.Silver; - this.Text = "ModelEditor"; + this.Text = "Model Editor"; this.Theme = MetroFramework.MetroThemeStyle.Dark; this.modelContextMenu.ResumeLayout(false); this.menuStrip1.ResumeLayout(false); diff --git a/PCK-Studio/Forms/Editor/ModelEditor.cs b/PCK-Studio/Forms/Editor/ModelEditor.cs index 856fc92e..0beae32b 100644 --- a/PCK-Studio/Forms/Editor/ModelEditor.cs +++ b/PCK-Studio/Forms/Editor/ModelEditor.cs @@ -224,8 +224,9 @@ namespace PckStudio.Forms.Editor private void modelTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e) { exportToolStripMenuItem.Visible = e.Node is ModelNode; + removeToolStripMenuItem.Visible = e.Node is ModelNode; editToolStripMenuItem.Visible = e.Node is ModelBoxNode; - removeToolStripMenuItem.Visible = e.Node is ModelPartNode || e.Node is ModelBoxNode; + //removeToolStripMenuItem.Visible = e.Node is ModelPartNode || e.Node is ModelBoxNode; if (e.Node is ModelNode modelNode && modelNode.Model.Name != modelViewport.CurrentModelName) { NamedTexture[] textures = GetModelTextures(modelNode.Model.Name).ToArray(); @@ -322,5 +323,13 @@ namespace PckStudio.Forms.Editor { modelViewport.RenderModelBounds = showModelBoundsToolStripMenuItem.Checked; } + + private void removeToolStripMenuItem_Click(object sender, EventArgs e) + { + if (modelTreeView?.SelectedNode is ModelNode modelNode && _models.Remove(modelNode.Model)) + { + modelNode.Remove(); + } + } } }