Fixed issue on light editor form when clicking on delete light, treenode becomes empty

This commit is contained in:
Rytrak 2022-05-24 01:37:16 +02:00
parent facd1a06be
commit 7503df47e5
3 changed files with 46 additions and 1 deletions

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ModelLightForm));
this.MainSplitContainer = new System.Windows.Forms.SplitContainer();
this.DuplicateLightButton = new System.Windows.Forms.Button();
@ -120,6 +121,9 @@
this.MoveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RotateMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ScaleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.LightMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.newLightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteLightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.MainSplitContainer)).BeginInit();
this.MainSplitContainer.Panel1.SuspendLayout();
this.MainSplitContainer.Panel2.SuspendLayout();
@ -140,6 +144,7 @@
((System.ComponentModel.ISupportInitialize)(this.ColourGUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ColourRUpDown)).BeginInit();
this.MainMenu.SuspendLayout();
this.LightMenuStrip.SuspendLayout();
this.SuspendLayout();
//
// MainSplitContainer
@ -202,6 +207,7 @@
this.LightsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.LightsTreeView.ContextMenuStrip = this.LightMenuStrip;
this.LightsTreeView.FullRowSelect = true;
this.LightsTreeView.HideSelection = false;
this.LightsTreeView.Location = new System.Drawing.Point(3, 3);
@ -1213,6 +1219,28 @@
this.ScaleMenuItem.ToolTipText = "Scale";
this.ScaleMenuItem.Click += new System.EventHandler(this.ScaleMenuItem_Click);
//
// LightMenuStrip
//
this.LightMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newLightToolStripMenuItem,
this.deleteLightToolStripMenuItem});
this.LightMenuStrip.Name = "LightMenuStrip";
this.LightMenuStrip.Size = new System.Drawing.Size(138, 48);
//
// newLightToolStripMenuItem
//
this.newLightToolStripMenuItem.Name = "newLightToolStripMenuItem";
this.newLightToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.newLightToolStripMenuItem.Text = "New Light";
this.newLightToolStripMenuItem.Click += new System.EventHandler(this.newLightToolStripMenuItem_Click);
//
// deleteLightToolStripMenuItem
//
this.deleteLightToolStripMenuItem.Name = "deleteLightToolStripMenuItem";
this.deleteLightToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.deleteLightToolStripMenuItem.Text = "Delete Light";
this.deleteLightToolStripMenuItem.Click += new System.EventHandler(this.deleteLightToolStripMenuItem_Click);
//
// ModelLightForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1247,6 +1275,7 @@
((System.ComponentModel.ISupportInitialize)(this.ColourRUpDown)).EndInit();
this.MainMenu.ResumeLayout(false);
this.MainMenu.PerformLayout();
this.LightMenuStrip.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -1345,5 +1374,8 @@
private System.Windows.Forms.Button DeleteLightButton;
private System.Windows.Forms.Button NewLightButton;
private System.Windows.Forms.Button DuplicateLightButton;
private System.Windows.Forms.ContextMenuStrip LightMenuStrip;
private System.Windows.Forms.ToolStripMenuItem newLightToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteLightToolStripMenuItem;
}
}

View File

@ -385,7 +385,7 @@ namespace CodeWalker.Forms
lights.Remove(selectedLight);
FragDrawable.OwnerFragment.LightAttributes.data_items = lights.ToArray();
UpdateLightParams();
LoadModel(Drawable);
LoadModel(FragDrawable);
}
else
{
@ -1081,5 +1081,15 @@ namespace CodeWalker.Forms
{
}
private void newLightToolStripMenuItem_Click(object sender, EventArgs e)
{
CreateLight();
}
private void deleteLightToolStripMenuItem_Click(object sender, EventArgs e)
{
DeleteLight();
}
}
}

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="LightMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
<metadata name="MainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>