From 59ff16e82b85041b3214617e765619ef5b4fe9f6 Mon Sep 17 00:00:00 2001 From: igorseabra4 Date: Tue, 28 Apr 2020 00:39:08 -0300 Subject: [PATCH] update user template manager, add pipt presets --- .../ArchiveEditorFunctions_AssetEditing.cs | 8 ++--- IndustrialPark/Assets/Binary/AssetPIPT.cs | 28 ++++++++++++++- IndustrialPark/IndustrialPark.csproj | 1 - .../MainForm/UserTemplateManager.Designer.cs | 35 +++++-------------- .../MainForm/UserTemplateManager.cs | 15 +------- 5 files changed, 40 insertions(+), 47 deletions(-) diff --git a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs index d6e3d340..8890f959 100644 --- a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs +++ b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs @@ -584,11 +584,11 @@ public void ApplyScale(Vector3 factor) TRIG.FixPosition(); } - else if (a is IClickableAsset clickableAsset) + else if (a is IClickableAsset ica) { - ((IClickableAsset)a).PositionX *= factor.X; - ((IClickableAsset)a).PositionY *= factor.Y; - ((IClickableAsset)a).PositionZ *= factor.Z; + ica.PositionX *= factor.X; + ica.PositionY *= factor.Y; + ica.PositionZ *= factor.Z; if (a is AssetMVPT MVPT) { diff --git a/IndustrialPark/Assets/Binary/AssetPIPT.cs b/IndustrialPark/Assets/Binary/AssetPIPT.cs index 1e92289f..5f595210 100644 --- a/IndustrialPark/Assets/Binary/AssetPIPT.cs +++ b/IndustrialPark/Assets/Binary/AssetPIPT.cs @@ -22,6 +22,17 @@ public enum BlendFactorType SourceAlphaSaturated = 0x0B } + public enum PiptPreset + { + None = 0, + Default = 9961474, + VertexColors = 9961538, + AlphaBlend = 9987330, + AlphaBlendVertexColors = 9987394, + AdditiveAlpha = 10036486, + AdditiveAlphaVertexColors = 10036550, + } + public class EntryPIPT { [Category("PIPT Entry")] @@ -30,7 +41,22 @@ public class EntryPIPT public int SubObjectBits { get; set; } [Category("PIPT Entry")] public int PipeFlags { get; set; } - + [Category("PIPT Entry")] + public PiptPreset Preset + { + get + { + foreach (PiptPreset v in Enum.GetValues(typeof(PiptPreset))) + if ((int)v == PipeFlags) + return v; + return PiptPreset.None; + } + set + { + PipeFlags = (int)value; + } + } + [Category("PIPT Pipe Flags")] public byte AlphaCompareValue { diff --git a/IndustrialPark/IndustrialPark.csproj b/IndustrialPark/IndustrialPark.csproj index d67cb0d5..0f70c494 100644 --- a/IndustrialPark/IndustrialPark.csproj +++ b/IndustrialPark/IndustrialPark.csproj @@ -552,7 +552,6 @@ ViewConfig.cs - diff --git a/IndustrialPark/MainForm/UserTemplateManager.Designer.cs b/IndustrialPark/MainForm/UserTemplateManager.Designer.cs index 692dcc53..8a89a57a 100644 --- a/IndustrialPark/MainForm/UserTemplateManager.Designer.cs +++ b/IndustrialPark/MainForm/UserTemplateManager.Designer.cs @@ -28,7 +28,6 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.buttonImportRawData = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.listBoxTemplates = new System.Windows.Forms.ListBox(); this.buttonCopy = new System.Windows.Forms.Button(); @@ -38,18 +37,6 @@ private void InitializeComponent() this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // buttonImportRawData - // - this.buttonImportRawData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonImportRawData.Location = new System.Drawing.Point(145, 298); - this.buttonImportRawData.Name = "buttonImportRawData"; - this.buttonImportRawData.Size = new System.Drawing.Size(124, 23); - this.buttonImportRawData.TabIndex = 4; - this.buttonImportRawData.Text = "Import Raw"; - this.buttonImportRawData.UseVisualStyleBackColor = true; - this.buttonImportRawData.Click += new System.EventHandler(this.buttonImportRawData_Click); - // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -71,15 +58,14 @@ private void InitializeComponent() this.listBoxTemplates.FormattingEnabled = true; this.listBoxTemplates.Location = new System.Drawing.Point(6, 19); this.listBoxTemplates.Name = "listBoxTemplates"; - this.listBoxTemplates.Size = new System.Drawing.Size(251, 225); + this.listBoxTemplates.Size = new System.Drawing.Size(249, 225); this.listBoxTemplates.TabIndex = 9; this.listBoxTemplates.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox1_KeyDown); this.listBoxTemplates.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBoxTemplates_MouseDoubleClick); // // buttonCopy // - this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCopy.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonCopy.Location = new System.Drawing.Point(17, 269); this.buttonCopy.Name = "buttonCopy"; this.buttonCopy.Size = new System.Drawing.Size(122, 23); @@ -90,8 +76,7 @@ private void InitializeComponent() // // buttonPaste // - this.buttonPaste.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.buttonPaste.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonPaste.Location = new System.Drawing.Point(145, 269); this.buttonPaste.Name = "buttonPaste"; this.buttonPaste.Size = new System.Drawing.Size(122, 23); @@ -102,11 +87,10 @@ private void InitializeComponent() // // buttonDelete // - this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonDelete.Location = new System.Drawing.Point(18, 327); + this.buttonDelete.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.buttonDelete.Location = new System.Drawing.Point(145, 298); this.buttonDelete.Name = "buttonDelete"; - this.buttonDelete.Size = new System.Drawing.Size(250, 23); + this.buttonDelete.Size = new System.Drawing.Size(122, 23); this.buttonDelete.TabIndex = 7; this.buttonDelete.Text = "Delete"; this.buttonDelete.UseVisualStyleBackColor = true; @@ -114,8 +98,7 @@ private void InitializeComponent() // // buttonRename // - this.buttonRename.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRename.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonRename.Location = new System.Drawing.Point(18, 298); this.buttonRename.Name = "buttonRename"; this.buttonRename.Size = new System.Drawing.Size(121, 23); @@ -128,13 +111,12 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 362); + this.ClientSize = new System.Drawing.Size(284, 330); this.Controls.Add(this.buttonRename); this.Controls.Add(this.buttonDelete); this.Controls.Add(this.buttonPaste); this.Controls.Add(this.buttonCopy); this.Controls.Add(this.groupBox2); - this.Controls.Add(this.buttonImportRawData); this.KeyPreview = true; this.MaximizeBox = false; this.Name = "UserTemplateManager"; @@ -146,7 +128,6 @@ private void InitializeComponent() } #endregion - private System.Windows.Forms.Button buttonImportRawData; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.ListBox listBoxTemplates; private System.Windows.Forms.Button buttonCopy; diff --git a/IndustrialPark/MainForm/UserTemplateManager.cs b/IndustrialPark/MainForm/UserTemplateManager.cs index 9d702e22..66279c54 100644 --- a/IndustrialPark/MainForm/UserTemplateManager.cs +++ b/IndustrialPark/MainForm/UserTemplateManager.cs @@ -24,20 +24,7 @@ protected override void OnFormClosing(FormClosingEventArgs e) e.Cancel = true; Hide(); } - - private void buttonImportRawData_Click(object sender, EventArgs e) - { - OpenFileDialog openFileDialog = new OpenFileDialog() { Multiselect = true }; - - if (openFileDialog.ShowDialog() == DialogResult.OK) - { - foreach (string s in openFileDialog.FileNames) - File.Copy(s, Path.Combine(Program.MainForm.userTemplatesFolder, Path.GetFileName(s))); - - UpdateListBox(); - } - } - + private void UpdateListBox() { listBoxTemplates.Items.Clear();