mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 23:12:59 +08:00
Merge pull request #148 from arifsezeraktas/master
Add duplicate light button to model light form
This commit is contained in:
commit
1a11b3d7a9
38
CodeWalker/Forms/ModelLightForm.Designer.cs
generated
38
CodeWalker/Forms/ModelLightForm.Designer.cs
generated
@ -30,6 +30,7 @@
|
|||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ModelLightForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ModelLightForm));
|
||||||
this.MainSplitContainer = new System.Windows.Forms.SplitContainer();
|
this.MainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.DuplicateLightButton = new System.Windows.Forms.Button();
|
||||||
this.DeleteLightButton = new System.Windows.Forms.Button();
|
this.DeleteLightButton = new System.Windows.Forms.Button();
|
||||||
this.NewLightButton = new System.Windows.Forms.Button();
|
this.NewLightButton = new System.Windows.Forms.Button();
|
||||||
this.LightsTreeView = new CodeWalker.WinForms.TreeViewFix();
|
this.LightsTreeView = new CodeWalker.WinForms.TreeViewFix();
|
||||||
@ -113,6 +114,7 @@
|
|||||||
this.EditMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.EditMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.EditNewLightMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.EditNewLightMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.EditDeleteLightMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.EditDeleteLightMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.EditDuplicateLightMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.OptionsMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.OptionsMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.OptionsShowOutlinesMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.OptionsShowOutlinesMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.MoveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.MoveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -148,6 +150,7 @@
|
|||||||
//
|
//
|
||||||
// MainSplitContainer.Panel1
|
// MainSplitContainer.Panel1
|
||||||
//
|
//
|
||||||
|
this.MainSplitContainer.Panel1.Controls.Add(this.DuplicateLightButton);
|
||||||
this.MainSplitContainer.Panel1.Controls.Add(this.DeleteLightButton);
|
this.MainSplitContainer.Panel1.Controls.Add(this.DeleteLightButton);
|
||||||
this.MainSplitContainer.Panel1.Controls.Add(this.NewLightButton);
|
this.MainSplitContainer.Panel1.Controls.Add(this.NewLightButton);
|
||||||
this.MainSplitContainer.Panel1.Controls.Add(this.LightsTreeView);
|
this.MainSplitContainer.Panel1.Controls.Add(this.LightsTreeView);
|
||||||
@ -155,10 +158,22 @@
|
|||||||
// MainSplitContainer.Panel2
|
// MainSplitContainer.Panel2
|
||||||
//
|
//
|
||||||
this.MainSplitContainer.Panel2.Controls.Add(this.LightPropertiesPanel);
|
this.MainSplitContainer.Panel2.Controls.Add(this.LightPropertiesPanel);
|
||||||
this.MainSplitContainer.Size = new System.Drawing.Size(733, 523);
|
this.MainSplitContainer.Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.MainSplitContainer_Panel2_Paint);
|
||||||
|
this.MainSplitContainer.Size = new System.Drawing.Size(733, 561);
|
||||||
this.MainSplitContainer.SplitterDistance = 184;
|
this.MainSplitContainer.SplitterDistance = 184;
|
||||||
this.MainSplitContainer.TabIndex = 0;
|
this.MainSplitContainer.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// DuplicateLightButton
|
||||||
|
//
|
||||||
|
this.DuplicateLightButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.DuplicateLightButton.Location = new System.Drawing.Point(7, 526);
|
||||||
|
this.DuplicateLightButton.Name = "DuplicateLightButton";
|
||||||
|
this.DuplicateLightButton.Size = new System.Drawing.Size(169, 23);
|
||||||
|
this.DuplicateLightButton.TabIndex = 8;
|
||||||
|
this.DuplicateLightButton.Text = "Duplicate Light";
|
||||||
|
this.DuplicateLightButton.UseVisualStyleBackColor = true;
|
||||||
|
this.DuplicateLightButton.Click += new System.EventHandler(this.DuplicateLightButton_Click);
|
||||||
|
//
|
||||||
// DeleteLightButton
|
// DeleteLightButton
|
||||||
//
|
//
|
||||||
this.DeleteLightButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.DeleteLightButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
@ -279,7 +294,7 @@
|
|||||||
this.LightPropertiesPanel.Controls.Add(this.label31);
|
this.LightPropertiesPanel.Controls.Add(this.label31);
|
||||||
this.LightPropertiesPanel.Location = new System.Drawing.Point(4, 3);
|
this.LightPropertiesPanel.Location = new System.Drawing.Point(4, 3);
|
||||||
this.LightPropertiesPanel.Name = "LightPropertiesPanel";
|
this.LightPropertiesPanel.Name = "LightPropertiesPanel";
|
||||||
this.LightPropertiesPanel.Size = new System.Drawing.Size(538, 517);
|
this.LightPropertiesPanel.Size = new System.Drawing.Size(529, 517);
|
||||||
this.LightPropertiesPanel.TabIndex = 1;
|
this.LightPropertiesPanel.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// VolumetricFadeDistanceUpDown
|
// VolumetricFadeDistanceUpDown
|
||||||
@ -1127,7 +1142,8 @@
|
|||||||
//
|
//
|
||||||
this.EditMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.EditMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.EditNewLightMenu,
|
this.EditNewLightMenu,
|
||||||
this.EditDeleteLightMenu});
|
this.EditDeleteLightMenu,
|
||||||
|
this.EditDuplicateLightMenu});
|
||||||
this.EditMenu.Name = "EditMenu";
|
this.EditMenu.Name = "EditMenu";
|
||||||
this.EditMenu.Size = new System.Drawing.Size(39, 20);
|
this.EditMenu.Size = new System.Drawing.Size(39, 20);
|
||||||
this.EditMenu.Text = "Edit";
|
this.EditMenu.Text = "Edit";
|
||||||
@ -1135,7 +1151,7 @@
|
|||||||
// EditNewLightMenu
|
// EditNewLightMenu
|
||||||
//
|
//
|
||||||
this.EditNewLightMenu.Name = "EditNewLightMenu";
|
this.EditNewLightMenu.Name = "EditNewLightMenu";
|
||||||
this.EditNewLightMenu.Size = new System.Drawing.Size(180, 22);
|
this.EditNewLightMenu.Size = new System.Drawing.Size(154, 22);
|
||||||
this.EditNewLightMenu.Text = "New Light";
|
this.EditNewLightMenu.Text = "New Light";
|
||||||
this.EditNewLightMenu.Click += new System.EventHandler(this.EditNewLightMenu_Click);
|
this.EditNewLightMenu.Click += new System.EventHandler(this.EditNewLightMenu_Click);
|
||||||
//
|
//
|
||||||
@ -1143,10 +1159,18 @@
|
|||||||
//
|
//
|
||||||
this.EditDeleteLightMenu.Enabled = false;
|
this.EditDeleteLightMenu.Enabled = false;
|
||||||
this.EditDeleteLightMenu.Name = "EditDeleteLightMenu";
|
this.EditDeleteLightMenu.Name = "EditDeleteLightMenu";
|
||||||
this.EditDeleteLightMenu.Size = new System.Drawing.Size(180, 22);
|
this.EditDeleteLightMenu.Size = new System.Drawing.Size(154, 22);
|
||||||
this.EditDeleteLightMenu.Text = "Delete Light";
|
this.EditDeleteLightMenu.Text = "Delete Light";
|
||||||
this.EditDeleteLightMenu.Click += new System.EventHandler(this.EditDeleteLightMenu_Click);
|
this.EditDeleteLightMenu.Click += new System.EventHandler(this.EditDeleteLightMenu_Click);
|
||||||
//
|
//
|
||||||
|
// EditDuplicateLightMenu
|
||||||
|
//
|
||||||
|
this.EditDuplicateLightMenu.Enabled = false;
|
||||||
|
this.EditDuplicateLightMenu.Name = "EditDuplicateLightMenu";
|
||||||
|
this.EditDuplicateLightMenu.Size = new System.Drawing.Size(154, 22);
|
||||||
|
this.EditDuplicateLightMenu.Text = "Duplicate Light";
|
||||||
|
this.EditDuplicateLightMenu.Click += new System.EventHandler(this.EditDuplicateLightMenu_Click);
|
||||||
|
//
|
||||||
// OptionsMenu
|
// OptionsMenu
|
||||||
//
|
//
|
||||||
this.OptionsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.OptionsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@ -1193,7 +1217,7 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(733, 547);
|
this.ClientSize = new System.Drawing.Size(733, 585);
|
||||||
this.Controls.Add(this.MainSplitContainer);
|
this.Controls.Add(this.MainSplitContainer);
|
||||||
this.Controls.Add(this.MainMenu);
|
this.Controls.Add(this.MainMenu);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
@ -1291,6 +1315,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem EditMenu;
|
private System.Windows.Forms.ToolStripMenuItem EditMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem EditNewLightMenu;
|
private System.Windows.Forms.ToolStripMenuItem EditNewLightMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem EditDeleteLightMenu;
|
private System.Windows.Forms.ToolStripMenuItem EditDeleteLightMenu;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem EditDuplicateLightMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem OptionsMenu;
|
private System.Windows.Forms.ToolStripMenuItem OptionsMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem OptionsShowOutlinesMenu;
|
private System.Windows.Forms.ToolStripMenuItem OptionsShowOutlinesMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem MoveMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem MoveMenuItem;
|
||||||
@ -1319,5 +1344,6 @@
|
|||||||
private System.Windows.Forms.NumericUpDown FlashinessUpDown;
|
private System.Windows.Forms.NumericUpDown FlashinessUpDown;
|
||||||
private System.Windows.Forms.Button DeleteLightButton;
|
private System.Windows.Forms.Button DeleteLightButton;
|
||||||
private System.Windows.Forms.Button NewLightButton;
|
private System.Windows.Forms.Button NewLightButton;
|
||||||
|
private System.Windows.Forms.Button DuplicateLightButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -111,6 +111,7 @@ namespace CodeWalker.Forms
|
|||||||
{
|
{
|
||||||
DeleteLightButton.Enabled = false;
|
DeleteLightButton.Enabled = false;
|
||||||
EditDeleteLightMenu.Enabled = false;
|
EditDeleteLightMenu.Enabled = false;
|
||||||
|
EditDuplicateLightMenu.Enabled = false;
|
||||||
populatingui = true;
|
populatingui = true;
|
||||||
PositionTextBox.Text = "";
|
PositionTextBox.Text = "";
|
||||||
DirectionTextBox.Text = "";
|
DirectionTextBox.Text = "";
|
||||||
@ -154,6 +155,7 @@ namespace CodeWalker.Forms
|
|||||||
{
|
{
|
||||||
DeleteLightButton.Enabled = true;
|
DeleteLightButton.Enabled = true;
|
||||||
EditDeleteLightMenu.Enabled = true;
|
EditDeleteLightMenu.Enabled = true;
|
||||||
|
EditDuplicateLightMenu.Enabled = true;
|
||||||
populatingui = true;
|
populatingui = true;
|
||||||
PositionTextBox.Text = FloatUtil.GetVector3String(light.Position);
|
PositionTextBox.Text = FloatUtil.GetVector3String(light.Position);
|
||||||
DirectionTextBox.Text = FloatUtil.GetVector3String(light.Direction);
|
DirectionTextBox.Text = FloatUtil.GetVector3String(light.Direction);
|
||||||
@ -222,6 +224,57 @@ namespace CodeWalker.Forms
|
|||||||
light.TimeFlags = 14680191;
|
light.TimeFlags = 14680191;
|
||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
|
private LightAttributes DuplicateLightAttribute()
|
||||||
|
{
|
||||||
|
LightAttributes light = new LightAttributes();
|
||||||
|
light.Unknown_0h = selectedLight.Unknown_0h;
|
||||||
|
light.Unknown_4h = selectedLight.Unknown_4h;
|
||||||
|
light.Position = selectedLight.Position;
|
||||||
|
light.Unknown_14h = selectedLight.Unknown_14h;
|
||||||
|
light.ColorR = selectedLight.ColorR;
|
||||||
|
light.ColorG = selectedLight.ColorG;
|
||||||
|
light.ColorB = selectedLight.ColorB;
|
||||||
|
light.Flashiness = selectedLight.Flashiness;
|
||||||
|
light.Intensity = selectedLight.Intensity;
|
||||||
|
light.Flags = selectedLight.Flags;
|
||||||
|
light.BoneId = selectedLight.BoneId;
|
||||||
|
light.Type = selectedLight.Type;
|
||||||
|
light.GroupId = selectedLight.GroupId;
|
||||||
|
light.TimeFlags = selectedLight.TimeFlags;
|
||||||
|
light.Falloff = selectedLight.Falloff;
|
||||||
|
light.FalloffExponent = selectedLight.FalloffExponent;
|
||||||
|
light.CullingPlaneNormal = selectedLight.CullingPlaneNormal;
|
||||||
|
light.CullingPlaneOffset = selectedLight.CullingPlaneOffset;
|
||||||
|
light.ShadowBlur = selectedLight.ShadowBlur;
|
||||||
|
light.Unknown_45h = selectedLight.Unknown_45h;
|
||||||
|
light.Unknown_46h = selectedLight.Unknown_46h;
|
||||||
|
light.VolumeIntensity = selectedLight.VolumeIntensity;
|
||||||
|
light.VolumeSizeScale = selectedLight.VolumeSizeScale;
|
||||||
|
light.VolumeOuterColorR = selectedLight.VolumeOuterColorR;
|
||||||
|
light.VolumeOuterColorG = selectedLight.VolumeOuterColorG;
|
||||||
|
light.VolumeOuterColorB = selectedLight.VolumeOuterColorB;
|
||||||
|
light.LightHash = selectedLight.LightHash;
|
||||||
|
light.VolumeOuterIntensity = selectedLight.VolumeOuterIntensity;
|
||||||
|
light.CoronaSize = selectedLight.CoronaSize;
|
||||||
|
light.VolumeOuterExponent = selectedLight.VolumeOuterExponent;
|
||||||
|
light.LightFadeDistance = selectedLight.LightFadeDistance;
|
||||||
|
light.ShadowFadeDistance = selectedLight.ShadowFadeDistance;
|
||||||
|
light.SpecularFadeDistance = selectedLight.SpecularFadeDistance;
|
||||||
|
light.VolumetricFadeDistance = selectedLight.VolumetricFadeDistance;
|
||||||
|
light.ShadowNearClip = selectedLight.ShadowNearClip;
|
||||||
|
light.CoronaIntensity = selectedLight.CoronaIntensity;
|
||||||
|
light.CoronaZBias = selectedLight.CoronaZBias;
|
||||||
|
light.Direction = selectedLight.Direction;
|
||||||
|
light.Tangent = selectedLight.Tangent;
|
||||||
|
light.ConeInnerAngle = selectedLight.ConeInnerAngle;
|
||||||
|
light.ConeOuterAngle = selectedLight.ConeOuterAngle;
|
||||||
|
light.Extent = selectedLight.Extent;
|
||||||
|
light.ProjectedTextureHash = selectedLight.ProjectedTextureHash;
|
||||||
|
light.Unknown_A4h = selectedLight.Unknown_A4h;
|
||||||
|
|
||||||
|
return light;
|
||||||
|
}
|
||||||
|
|
||||||
private void SelectLight(LightAttributes light)
|
private void SelectLight(LightAttributes light)
|
||||||
{
|
{
|
||||||
if (light == null)
|
if (light == null)
|
||||||
@ -346,6 +399,50 @@ namespace CodeWalker.Forms
|
|||||||
LoadModels(DrawableDict);
|
LoadModels(DrawableDict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DuplicateLight()
|
||||||
|
{
|
||||||
|
if (selectedLight == null) return;
|
||||||
|
selectedLight = DuplicateLightAttribute();
|
||||||
|
if (Drawable != null)
|
||||||
|
{
|
||||||
|
if (Drawable.LightAttributes == null) Drawable.LightAttributes = new ResourceSimpleList64<LightAttributes>();
|
||||||
|
List<LightAttributes> lights = Drawable.LightAttributes.data_items?.ToList() ?? new List<LightAttributes>();
|
||||||
|
lights.Add(selectedLight);
|
||||||
|
Drawable.LightAttributes.data_items = lights.ToArray();
|
||||||
|
UpdateLightParams();
|
||||||
|
LoadModel(Drawable);
|
||||||
|
}
|
||||||
|
else if (FragDrawable != null)
|
||||||
|
{
|
||||||
|
if (FragDrawable.OwnerFragment.LightAttributes == null) FragDrawable.OwnerFragment.LightAttributes = new ResourceSimpleList64<LightAttributes>();
|
||||||
|
List<LightAttributes> lights = FragDrawable.OwnerFragment.LightAttributes.data_items?.ToList() ?? new List<LightAttributes>();
|
||||||
|
lights.Add(selectedLight);
|
||||||
|
FragDrawable.OwnerFragment.LightAttributes.data_items = lights.ToArray();
|
||||||
|
UpdateLightParams();
|
||||||
|
LoadModel(FragDrawable);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var n = LightsTreeView.SelectedNode;
|
||||||
|
if (n != null)
|
||||||
|
{
|
||||||
|
var dr = n.Tag as Drawable;
|
||||||
|
if (dr == null) { dr = n.Parent.Tag as Drawable; } //try parent node tag also
|
||||||
|
if (dr != null)
|
||||||
|
{
|
||||||
|
if (dr.LightAttributes == null) dr.LightAttributes = new ResourceSimpleList64<LightAttributes>();
|
||||||
|
List<LightAttributes> lights = dr.LightAttributes.data_items?.ToList() ?? new List<LightAttributes>();
|
||||||
|
lights.Add(selectedLight);
|
||||||
|
dr.LightAttributes.data_items = lights.ToArray();
|
||||||
|
UpdateLightParams();
|
||||||
|
LoadModels(DrawableDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SelectLightTreeNode(selectedLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFlagsCheckBoxes()
|
private void UpdateFlagsCheckBoxes()
|
||||||
@ -933,6 +1030,11 @@ namespace CodeWalker.Forms
|
|||||||
DeleteLight();
|
DeleteLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditDuplicateLightMenu_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DuplicateLight();
|
||||||
|
}
|
||||||
|
|
||||||
private void OptionsShowOutlinesMenu_Click(object sender, EventArgs e)
|
private void OptionsShowOutlinesMenu_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OptionsShowOutlinesMenu.Checked = !OptionsShowOutlinesMenu.Checked;
|
OptionsShowOutlinesMenu.Checked = !OptionsShowOutlinesMenu.Checked;
|
||||||
@ -969,5 +1071,15 @@ namespace CodeWalker.Forms
|
|||||||
{
|
{
|
||||||
DeleteLight();
|
DeleteLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DuplicateLightButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DuplicateLight();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainSplitContainer_Panel2_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user