From 4ec72d46393449e8e641988b620c6feb3b827e21 Mon Sep 17 00:00:00 2001 From: DragonirHD Date: Sun, 11 Dec 2022 14:42:30 +0100 Subject: [PATCH 1/6] - removed unused using statements - expanded layout - added chaining window - fixed naming violations on all Modules - Made more validity checks for path variable and file name variable - Enabled fov again on spiral move - Enabled ease again on spiral move - Removed unused code --- MovementScriptGenerator/Circle.cs | 78 -- MovementScriptGenerator/CircleControl.cs | 30 +- MovementScriptGenerator/Form1.Designer.cs | 859 ++++++++++++------ MovementScriptGenerator/Form1.cs | 152 +++- MovementScriptGenerator/Form1.resx | 7 +- MovementScriptGenerator/Modules/Chain.cs | 9 + .../Modules/ChainElement.cs | 12 + MovementScriptGenerator/Modules/Frame.cs | 19 +- MovementScriptGenerator/Modules/Move.cs | 22 + .../Modules/MovementScript.cs | 12 +- .../Modules/Moves/Circle.cs | 95 ++ .../Modules/Moves/Spiral.cs | 185 ++++ MovementScriptGenerator/Modules/Position.cs | 13 +- MovementScriptGenerator/Modules/Rotation.cs | 13 +- .../MovementScriptGenerator.csproj | 11 +- MovementScriptGenerator/Spiral.cs | 229 ----- .../SpiralControl.Designer.cs | 50 +- MovementScriptGenerator/SpiralControl.cs | 47 +- 18 files changed, 1079 insertions(+), 764 deletions(-) delete mode 100644 MovementScriptGenerator/Circle.cs create mode 100644 MovementScriptGenerator/Modules/Chain.cs create mode 100644 MovementScriptGenerator/Modules/ChainElement.cs create mode 100644 MovementScriptGenerator/Modules/Move.cs create mode 100644 MovementScriptGenerator/Modules/Moves/Circle.cs create mode 100644 MovementScriptGenerator/Modules/Moves/Spiral.cs delete mode 100644 MovementScriptGenerator/Spiral.cs diff --git a/MovementScriptGenerator/Circle.cs b/MovementScriptGenerator/Circle.cs deleted file mode 100644 index 64b3d97..0000000 --- a/MovementScriptGenerator/Circle.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using MovementScriptGenerator.Modules; - -namespace MovementScriptGenerator -{ - class Circle - { - public List GenerateFrames( - int fov, - float duration, - float rotX, - float rotZ, - float distance, - float startingPointDegree, - float sectorDegrees, - int iterations, - float height, - bool rotateClockwise - ) - { - List frames = new List(); - - float initialDegree = 0; - float maxDegrees = sectorDegrees - 1; - //float maxDegrees = 359; - float initialDegreeAddend = 1; - - if (!rotateClockwise) { - initialDegree *= -1; - maxDegrees *= -1; - initialDegreeAddend *= -1; - } - - for (float i = initialDegree; (rotateClockwise && i <= maxDegrees) || (!rotateClockwise && i >= maxDegrees); i += (float)initialDegreeAddend / iterations) - { - float usedDegree = i + startingPointDegree; - double radiant = usedDegree * Math.PI / 180; - - Frame frame = new Frame(); - frame.position = new Position(); - frame.rotation = new Rotation(); - - frame.position.x = (float)Math.Sin(radiant) * distance; - frame.position.y = height; - frame.position.z = (float)Math.Cos(radiant) * distance; - - frame.rotation.z = rotZ; - frame.rotation.x = rotX; - frame.rotation.y = usedDegree -180; - - if (usedDegree == 0 || usedDegree == 180 || usedDegree == 360) - { - frame.position.x = 0; - } - if (usedDegree == 90 || usedDegree == 270) - { - frame.position.z = 0; - } - - - frame.duration = duration / Math.Abs(maxDegrees) / iterations; - - if(fov > 0) - { - frame.fov = fov; - } - - frames.Add(frame); - } - - return frames; - } - } -} diff --git a/MovementScriptGenerator/CircleControl.cs b/MovementScriptGenerator/CircleControl.cs index dd566de..9b24f77 100644 --- a/MovementScriptGenerator/CircleControl.cs +++ b/MovementScriptGenerator/CircleControl.cs @@ -1,19 +1,10 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using System.Windows.Forms; -using MovementScriptGenerator.Modules; namespace MovementScriptGenerator { public partial class CircleControl : UserControl { - private static Circle circle = new Circle(); List rotationTypes = new List() { @@ -33,28 +24,23 @@ private void initializeComboBoxes() cbRotation.SelectedIndex = 0; } - public MovementScript CreateMovementScript() + public Circle CreateMove(string moveName) { - MovementScript movementScript = new MovementScript(); - bool rotateClockwise = false; - if (cbRotation.SelectedIndex == 0) - { - rotateClockwise = true; - } - movementScript.frames = circle.GenerateFrames( + Circle circle = new Circle( + moveName, (int)numFOV.Value, (float)numDuration.Value, + (float)numHeight.Value, (float)numRotX.Value, (float)numRotZ.Value, (float)numDistance.Value, (float)numStartingPoint.Value, (float)numSector.Value, (int)numIterations.Value, - (float)numHeight.Value, - rotateClockwise - ); + cbRotation.SelectedIndex == 0 ? true : false + ); - return movementScript; + return circle; } } } diff --git a/MovementScriptGenerator/Form1.Designer.cs b/MovementScriptGenerator/Form1.Designer.cs index fff6806..be0d19f 100644 --- a/MovementScriptGenerator/Form1.Designer.cs +++ b/MovementScriptGenerator/Form1.Designer.cs @@ -33,10 +33,32 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.lblTitle = new System.Windows.Forms.Label(); + this.tableLayoutPanel13 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel14 = new System.Windows.Forms.TableLayoutPanel(); + this.label2 = new System.Windows.Forms.Label(); + this.tableLayoutPanel15 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel11 = new System.Windows.Forms.TableLayoutPanel(); + this.txtPath = new System.Windows.Forms.TextBox(); + this.lblPath = new System.Windows.Forms.Label(); + this.btnGenerateScript = new System.Windows.Forms.Button(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.txtFileName = new System.Windows.Forms.TextBox(); + this.lblFileName = new System.Windows.Forms.Label(); + this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel(); + this.lblSyncToSong = new System.Windows.Forms.Label(); + this.checkSyncToSong = new System.Windows.Forms.CheckBox(); + this.tableLayoutPanel9 = new System.Windows.Forms.TableLayoutPanel(); + this.lblLoop = new System.Windows.Forms.Label(); + this.checkLoop = new System.Windows.Forms.CheckBox(); + this.tableLayoutPanel12 = new System.Windows.Forms.TableLayoutPanel(); + this.lblAddToScript = new System.Windows.Forms.Label(); + this.checkAddToScript = new System.Windows.Forms.CheckBox(); + this.tvChain = new System.Windows.Forms.TreeView(); + this.tableLayoutPanel16 = new System.Windows.Forms.TableLayoutPanel(); + this.btnAddMoveToChain = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); this.flpContent = new System.Windows.Forms.FlowLayoutPanel(); - this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); - this.cbType = new System.Windows.Forms.ComboBox(); - this.lblType = new System.Windows.Forms.Label(); this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); this.lblMoveDescriptionTitle = new System.Windows.Forms.Label(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); @@ -46,135 +68,449 @@ private void InitializeComponent() this.lblSettingsTitle = new System.Windows.Forms.Label(); this.tableLayoutPanel8 = new System.Windows.Forms.TableLayoutPanel(); this.lblDescription = new System.Windows.Forms.Label(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.txtName = new System.Windows.Forms.TextBox(); - this.lblName = new System.Windows.Forms.Label(); this.tlContent = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel(); - this.lblSyncToSong = new System.Windows.Forms.Label(); - this.checkSyncToSong = new System.Windows.Forms.CheckBox(); - this.tableLayoutPanel12 = new System.Windows.Forms.TableLayoutPanel(); - this.lblAddToScript = new System.Windows.Forms.Label(); - this.checkAddToScript = new System.Windows.Forms.CheckBox(); - this.tableLayoutPanel9 = new System.Windows.Forms.TableLayoutPanel(); - this.btnGenerate = new System.Windows.Forms.Button(); - this.tableLayoutPanel11 = new System.Windows.Forms.TableLayoutPanel(); - this.txtPath = new System.Windows.Forms.TextBox(); - this.lblPath = new System.Windows.Forms.Label(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.cbType = new System.Windows.Forms.ComboBox(); + this.lblType = new System.Windows.Forms.Label(); + this.tableLayoutPanel17 = new System.Windows.Forms.TableLayoutPanel(); + this.txtMoveName = new System.Windows.Forms.TextBox(); + this.lblMoveName = new System.Windows.Forms.Label(); this.ToolTip = new System.Windows.Forms.ToolTip(this.components); this.tableLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel13.SuspendLayout(); + this.tableLayoutPanel14.SuspendLayout(); + this.tableLayoutPanel15.SuspendLayout(); + this.tableLayoutPanel11.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel10.SuspendLayout(); + this.tableLayoutPanel9.SuspendLayout(); + this.tableLayoutPanel12.SuspendLayout(); + this.tableLayoutPanel16.SuspendLayout(); this.flpContent.SuspendLayout(); - this.tableLayoutPanel4.SuspendLayout(); this.tableLayoutPanel5.SuspendLayout(); this.tableLayoutPanel7.SuspendLayout(); this.tableLayoutPanel6.SuspendLayout(); this.tableLayoutPanel8.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); - this.tableLayoutPanel10.SuspendLayout(); - this.tableLayoutPanel12.SuspendLayout(); - this.tableLayoutPanel9.SuspendLayout(); - this.tableLayoutPanel11.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.tableLayoutPanel17.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Controls.Add(this.lblTitle, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.flpContent, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel11, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel13, 1, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 3; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(384, 811); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 7.5F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 87.5F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(954, 811); this.tableLayoutPanel1.TabIndex = 2; // // lblTitle // - this.lblTitle.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblTitle.AutoSize = true; + this.lblTitle.Dock = System.Windows.Forms.DockStyle.Fill; this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblTitle.Location = new System.Drawing.Point(44, 26); + this.lblTitle.Location = new System.Drawing.Point(23, 0); this.lblTitle.Name = "lblTitle"; - this.lblTitle.Size = new System.Drawing.Size(295, 29); + this.lblTitle.Size = new System.Drawing.Size(908, 60); this.lblTitle.TabIndex = 0; this.lblTitle.Text = "MovementScriptGenerator"; + this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // tableLayoutPanel13 + // + this.tableLayoutPanel13.ColumnCount = 2; + this.tableLayoutPanel13.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 300F)); + this.tableLayoutPanel13.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel13.Controls.Add(this.tableLayoutPanel14, 1, 0); + this.tableLayoutPanel13.Controls.Add(this.tableLayoutPanel16, 0, 0); + this.tableLayoutPanel13.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel13.Location = new System.Drawing.Point(23, 63); + this.tableLayoutPanel13.Name = "tableLayoutPanel13"; + this.tableLayoutPanel13.RowCount = 1; + this.tableLayoutPanel13.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel13.Size = new System.Drawing.Size(908, 703); + this.tableLayoutPanel13.TabIndex = 7; + // + // tableLayoutPanel14 + // + this.tableLayoutPanel14.ColumnCount = 1; + this.tableLayoutPanel14.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel14.Controls.Add(this.label2, 0, 0); + this.tableLayoutPanel14.Controls.Add(this.tableLayoutPanel15, 0, 3); + this.tableLayoutPanel14.Controls.Add(this.flowLayoutPanel1, 0, 1); + this.tableLayoutPanel14.Controls.Add(this.tvChain, 0, 2); + this.tableLayoutPanel14.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel14.Location = new System.Drawing.Point(303, 0); + this.tableLayoutPanel14.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.tableLayoutPanel14.Name = "tableLayoutPanel14"; + this.tableLayoutPanel14.RowCount = 4; + this.tableLayoutPanel14.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel14.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel14.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85F)); + this.tableLayoutPanel14.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel14.Size = new System.Drawing.Size(605, 703); + this.tableLayoutPanel14.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Dock = System.Windows.Forms.DockStyle.Fill; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(3, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(599, 35); + this.label2.TabIndex = 5; + this.label2.Text = "Move Chain"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // tableLayoutPanel15 + // + this.tableLayoutPanel15.ColumnCount = 2; + this.tableLayoutPanel15.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); + this.tableLayoutPanel15.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel15.Controls.Add(this.tableLayoutPanel11, 0, 0); + this.tableLayoutPanel15.Controls.Add(this.btnGenerateScript, 1, 0); + this.tableLayoutPanel15.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel15.Location = new System.Drawing.Point(0, 667); + this.tableLayoutPanel15.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel15.MinimumSize = new System.Drawing.Size(0, 30); + this.tableLayoutPanel15.Name = "tableLayoutPanel15"; + this.tableLayoutPanel15.RowCount = 1; + this.tableLayoutPanel15.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel15.Size = new System.Drawing.Size(605, 36); + this.tableLayoutPanel15.TabIndex = 0; + // + // tableLayoutPanel11 + // + this.tableLayoutPanel11.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel11.ColumnCount = 2; + this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel11.Controls.Add(this.txtPath, 1, 0); + this.tableLayoutPanel11.Controls.Add(this.lblPath, 0, 0); + this.tableLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel11.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel11.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel11.Name = "tableLayoutPanel11"; + this.tableLayoutPanel11.RowCount = 1; + this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel11.Size = new System.Drawing.Size(484, 36); + this.tableLayoutPanel11.TabIndex = 6; + // + // txtPath + // + this.txtPath.Dock = System.Windows.Forms.DockStyle.Bottom; + this.txtPath.Location = new System.Drawing.Point(43, 13); + this.txtPath.Name = "txtPath"; + this.txtPath.Size = new System.Drawing.Size(438, 20); + this.txtPath.TabIndex = 1; + this.txtPath.Text = "D:\\SteamLibrary\\steamapps\\common\\Beat Saber\\UserData\\Camera2\\MovementScripts\\"; + // + // lblPath + // + this.lblPath.AutoSize = true; + this.lblPath.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblPath.Location = new System.Drawing.Point(3, 0); + this.lblPath.Name = "lblPath"; + this.lblPath.Size = new System.Drawing.Size(34, 36); + this.lblPath.TabIndex = 0; + this.lblPath.Text = "Path:"; + this.lblPath.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + this.ToolTip.SetToolTip(this.lblPath, "Only edit this if you want to change the directory/path where the file will be sa" + + "ved"); + // + // btnGenerateScript + // + this.btnGenerateScript.Location = new System.Drawing.Point(487, 3); + this.btnGenerateScript.Name = "btnGenerateScript"; + this.btnGenerateScript.Size = new System.Drawing.Size(97, 30); + this.btnGenerateScript.TabIndex = 1; + this.btnGenerateScript.Text = "Generate Script"; + this.btnGenerateScript.UseVisualStyleBackColor = true; + this.btnGenerateScript.Click += new System.EventHandler(this.btnGenerateScript_Click); + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel2); + this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel10); + this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel9); + this.flowLayoutPanel1.Controls.Add(this.tableLayoutPanel12); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 35); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel1.MinimumSize = new System.Drawing.Size(0, 30); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(605, 35); + this.flowLayoutPanel1.TabIndex = 6; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.AutoSize = true; + this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); + this.tableLayoutPanel2.Controls.Add(this.txtFileName, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.lblFileName, 0, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel2.MinimumSize = new System.Drawing.Size(0, 26); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(221, 26); + this.tableLayoutPanel2.TabIndex = 2; + // + // txtFileName + // + this.txtFileName.Location = new System.Drawing.Point(69, 3); + this.txtFileName.Name = "txtFileName"; + this.txtFileName.Size = new System.Drawing.Size(149, 20); + this.txtFileName.TabIndex = 1; + // + // lblFileName + // + this.lblFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.lblFileName.AutoSize = true; + this.lblFileName.Location = new System.Drawing.Point(3, 0); + this.lblFileName.Name = "lblFileName"; + this.lblFileName.Size = new System.Drawing.Size(54, 26); + this.lblFileName.TabIndex = 0; + this.lblFileName.Text = "File Name"; + this.lblFileName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.ToolTip.SetToolTip(this.lblFileName, "defines the name of movement script file that will be generated / added to.\r\nAdd " + + "this name to the script list in your camera script to make the camera use this s" + + "cript.\r\n"); + // + // tableLayoutPanel10 + // + this.tableLayoutPanel10.AutoSize = true; + this.tableLayoutPanel10.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel10.ColumnCount = 2; + this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel10.Controls.Add(this.lblSyncToSong, 0, 0); + this.tableLayoutPanel10.Controls.Add(this.checkSyncToSong, 1, 0); + this.tableLayoutPanel10.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel10.Location = new System.Drawing.Point(230, 3); + this.tableLayoutPanel10.MinimumSize = new System.Drawing.Size(0, 26); + this.tableLayoutPanel10.Name = "tableLayoutPanel10"; + this.tableLayoutPanel10.RowCount = 1; + this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel10.Size = new System.Drawing.Size(102, 26); + this.tableLayoutPanel10.TabIndex = 4; + // + // lblSyncToSong + // + this.lblSyncToSong.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.lblSyncToSong.AutoSize = true; + this.lblSyncToSong.Location = new System.Drawing.Point(3, 0); + this.lblSyncToSong.Name = "lblSyncToSong"; + this.lblSyncToSong.Size = new System.Drawing.Size(75, 26); + this.lblSyncToSong.TabIndex = 1; + this.lblSyncToSong.Text = "Sync To Song"; + this.lblSyncToSong.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.ToolTip.SetToolTip(this.lblSyncToSong, resources.GetString("lblSyncToSong.ToolTip")); + // + // checkSyncToSong + // + this.checkSyncToSong.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.checkSyncToSong.AutoSize = true; + this.checkSyncToSong.Checked = true; + this.checkSyncToSong.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkSyncToSong.Location = new System.Drawing.Point(84, 3); + this.checkSyncToSong.Name = "checkSyncToSong"; + this.checkSyncToSong.Size = new System.Drawing.Size(15, 20); + this.checkSyncToSong.TabIndex = 1; + this.checkSyncToSong.UseVisualStyleBackColor = true; + // + // tableLayoutPanel9 + // + this.tableLayoutPanel9.AutoSize = true; + this.tableLayoutPanel9.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel9.ColumnCount = 2; + this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel9.Controls.Add(this.lblLoop, 0, 0); + this.tableLayoutPanel9.Controls.Add(this.checkLoop, 1, 0); + this.tableLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel9.Location = new System.Drawing.Point(338, 3); + this.tableLayoutPanel9.MinimumSize = new System.Drawing.Size(0, 26); + this.tableLayoutPanel9.Name = "tableLayoutPanel9"; + this.tableLayoutPanel9.RowCount = 1; + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel9.Size = new System.Drawing.Size(58, 26); + this.tableLayoutPanel9.TabIndex = 6; + // + // lblLoop + // + this.lblLoop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.lblLoop.AutoSize = true; + this.lblLoop.Location = new System.Drawing.Point(3, 0); + this.lblLoop.Name = "lblLoop"; + this.lblLoop.Size = new System.Drawing.Size(31, 26); + this.lblLoop.TabIndex = 1; + this.lblLoop.Text = "Loop"; + this.lblLoop.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.ToolTip.SetToolTip(this.lblLoop, "On -> The movement script will repeat from the start, if the last move is finishe" + + "d.\r\nOff -> The camera will stay on the end position of the last move."); + // + // checkLoop + // + this.checkLoop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.checkLoop.AutoSize = true; + this.checkLoop.Checked = true; + this.checkLoop.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkLoop.Location = new System.Drawing.Point(40, 3); + this.checkLoop.Name = "checkLoop"; + this.checkLoop.Size = new System.Drawing.Size(15, 20); + this.checkLoop.TabIndex = 1; + this.checkLoop.UseVisualStyleBackColor = true; + // + // tableLayoutPanel12 + // + this.tableLayoutPanel12.AutoSize = true; + this.tableLayoutPanel12.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel12.ColumnCount = 2; + this.tableLayoutPanel12.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel12.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel12.Controls.Add(this.lblAddToScript, 0, 0); + this.tableLayoutPanel12.Controls.Add(this.checkAddToScript, 1, 0); + this.tableLayoutPanel12.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel12.Location = new System.Drawing.Point(402, 3); + this.tableLayoutPanel12.MinimumSize = new System.Drawing.Size(0, 26); + this.tableLayoutPanel12.Name = "tableLayoutPanel12"; + this.tableLayoutPanel12.RowCount = 1; + this.tableLayoutPanel12.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel12.Size = new System.Drawing.Size(137, 26); + this.tableLayoutPanel12.TabIndex = 5; + // + // lblAddToScript + // + this.lblAddToScript.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.lblAddToScript.AutoSize = true; + this.lblAddToScript.Location = new System.Drawing.Point(3, 0); + this.lblAddToScript.Name = "lblAddToScript"; + this.lblAddToScript.Size = new System.Drawing.Size(110, 26); + this.lblAddToScript.TabIndex = 1; + this.lblAddToScript.Text = "Add To existing Script"; + this.lblAddToScript.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.ToolTip.SetToolTip(this.lblAddToScript, resources.GetString("lblAddToScript.ToolTip")); + // + // checkAddToScript + // + this.checkAddToScript.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.checkAddToScript.AutoSize = true; + this.checkAddToScript.Location = new System.Drawing.Point(119, 3); + this.checkAddToScript.Name = "checkAddToScript"; + this.checkAddToScript.Size = new System.Drawing.Size(15, 20); + this.checkAddToScript.TabIndex = 1; + this.checkAddToScript.UseVisualStyleBackColor = true; + // + // tvChain + // + this.tvChain.Dock = System.Windows.Forms.DockStyle.Fill; + this.tvChain.Location = new System.Drawing.Point(3, 73); + this.tvChain.Name = "tvChain"; + this.tvChain.Size = new System.Drawing.Size(599, 591); + this.tvChain.TabIndex = 7; + // + // tableLayoutPanel16 + // + this.tableLayoutPanel16.ColumnCount = 1; + this.tableLayoutPanel16.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel16.Controls.Add(this.btnAddMoveToChain, 0, 3); + this.tableLayoutPanel16.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel16.Controls.Add(this.flpContent, 0, 2); + this.tableLayoutPanel16.Controls.Add(this.flowLayoutPanel2, 0, 1); + this.tableLayoutPanel16.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel16.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel16.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); + this.tableLayoutPanel16.Name = "tableLayoutPanel16"; + this.tableLayoutPanel16.RowCount = 4; + this.tableLayoutPanel16.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel16.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel16.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85F)); + this.tableLayoutPanel16.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel16.Size = new System.Drawing.Size(297, 703); + this.tableLayoutPanel16.TabIndex = 5; + // + // btnAddMoveToChain + // + this.btnAddMoveToChain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.btnAddMoveToChain.Location = new System.Drawing.Point(3, 670); + this.btnAddMoveToChain.Name = "btnAddMoveToChain"; + this.btnAddMoveToChain.Size = new System.Drawing.Size(82, 30); + this.btnAddMoveToChain.TabIndex = 2; + this.btnAddMoveToChain.Text = "Add To Chain"; + this.btnAddMoveToChain.UseVisualStyleBackColor = true; + this.btnAddMoveToChain.Click += new System.EventHandler(this.btnAddMoveToChain_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(3, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(291, 35); + this.label1.TabIndex = 4; + this.label1.Text = "Move"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // flpContent // this.flpContent.AutoScroll = true; - this.flpContent.Controls.Add(this.tableLayoutPanel4); this.flpContent.Controls.Add(this.tableLayoutPanel5); this.flpContent.Controls.Add(this.tableLayoutPanel3); this.flpContent.Controls.Add(this.tableLayoutPanel7); this.flpContent.Controls.Add(this.tableLayoutPanel6); this.flpContent.Controls.Add(this.tableLayoutPanel8); - this.flpContent.Controls.Add(this.tableLayoutPanel2); this.flpContent.Controls.Add(this.tlContent); - this.flpContent.Controls.Add(this.tableLayoutPanel10); - this.flpContent.Controls.Add(this.tableLayoutPanel12); - this.flpContent.Controls.Add(this.tableLayoutPanel9); - this.flpContent.Location = new System.Drawing.Point(41, 84); + this.flpContent.Dock = System.Windows.Forms.DockStyle.Fill; + this.flpContent.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flpContent.Location = new System.Drawing.Point(0, 70); + this.flpContent.Margin = new System.Windows.Forms.Padding(0); this.flpContent.Name = "flpContent"; - this.flpContent.Size = new System.Drawing.Size(301, 642); + this.flpContent.Size = new System.Drawing.Size(297, 597); this.flpContent.TabIndex = 3; - // - // tableLayoutPanel4 - // - this.tableLayoutPanel4.ColumnCount = 2; - this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); - this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); - this.tableLayoutPanel4.Controls.Add(this.cbType, 1, 0); - this.tableLayoutPanel4.Controls.Add(this.lblType, 0, 0); - this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 3); - this.tableLayoutPanel4.MinimumSize = new System.Drawing.Size(0, 26); - this.tableLayoutPanel4.Name = "tableLayoutPanel4"; - this.tableLayoutPanel4.RowCount = 1; - this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel4.Size = new System.Drawing.Size(295, 26); - this.tableLayoutPanel4.TabIndex = 1; - // - // cbType - // - this.cbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbType.FormattingEnabled = true; - this.cbType.Items.AddRange(new object[] { - "circle around player"}); - this.cbType.Location = new System.Drawing.Point(91, 3); - this.cbType.Name = "cbType"; - this.cbType.Size = new System.Drawing.Size(121, 21); - this.cbType.TabIndex = 1; - this.cbType.SelectedIndexChanged += new System.EventHandler(this.cbType_SelectedIndexChanged); - // - // lblType - // - this.lblType.AutoSize = true; - this.lblType.Location = new System.Drawing.Point(3, 0); - this.lblType.Name = "lblType"; - this.lblType.Size = new System.Drawing.Size(64, 13); - this.lblType.TabIndex = 1; - this.lblType.Text = "Move Type:"; + this.flpContent.WrapContents = false; // // tableLayoutPanel5 // this.tableLayoutPanel5.ColumnCount = 2; - this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); - this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45.29617F)); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 54.70383F)); this.tableLayoutPanel5.Controls.Add(this.lblMoveDescriptionTitle, 0, 0); - this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 35); + this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel5.MinimumSize = new System.Drawing.Size(0, 26); this.tableLayoutPanel5.Name = "tableLayoutPanel5"; this.tableLayoutPanel5.RowCount = 1; this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel5.Size = new System.Drawing.Size(295, 26); + this.tableLayoutPanel5.Size = new System.Drawing.Size(284, 26); this.tableLayoutPanel5.TabIndex = 28; // // lblMoveDescriptionTitle @@ -184,7 +520,7 @@ private void InitializeComponent() this.lblMoveDescriptionTitle.AutoSize = true; this.lblMoveDescriptionTitle.Location = new System.Drawing.Point(3, 0); this.lblMoveDescriptionTitle.Name = "lblMoveDescriptionTitle"; - this.lblMoveDescriptionTitle.Size = new System.Drawing.Size(82, 26); + this.lblMoveDescriptionTitle.Size = new System.Drawing.Size(122, 13); this.lblMoveDescriptionTitle.TabIndex = 24; this.lblMoveDescriptionTitle.Text = "Move Description:"; // @@ -195,12 +531,12 @@ private void InitializeComponent() this.tableLayoutPanel3.ColumnCount = 2; this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); - this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 80); + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 35); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 1F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(0, 0); + this.tableLayoutPanel3.Size = new System.Drawing.Size(284, 0); this.tableLayoutPanel3.TabIndex = 13; // // tableLayoutPanel7 @@ -212,13 +548,13 @@ private void InitializeComponent() this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel7.Controls.Add(this.lblMoveDescription, 0, 0); this.tableLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel7.Location = new System.Drawing.Point(9, 67); - this.tableLayoutPanel7.MaximumSize = new System.Drawing.Size(300, 0); + this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 41); + this.tableLayoutPanel7.MaximumSize = new System.Drawing.Size(285, 0); this.tableLayoutPanel7.MinimumSize = new System.Drawing.Size(0, 26); this.tableLayoutPanel7.Name = "tableLayoutPanel7"; this.tableLayoutPanel7.RowCount = 1; this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel7.Size = new System.Drawing.Size(251, 26); + this.tableLayoutPanel7.Size = new System.Drawing.Size(284, 26); this.tableLayoutPanel7.TabIndex = 31; // // lblMoveDescription @@ -229,9 +565,9 @@ private void InitializeComponent() this.lblMoveDescription.MaximumSize = new System.Drawing.Size(290, 0); this.lblMoveDescription.Name = "lblMoveDescription"; this.lblMoveDescription.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); - this.lblMoveDescription.Size = new System.Drawing.Size(245, 26); + this.lblMoveDescription.Size = new System.Drawing.Size(278, 26); this.lblMoveDescription.TabIndex = 25; - this.lblMoveDescription.Text = "Description Text that is here if no description exists"; + this.lblMoveDescription.Text = "Description Placeholder"; // // tableLayoutPanel6 // @@ -239,13 +575,14 @@ private void InitializeComponent() this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); this.tableLayoutPanel6.Controls.Add(this.lblSettingsTitle, 0, 0); - this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 99); + this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 73); this.tableLayoutPanel6.MinimumSize = new System.Drawing.Size(0, 26); this.tableLayoutPanel6.Name = "tableLayoutPanel6"; this.tableLayoutPanel6.RowCount = 1; this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel6.Size = new System.Drawing.Size(295, 26); + this.tableLayoutPanel6.Size = new System.Drawing.Size(284, 26); this.tableLayoutPanel6.TabIndex = 29; // // lblSettingsTitle @@ -263,63 +600,25 @@ private void InitializeComponent() this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel8.Controls.Add(this.lblDescription, 0, 0); - this.tableLayoutPanel8.Location = new System.Drawing.Point(3, 131); + this.tableLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel8.Location = new System.Drawing.Point(3, 105); + this.tableLayoutPanel8.MaximumSize = new System.Drawing.Size(285, 0); this.tableLayoutPanel8.MinimumSize = new System.Drawing.Size(0, 26); this.tableLayoutPanel8.Name = "tableLayoutPanel8"; this.tableLayoutPanel8.RowCount = 1; this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel8.Size = new System.Drawing.Size(287, 26); + this.tableLayoutPanel8.Size = new System.Drawing.Size(284, 26); this.tableLayoutPanel8.TabIndex = 32; // // lblDescription // + this.lblDescription.Dock = System.Windows.Forms.DockStyle.Fill; this.lblDescription.Location = new System.Drawing.Point(3, 0); this.lblDescription.Name = "lblDescription"; - this.lblDescription.Size = new System.Drawing.Size(281, 26); + this.lblDescription.Size = new System.Drawing.Size(278, 26); this.lblDescription.TabIndex = 11; this.lblDescription.Text = "Descriptions to the settings can be found when hovering over the corresponding la" + "bels.\r\n"; - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.AutoSize = true; - this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel2.ColumnCount = 2; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); - this.tableLayoutPanel2.Controls.Add(this.txtName, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.lblName, 0, 0); - this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 163); - this.tableLayoutPanel2.MinimumSize = new System.Drawing.Size(0, 26); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 1; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(221, 26); - this.tableLayoutPanel2.TabIndex = 2; - // - // txtName - // - this.txtName.Location = new System.Drawing.Point(69, 3); - this.txtName.Name = "txtName"; - this.txtName.Size = new System.Drawing.Size(149, 20); - this.txtName.TabIndex = 1; - // - // lblName - // - this.lblName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.lblName.AutoSize = true; - this.lblName.Location = new System.Drawing.Point(3, 0); - this.lblName.Name = "lblName"; - this.lblName.Size = new System.Drawing.Size(54, 26); - this.lblName.TabIndex = 0; - this.lblName.Text = "File Name"; - this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.ToolTip.SetToolTip(this.lblName, "defines the name of movement script file that will be generated / added to.\r\nAdd " + - "this name to the script list in your camera script to make the camera use this s" + - "cript.\r\n"); // // tlContent // @@ -330,7 +629,7 @@ private void InitializeComponent() this.tlContent.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tlContent.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tlContent.Dock = System.Windows.Forms.DockStyle.Fill; - this.tlContent.Location = new System.Drawing.Point(0, 192); + this.tlContent.Location = new System.Drawing.Point(0, 134); this.tlContent.Margin = new System.Windows.Forms.Padding(0); this.tlContent.MaximumSize = new System.Drawing.Size(295, 0); this.tlContent.MinimumSize = new System.Drawing.Size(290, 100); @@ -342,156 +641,92 @@ private void InitializeComponent() this.tlContent.Size = new System.Drawing.Size(290, 100); this.tlContent.TabIndex = 3; // - // tableLayoutPanel10 + // flowLayoutPanel2 // - this.tableLayoutPanel10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel10.AutoSize = true; - this.tableLayoutPanel10.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel10.ColumnCount = 2; - this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); - this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); - this.tableLayoutPanel10.Controls.Add(this.lblSyncToSong, 0, 0); - this.tableLayoutPanel10.Controls.Add(this.checkSyncToSong, 1, 0); - this.tableLayoutPanel10.Location = new System.Drawing.Point(3, 295); - this.tableLayoutPanel10.MinimumSize = new System.Drawing.Size(0, 26); - this.tableLayoutPanel10.Name = "tableLayoutPanel10"; - this.tableLayoutPanel10.RowCount = 1; - this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel10.Size = new System.Drawing.Size(270, 26); - this.tableLayoutPanel10.TabIndex = 4; - // - // lblSyncToSong - // - this.lblSyncToSong.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.lblSyncToSong.AutoSize = true; - this.lblSyncToSong.Location = new System.Drawing.Point(3, 0); - this.lblSyncToSong.Name = "lblSyncToSong"; - this.lblSyncToSong.Size = new System.Drawing.Size(75, 26); - this.lblSyncToSong.TabIndex = 1; - this.lblSyncToSong.Text = "Sync To Song"; - this.lblSyncToSong.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.ToolTip.SetToolTip(this.lblSyncToSong, resources.GetString("lblSyncToSong.ToolTip")); - // - // checkSyncToSong + this.flowLayoutPanel2.Controls.Add(this.tableLayoutPanel4); + this.flowLayoutPanel2.Controls.Add(this.tableLayoutPanel17); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 35); + this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(297, 35); + this.flowLayoutPanel2.TabIndex = 5; // - this.checkSyncToSong.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.checkSyncToSong.AutoSize = true; - this.checkSyncToSong.Checked = true; - this.checkSyncToSong.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkSyncToSong.Location = new System.Drawing.Point(84, 3); - this.checkSyncToSong.Name = "checkSyncToSong"; - this.checkSyncToSong.Size = new System.Drawing.Size(15, 20); - this.checkSyncToSong.TabIndex = 1; - this.checkSyncToSong.UseVisualStyleBackColor = true; - // - // tableLayoutPanel12 - // - this.tableLayoutPanel12.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel12.ColumnCount = 2; - this.tableLayoutPanel12.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); - this.tableLayoutPanel12.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); - this.tableLayoutPanel12.Controls.Add(this.lblAddToScript, 0, 0); - this.tableLayoutPanel12.Controls.Add(this.checkAddToScript, 1, 0); - this.tableLayoutPanel12.Location = new System.Drawing.Point(3, 327); - this.tableLayoutPanel12.MinimumSize = new System.Drawing.Size(0, 26); - this.tableLayoutPanel12.Name = "tableLayoutPanel12"; - this.tableLayoutPanel12.RowCount = 1; - this.tableLayoutPanel12.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel12.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel12.Size = new System.Drawing.Size(295, 26); - this.tableLayoutPanel12.TabIndex = 5; - // - // lblAddToScript - // - this.lblAddToScript.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.lblAddToScript.AutoSize = true; - this.lblAddToScript.Location = new System.Drawing.Point(3, 0); - this.lblAddToScript.Name = "lblAddToScript"; - this.lblAddToScript.Size = new System.Drawing.Size(80, 26); - this.lblAddToScript.TabIndex = 1; - this.lblAddToScript.Text = "Add To existing Script"; - this.lblAddToScript.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.ToolTip.SetToolTip(this.lblAddToScript, resources.GetString("lblAddToScript.ToolTip")); - // - // checkAddToScript - // - this.checkAddToScript.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.checkAddToScript.AutoSize = true; - this.checkAddToScript.Location = new System.Drawing.Point(91, 3); - this.checkAddToScript.Name = "checkAddToScript"; - this.checkAddToScript.Size = new System.Drawing.Size(15, 20); - this.checkAddToScript.TabIndex = 1; - this.checkAddToScript.UseVisualStyleBackColor = true; - // - // tableLayoutPanel9 - // - this.tableLayoutPanel9.ColumnCount = 2; - this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); - this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); - this.tableLayoutPanel9.Controls.Add(this.btnGenerate, 0, 0); - this.tableLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel9.Location = new System.Drawing.Point(3, 359); - this.tableLayoutPanel9.MinimumSize = new System.Drawing.Size(0, 26); - this.tableLayoutPanel9.Name = "tableLayoutPanel9"; - this.tableLayoutPanel9.RowCount = 1; - this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel9.Size = new System.Drawing.Size(295, 26); - this.tableLayoutPanel9.TabIndex = 6; - // - // btnGenerate - // - this.btnGenerate.Location = new System.Drawing.Point(3, 3); - this.btnGenerate.Name = "btnGenerate"; - this.btnGenerate.Size = new System.Drawing.Size(82, 20); - this.btnGenerate.TabIndex = 1; - this.btnGenerate.Text = "Generate Script"; - this.btnGenerate.UseVisualStyleBackColor = true; - this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click); - // - // tableLayoutPanel11 + // tableLayoutPanel4 // - this.tableLayoutPanel11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel11.ColumnCount = 2; - this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 17.9402F)); - this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 82.0598F)); - this.tableLayoutPanel11.Controls.Add(this.txtPath, 1, 0); - this.tableLayoutPanel11.Controls.Add(this.lblPath, 0, 0); - this.tableLayoutPanel11.Location = new System.Drawing.Point(41, 757); - this.tableLayoutPanel11.Name = "tableLayoutPanel11"; - this.tableLayoutPanel11.RowCount = 1; - this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); - this.tableLayoutPanel11.Size = new System.Drawing.Size(301, 26); - this.tableLayoutPanel11.TabIndex = 6; + this.tableLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel4.ColumnCount = 2; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.Controls.Add(this.cbType, 1, 0); + this.tableLayoutPanel4.Controls.Add(this.lblType, 0, 0); + this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel4.MinimumSize = new System.Drawing.Size(0, 30); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 1; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Size = new System.Drawing.Size(135, 30); + this.tableLayoutPanel4.TabIndex = 1; // - // txtPath + // cbType // - this.txtPath.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtPath.Location = new System.Drawing.Point(57, 3); - this.txtPath.Name = "txtPath"; - this.txtPath.Size = new System.Drawing.Size(241, 20); - this.txtPath.TabIndex = 1; - this.txtPath.Text = "D:\\SteamLibrary\\steamapps\\common\\Beat Saber\\UserData\\Camera2\\MovementScripts\\"; + this.cbType.Dock = System.Windows.Forms.DockStyle.Fill; + this.cbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbType.FormattingEnabled = true; + this.cbType.Items.AddRange(new object[] { + "circle around player"}); + this.cbType.Location = new System.Drawing.Point(43, 3); + this.cbType.Name = "cbType"; + this.cbType.Size = new System.Drawing.Size(90, 21); + this.cbType.TabIndex = 1; + this.cbType.SelectedIndexChanged += new System.EventHandler(this.cbType_SelectedIndexChanged); // - // lblPath + // lblType // - this.lblPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.lblPath.AutoSize = true; - this.lblPath.Location = new System.Drawing.Point(3, 0); - this.lblPath.Name = "lblPath"; - this.lblPath.Size = new System.Drawing.Size(29, 26); - this.lblPath.TabIndex = 0; - this.lblPath.Text = "Path"; - this.lblPath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.ToolTip.SetToolTip(this.lblPath, "Only edit this if you want to change the directory/path where the file will be sa" + - "ved"); + this.lblType.AutoSize = true; + this.lblType.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblType.Location = new System.Drawing.Point(3, 0); + this.lblType.Name = "lblType"; + this.lblType.Size = new System.Drawing.Size(34, 30); + this.lblType.TabIndex = 1; + this.lblType.Text = "Type:"; + this.lblType.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // tableLayoutPanel17 + // + this.tableLayoutPanel17.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel17.ColumnCount = 2; + this.tableLayoutPanel17.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel17.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel17.Controls.Add(this.txtMoveName, 0, 0); + this.tableLayoutPanel17.Controls.Add(this.lblMoveName, 0, 0); + this.tableLayoutPanel17.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel17.Location = new System.Drawing.Point(144, 3); + this.tableLayoutPanel17.MinimumSize = new System.Drawing.Size(0, 30); + this.tableLayoutPanel17.Name = "tableLayoutPanel17"; + this.tableLayoutPanel17.RowCount = 1; + this.tableLayoutPanel17.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel17.Size = new System.Drawing.Size(150, 30); + this.tableLayoutPanel17.TabIndex = 2; + // + // txtMoveName + // + this.txtMoveName.Location = new System.Drawing.Point(47, 3); + this.txtMoveName.Name = "txtMoveName"; + this.txtMoveName.Size = new System.Drawing.Size(102, 20); + this.txtMoveName.TabIndex = 2; + // + // lblMoveName + // + this.lblMoveName.AutoSize = true; + this.lblMoveName.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblMoveName.Location = new System.Drawing.Point(3, 0); + this.lblMoveName.Name = "lblMoveName"; + this.lblMoveName.Size = new System.Drawing.Size(38, 30); + this.lblMoveName.TabIndex = 1; + this.lblMoveName.Text = "Name:"; + this.lblMoveName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // ToolTip // @@ -504,19 +739,34 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(384, 811); + this.ClientSize = new System.Drawing.Size(954, 811); this.Controls.Add(this.tableLayoutPanel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximumSize = new System.Drawing.Size(400, 1000); - this.MinimumSize = new System.Drawing.Size(400, 500); + this.MinimumSize = new System.Drawing.Size(970, 100); this.Name = "Main"; this.Text = "MovementScriptGenerator"; this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + this.tableLayoutPanel13.ResumeLayout(false); + this.tableLayoutPanel14.ResumeLayout(false); + this.tableLayoutPanel14.PerformLayout(); + this.tableLayoutPanel15.ResumeLayout(false); + this.tableLayoutPanel11.ResumeLayout(false); + this.tableLayoutPanel11.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this.tableLayoutPanel10.ResumeLayout(false); + this.tableLayoutPanel10.PerformLayout(); + this.tableLayoutPanel9.ResumeLayout(false); + this.tableLayoutPanel9.PerformLayout(); + this.tableLayoutPanel12.ResumeLayout(false); + this.tableLayoutPanel12.PerformLayout(); + this.tableLayoutPanel16.ResumeLayout(false); + this.tableLayoutPanel16.PerformLayout(); this.flpContent.ResumeLayout(false); this.flpContent.PerformLayout(); - this.tableLayoutPanel4.ResumeLayout(false); - this.tableLayoutPanel4.PerformLayout(); this.tableLayoutPanel5.ResumeLayout(false); this.tableLayoutPanel5.PerformLayout(); this.tableLayoutPanel7.ResumeLayout(false); @@ -524,15 +774,11 @@ private void InitializeComponent() this.tableLayoutPanel6.ResumeLayout(false); this.tableLayoutPanel6.PerformLayout(); this.tableLayoutPanel8.ResumeLayout(false); - this.tableLayoutPanel2.ResumeLayout(false); - this.tableLayoutPanel2.PerformLayout(); - this.tableLayoutPanel10.ResumeLayout(false); - this.tableLayoutPanel10.PerformLayout(); - this.tableLayoutPanel12.ResumeLayout(false); - this.tableLayoutPanel12.PerformLayout(); - this.tableLayoutPanel9.ResumeLayout(false); - this.tableLayoutPanel11.ResumeLayout(false); - this.tableLayoutPanel11.PerformLayout(); + this.flowLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); + this.tableLayoutPanel17.ResumeLayout(false); + this.tableLayoutPanel17.PerformLayout(); this.ResumeLayout(false); } @@ -546,9 +792,9 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox cbType; private System.Windows.Forms.Label lblSettingsTitle; private System.Windows.Forms.ToolTip ToolTip; - private System.Windows.Forms.Label lblName; - private System.Windows.Forms.TextBox txtName; - private System.Windows.Forms.Button btnGenerate; + private System.Windows.Forms.Label lblFileName; + private System.Windows.Forms.TextBox txtFileName; + private System.Windows.Forms.Button btnGenerateScript; private System.Windows.Forms.Label lblDescription; private System.Windows.Forms.Label lblPath; private System.Windows.Forms.TextBox txtPath; @@ -566,10 +812,25 @@ private void InitializeComponent() private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel8; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel9; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel12; private System.Windows.Forms.Label lblAddToScript; private System.Windows.Forms.CheckBox checkAddToScript; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel13; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel14; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel15; + private System.Windows.Forms.Button btnAddMoveToChain; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel16; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel9; + private System.Windows.Forms.Label lblLoop; + private System.Windows.Forms.CheckBox checkLoop; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel17; + private System.Windows.Forms.TextBox txtMoveName; + private System.Windows.Forms.Label lblMoveName; + private System.Windows.Forms.TreeView tvChain; } } diff --git a/MovementScriptGenerator/Form1.cs b/MovementScriptGenerator/Form1.cs index 26d15ec..c3ac04e 100644 --- a/MovementScriptGenerator/Form1.cs +++ b/MovementScriptGenerator/Form1.cs @@ -1,12 +1,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; using MovementScriptGenerator.Modules; using Newtonsoft.Json; @@ -18,6 +13,13 @@ public partial class Main : Form CircleControl circleControl = new CircleControl(); SpiralControl spiralControl = new SpiralControl(); + private static readonly char[] illegalCharsForExplorer = "/<>:/\\\"|?*".ToCharArray(); + + Chain chain = new Chain() + { + Elements = new List() + }; + List moveTypes = new List() { "circle", @@ -35,23 +37,24 @@ public partial class Main : Form public Main() { InitializeComponent(); - initializeComboBoxes(); - updateDescription(); - updateContent(); + InitializeComboBoxes(); + UpdateDescription(); + UpdateContent(); + UpdateChainWindow(); } - private void initializeComboBoxes() + private void InitializeComboBoxes() { cbType.DataSource = moveTypes; cbType.SelectedIndex = 0; } - private void updateDescription() + private void UpdateDescription() { lblMoveDescription.Text = moveDescriptions[cbType.SelectedIndex]; } - private void updateContent() + private void UpdateContent() { tlContent.Controls.Clear(); switch (cbType.SelectedIndex) @@ -65,11 +68,30 @@ private void updateContent() } } - private bool GenerateMovementScriptFile(MovementScript script, string path) + private void UpdateChainWindow() + { + foreach(ChainElement el in chain.Elements) + { + tvChain.BeginUpdate(); + tvChain.Nodes.Clear(); + tvChain.Nodes.Add(el.Name); + tvChain.EndUpdate(); + } + } + + private bool GenerateMovementScriptFile(MovementScript script, string filePath) { + if (File.Exists(filePath)) + { + if(MessageBox.Show("A file with the given name already exists.\nWould you like to overwrite that file?", "Overwrite existing File", MessageBoxButtons.YesNo) == DialogResult.No) + { + return false; + } + } + try { - using (StreamWriter file = File.CreateText(path)) + using (StreamWriter file = File.CreateText(filePath)) { JsonSerializer serializer = new JsonSerializer(); serializer.Formatting = Formatting.Indented; @@ -80,31 +102,31 @@ private bool GenerateMovementScriptFile(MovementScript script, string path) } catch { - MessageBox.Show($"File could not be generated.\nPlease dont use any special characters in the file name"); + MessageBox.Show($"Something went wrong while generating the file.\nPlease make sure that the file name and file path are viable and don't contain any not allowed characters."); return false; } } - private bool AddToMovementScriptFile(MovementScript script, string path) + private bool AddToMovementScriptFile(MovementScript script, string filePath) { JsonSerializer serializer = new JsonSerializer(); - if (!File.Exists(path)) + if (!File.Exists(filePath)) { MessageBox.Show("File doesn't exist!"); return false; } - string previousFileContent = File.ReadAllText(path); + string previousFileContent = File.ReadAllText(filePath); try { MovementScript previousMovementScript = JsonConvert.DeserializeObject(previousFileContent); - script.frames.InsertRange(0, previousMovementScript.frames); + script.Frames.InsertRange(0, previousMovementScript.Frames); - using (StreamWriter file = File.CreateText(path)) + using (StreamWriter file = File.CreateText(filePath)) { serializer.Formatting = Formatting.Indented; @@ -120,50 +142,102 @@ private bool AddToMovementScriptFile(MovementScript script, string path) }; } - private void btnGenerate_Click(object sender, EventArgs e) + private void cbType_SelectedIndexChanged(object sender, EventArgs e) { - string filePath = $@"{txtPath.Text}{txtName.Text}.Json"; + UpdateDescription(); + UpdateContent(); + } - if (txtName.Text.Replace(" ", String.Empty) == "") + private void btnAddMoveToChain_Click(object sender, EventArgs e) + { + string moveName = txtMoveName.Text; + if (moveName.Replace(" ", String.Empty) == "") { - MessageBox.Show("Filename is missing!"); - txtName.Focus(); - return; + moveName = null; } - MovementScript movementScript = new MovementScript(); - switch (cbType.SelectedIndex) { case 0: - movementScript = circleControl.CreateMovementScript(); + Circle circle = circleControl.CreateMove(moveName); + chain.Elements.Add(circle); break; case 1: - movementScript = spiralControl.CreateMovementScript(); + Spiral spiral = spiralControl.CreateMove(moveName); + chain.Elements.Add(spiral); break; } - movementScript.syncToSong = checkSyncToSong.Checked; + tvChain.Nodes.Add(chain.Elements.Last().Name); + } + + private void btnGenerateScript_Click(object sender, EventArgs e) + { + string filePath = $@"{txtPath.Text}{txtFileName.Text}.Json"; + + if (txtFileName.Text.Replace(" ", String.Empty) == "") + { + MessageBox.Show("Filename is missing!"); + txtFileName.Focus(); + return; + } + + if (txtFileName.Text.IndexOfAny(illegalCharsForExplorer) != -1) + { + MessageBox.Show($"Couldn't generate the file because there are not allowed special characters in the filename.\nPlease make sure to not use any of these characters:\n{new string(illegalCharsForExplorer)}"); + return; + } + + if (filePath.IndexOfAny(Path.GetInvalidPathChars()) != -1) + { + MessageBox.Show($"Couldn't generate the file because the file path is invalid.\nPlease check that the file path is correct and pointing to the right folder."); + return; + } + + if (!Directory.Exists(txtPath.Text)) + { + MessageBox.Show("Couldn't find a directory at the given path.\nPlease make sure that the path points to an existsing directory on your device."); + return; + } + + if(chain.Elements.Count <= 0) + { + MessageBox.Show("Can't create a movement script without any moves.\nPlease add moves to the chain before trying to generate a movement script."); + return; + } + + List scriptFrames = new List(); + + foreach (ChainElement chainEl in chain.Elements) + { + if (chainEl is Move moveEl) + { + List moveFrames = moveEl.GenerateFrames(); + scriptFrames.AddRange(moveFrames); + } + } + + MovementScript movementScript = new MovementScript() + { + Frames = scriptFrames, + SyncToSong = checkSyncToSong.Checked, + Loop = checkLoop.Checked + }; + if (checkAddToScript.Checked) { - if(AddToMovementScriptFile(movementScript, filePath)) + if (AddToMovementScriptFile(movementScript, filePath)) { - MessageBox.Show("Move added to MovementScript"); + MessageBox.Show("Chain added to Movement Script"); }; } else { - if(GenerateMovementScriptFile(movementScript, filePath)) + if (GenerateMovementScriptFile(movementScript, filePath)) { MessageBox.Show("Movement Script generated"); }; } } - - private void cbType_SelectedIndexChanged(object sender, EventArgs e) - { - updateDescription(); - updateContent(); - } } } diff --git a/MovementScriptGenerator/Form1.resx b/MovementScriptGenerator/Form1.resx index 5f13cf2..167a161 100644 --- a/MovementScriptGenerator/Form1.resx +++ b/MovementScriptGenerator/Form1.resx @@ -127,11 +127,12 @@ Off -> the script will start playing at the start of the song and not stop in (this has no effect on if the script will play in the normal menu / outside of songs) - On -> if a file with the given name exists, the move will be added to that file. Useful to chain moves together. -Will overwrite the "Sync To Song" of the existing file! + On -> if a movement script file with the given name exists, the moves will be added to that files moves. +Will overwrite the "Sync To Song" and "Loop" options of the existing file! (Make sure that the file is a MovementScript File!) -Off -> A new file will be created for the move. If a file with the same name exists, that file will be overwritten! +Off -> A new movement script file will be created for the move. +If a file with the same name exists, that file will be overwritten! diff --git a/MovementScriptGenerator/Modules/Chain.cs b/MovementScriptGenerator/Modules/Chain.cs new file mode 100644 index 0000000..9b2cc28 --- /dev/null +++ b/MovementScriptGenerator/Modules/Chain.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace MovementScriptGenerator.Modules +{ + public class Chain + { + public List Elements { get; set; } + } +} diff --git a/MovementScriptGenerator/Modules/ChainElement.cs b/MovementScriptGenerator/Modules/ChainElement.cs new file mode 100644 index 0000000..61a1d96 --- /dev/null +++ b/MovementScriptGenerator/Modules/ChainElement.cs @@ -0,0 +1,12 @@ + +namespace MovementScriptGenerator.Modules +{ + public class ChainElement + { + public ChainElement(string name) + { + Name = name; + } + public string Name { get; set; } + } +} diff --git a/MovementScriptGenerator/Modules/Frame.cs b/MovementScriptGenerator/Modules/Frame.cs index 835c670..28ffc98 100644 --- a/MovementScriptGenerator/Modules/Frame.cs +++ b/MovementScriptGenerator/Modules/Frame.cs @@ -1,18 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace MovementScriptGenerator.Modules { public class Frame { - public Position position { get; set; } - public Rotation rotation { get; set; } - public float duration { get; set; } - public float holdTime { get; set; } - public string transition { get; set; } - public float fov { get; set; } + public Position Position { get; set; } + public Rotation Rotation { get; set; } + public float Duration { get; set; } + public float HoldTime { get; set; } + public string Transition { get; set; } + public float Fov { get; set; } } } diff --git a/MovementScriptGenerator/Modules/Move.cs b/MovementScriptGenerator/Modules/Move.cs new file mode 100644 index 0000000..413ef99 --- /dev/null +++ b/MovementScriptGenerator/Modules/Move.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace MovementScriptGenerator.Modules +{ + public abstract class Move : ChainElement + { + + public Move(string name, int fov, float duration, float height) : base(name) + { + Fov = fov; + Duration = duration; + Height = height; + } + + public int Fov { get; set; } + public float Duration { get; set; } + public float Height { get; set; } + + public abstract List GenerateFrames(); + + } +} diff --git a/MovementScriptGenerator/Modules/MovementScript.cs b/MovementScriptGenerator/Modules/MovementScript.cs index 100f945..224d724 100644 --- a/MovementScriptGenerator/Modules/MovementScript.cs +++ b/MovementScriptGenerator/Modules/MovementScript.cs @@ -1,14 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace MovementScriptGenerator.Modules { public class MovementScript { - public bool syncToSong { get; set; } - public List frames { get; set; } + public bool SyncToSong { get; set; } + + public bool Loop { get; set; } + public List Frames { get; set; } } } diff --git a/MovementScriptGenerator/Modules/Moves/Circle.cs b/MovementScriptGenerator/Modules/Moves/Circle.cs new file mode 100644 index 0000000..145ab3b --- /dev/null +++ b/MovementScriptGenerator/Modules/Moves/Circle.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using MovementScriptGenerator.Modules; + +namespace MovementScriptGenerator +{ + public class Circle : Move + { + private float rotX; + private float rotZ; + private float distance; + private float startingPointDegree; + private float sectorDegrees; + private int iterations; + private bool rotateClockwise; + public Circle( + string name, + int fov, + float duration, + float height, + float rotX, + float rotZ, + float distance, + float startingPointDegree, + float sectorDegrees, + int iterations, + bool rotateClockwise) : base(name, fov, duration, height) + { + Name = name ?? "circleMove"; + Fov = fov; + Duration = duration; + Height = height; + this.rotX = rotX; + this.rotZ = rotZ; + this.distance = distance; + this.startingPointDegree = startingPointDegree; + this.sectorDegrees = sectorDegrees; + this.iterations = iterations; + this.rotateClockwise = rotateClockwise; + } + public override List GenerateFrames() + { + List frames = new List(); + + float initialDegree = 0; + float maxDegrees = sectorDegrees - 1; + float initialDegreeAddend = 1; + + if (!rotateClockwise) { + initialDegree *= -1; + maxDegrees *= -1; + initialDegreeAddend *= -1; + } + + for (float i = initialDegree; (rotateClockwise && i <= maxDegrees) || (!rotateClockwise && i >= maxDegrees); i += (float)initialDegreeAddend / iterations) + { + float usedDegree = i + startingPointDegree; + double radiant = usedDegree * Math.PI / 180; + + Frame frame = new Frame(); + frame.Position = new Position(); + frame.Rotation = new Rotation(); + + frame.Position.X = (float)Math.Sin(radiant) * distance; + frame.Position.Y = Height; + frame.Position.Z = (float)Math.Cos(radiant) * distance; + + frame.Rotation.Z = rotZ; + frame.Rotation.X = rotX; + frame.Rotation.Y = usedDegree -180; + + if (usedDegree == 0 || usedDegree == 180 || usedDegree == 360) + { + frame.Position.X = 0; + } + if (usedDegree == 90 || usedDegree == 270) + { + frame.Position.Z = 0; + } + + + frame.Duration = Duration / Math.Abs(maxDegrees) / iterations; + + if(Fov > 0) + { + frame.Fov = Fov; + } + + frames.Add(frame); + } + + return frames; + } + } +} diff --git a/MovementScriptGenerator/Modules/Moves/Spiral.cs b/MovementScriptGenerator/Modules/Moves/Spiral.cs new file mode 100644 index 0000000..007d83a --- /dev/null +++ b/MovementScriptGenerator/Modules/Moves/Spiral.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using MovementScriptGenerator.Modules; + +namespace MovementScriptGenerator +{ + public class Spiral : Move + { + private float startDistance; + private float endDistance; + private float horizontalRot; + private float verticalRot; + private float spiralAmmount; + private bool spiralClockwise; + private float startHold; + private float endHold; + private bool ease; + public Spiral( + string name, + int fov, + float duration, + float height, + float startDistance, + float endDistance, + float horizontalRot, + float verticalRot, + int spiralAmmount, + bool spiralClockwise, + float startHold, + float endHold, + bool ease) : base(name, fov, duration, height) + { + Name = name ?? "spiralMove"; + Fov = fov; + Duration = duration; + Height = height; + this.startDistance = startDistance; + this.endDistance = endDistance; + this.horizontalRot = horizontalRot; + this.verticalRot = verticalRot; + this.spiralAmmount = spiralAmmount; + this.spiralClockwise = spiralClockwise; + this.startHold = startHold; + this.endHold = endHold; + this.ease = ease; + } + public override List GenerateFrames() + { + List frames = new List(); + + double horizontalRadiant = horizontalRot * Math.PI / 180; + + float xHorizontal = (float)Math.Sin(horizontalRadiant); + float zHorizontal = (float)Math.Cos(horizontalRadiant); + + double verticalRadiant = verticalRot * Math.PI / 180; + + float yVertical = (float)Math.Sin(verticalRadiant); + float zVertical = (float)Math.Cos(verticalRadiant); + + float pathLength = startDistance - endDistance; + float spiralLength = pathLength / spiralAmmount; + + switch (horizontalRot) + { + case 0: + zHorizontal = 1; + break; + case 90: + case -90: + case 270: + case -270: + zHorizontal = 0; + break; + case 180: + case -180: + case 360: + case -360: + xHorizontal = 0; + break; + } + + switch (verticalRot) + { + case 0: + yVertical = 0; + break; + case 90: + case -90: + case 270: + case -270: + zVertical = 0; + break; + } + + Frame startFrame = new Frame() + { + Position = new Position() + { + X = xHorizontal * zVertical * startDistance, + Y = yVertical * startDistance + Height, + Z = zHorizontal * zVertical * startDistance + }, + + Rotation = new Rotation() + { + X = verticalRot, + Y = horizontalRot - 180, + Z = 0 + }, + + HoldTime = startHold, + + Fov = Fov + }; + frames.Add(startFrame); + + for(int i = 0; i < spiralAmmount; i++) + { + List spiralFrames = new List(); + + float SpiralStartDistance = startDistance - (i*spiralLength); + float spiralHalfwayDistance = SpiralStartDistance - (spiralLength / 2); + float spiralEndDistance = spiralHalfwayDistance - (spiralLength / 2); + + for(int rotation = 1; rotation < 360; rotation++) + { + float spiralFrameDistance = SpiralStartDistance - (spiralLength / 360 * rotation); + + Frame spiralFrame = new Frame() + { + Position = new Position() + { + X = xHorizontal * zVertical * spiralFrameDistance, + Y = yVertical * spiralFrameDistance + Height, + Z = zHorizontal * zVertical * spiralFrameDistance + }, + + Rotation = new Rotation() + { + X = verticalRot, + Y = horizontalRot - 180, + Z = spiralClockwise ? -rotation : rotation + }, + + Duration = Duration / spiralAmmount / 360, + + Fov = Fov + }; + + spiralFrames.Add(spiralFrame); + } + + frames.AddRange(spiralFrames); + } + + Frame endFrame = new Frame() + { + Position = new Position() + { + X = xHorizontal * zVertical * endDistance, + Y = yVertical * endDistance + Height, + Z = zHorizontal * zVertical * endDistance + }, + + Rotation = new Rotation() + { + X = verticalRot, + Y = horizontalRot - 180, + Z = spiralAmmount > 0 ? (spiralClockwise ? -360 : 360) : 0 + }, + + HoldTime = endHold, + + Transition = ease && spiralAmmount <= 0 ? "Eased" : "Linear", + + Duration = spiralAmmount > 0 ? (Duration / spiralAmmount / 360) : Duration, + + Fov = Fov + }; + frames.Add(endFrame); + return frames; + } + } +} diff --git a/MovementScriptGenerator/Modules/Position.cs b/MovementScriptGenerator/Modules/Position.cs index ca9d5fb..122bd5f 100644 --- a/MovementScriptGenerator/Modules/Position.cs +++ b/MovementScriptGenerator/Modules/Position.cs @@ -1,15 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace MovementScriptGenerator.Modules { public class Position { - public float x { get; set; } - public float y { get; set; } - public float z { get; set; } + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } } } diff --git a/MovementScriptGenerator/Modules/Rotation.cs b/MovementScriptGenerator/Modules/Rotation.cs index 70a199c..8722b6b 100644 --- a/MovementScriptGenerator/Modules/Rotation.cs +++ b/MovementScriptGenerator/Modules/Rotation.cs @@ -1,15 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace MovementScriptGenerator.Modules { public class Rotation { - public float x { get; set; } - public float y { get; set; } - public float z { get; set; } + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } } } diff --git a/MovementScriptGenerator/MovementScriptGenerator.csproj b/MovementScriptGenerator/MovementScriptGenerator.csproj index 44ae164..38132bc 100644 --- a/MovementScriptGenerator/MovementScriptGenerator.csproj +++ b/MovementScriptGenerator/MovementScriptGenerator.csproj @@ -36,6 +36,7 @@ Icon.ico + ..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll @@ -52,14 +53,17 @@ - + Form Form1.cs + + + @@ -71,7 +75,7 @@ CircleControl.cs - + UserControl @@ -113,5 +117,8 @@ + + + \ No newline at end of file diff --git a/MovementScriptGenerator/Spiral.cs b/MovementScriptGenerator/Spiral.cs deleted file mode 100644 index 8315299..0000000 --- a/MovementScriptGenerator/Spiral.cs +++ /dev/null @@ -1,229 +0,0 @@ -using System; -using System.Collections.Generic; -using MovementScriptGenerator.Modules; - -namespace MovementScriptGenerator -{ - class Spiral - { - public List GenerateFrames( - float fov, - float duration, - float startDistance, - float endDistance, - float endHeight, - float horizontalRot, - float verticalRot, - int spiralAmmount, - bool spiralClockwise, - float startHold, - float endHold, - bool ease - ) - { - List frames = new List(); - - double horizontalRadiant = horizontalRot * Math.PI / 180; - - float xHorizontal = (float)Math.Sin(horizontalRadiant); - float zHorizontal = (float)Math.Cos(horizontalRadiant); - - double verticalRadiant = verticalRot * Math.PI / 180; - - float yVertical = (float)Math.Sin(verticalRadiant); - float zVertical = (float)Math.Cos(verticalRadiant); - - float pathLength = startDistance - endDistance; - float spiralLength = pathLength / spiralAmmount; - - switch (horizontalRot) - { - case 0: - zHorizontal = 1; - break; - case 90: - case -90: - case 270: - case -270: - zHorizontal = 0; - break; - case 180: - case -180: - case 360: - case -360: - xHorizontal = 0; - break; - } - - switch (verticalRot) - { - case 0: - yVertical = 0; - break; - case 90: - case -90: - case 270: - case -270: - zVertical = 0; - break; - case 180: - case -180: - case 360: - case -360: - //zVertical = 0; - break; - } - - Frame startFrame = new Frame() - { - position = new Position() - { - x = xHorizontal * zVertical * startDistance, - y = yVertical * startDistance + endHeight, - z = zHorizontal * zVertical * startDistance - }, - - rotation = new Rotation() - { - x = verticalRot, - y = horizontalRot - 180, - z = 0 - }, - - holdTime = startHold - }; - frames.Add(startFrame); - - for(int i = 0; i < spiralAmmount; i++) - { - List spiralFrames = new List(); - - float SpiralStartDistance = startDistance - (i*spiralLength); - float spiralHalfwayDistance = SpiralStartDistance - (spiralLength / 2); - float spiralEndDistance = spiralHalfwayDistance - (spiralLength / 2); - - for(int rotation = 1; rotation < 360; rotation++) - { - float spiralFrameDistance = SpiralStartDistance - (spiralLength / 360 * rotation); - - Frame spiralFrame = new Frame() - { - position = new Position() - { - x = xHorizontal * zVertical * spiralFrameDistance, - y = yVertical * spiralFrameDistance + endHeight, - z = zHorizontal * zVertical * spiralFrameDistance - }, - - rotation = new Rotation() - { - x = verticalRot, - y = horizontalRot - 180, - z = spiralClockwise ? -rotation : rotation - }, - - duration = duration / spiralAmmount / 360 - }; - - spiralFrames.Add(spiralFrame); - } - - /*if(i != 0) - { - Frame spiralStartFrame = new Frame() - { - position = new Position() - { - x = xHorizontal * zVertical * SpiralStartDistance, - y = yVertical * SpiralStartDistance + endHeight, - z = zHorizontal * zVertical * SpiralStartDistance - }, - - rotation = new Rotation() - { - x = verticalRot, - y = horizontalRot - 180, - z = 0 - }, - }; - - spiralFrames.Add(spiralStartFrame); - } - - Frame spiralHalfwayFrame = new Frame() - { - position = new Position() - { - x = xHorizontal * zVertical * spiralHalfwayDistance, - y = yVertical * spiralHalfwayDistance + endHeight, - z = zHorizontal * zVertical * spiralHalfwayDistance - }, - - rotation = new Rotation() - { - x = verticalRot, - y = horizontalRot - 180, - z = spiralClockwise ? 180 : -180 - }, - - duration = duration / spiralAmmount / 2 - }; - - spiralFrames.Add(spiralHalfwayFrame); - - if(i != spiralAmmount -1) - { - Frame spiralEndFrame = new Frame() - { - position = new Position() - { - x = xHorizontal * zVertical * spiralEndDistance, - y = yVertical * spiralEndDistance + endHeight, - z = zHorizontal * zVertical * spiralEndDistance - }, - - rotation = new Rotation() - { - x = verticalRot, - y = horizontalRot - 180, - z = spiralClockwise ? 360 : -360 - }, - - duration = duration / spiralAmmount / 2 - }; - - spiralFrames.Add(spiralEndFrame); - - }*/ - - frames.AddRange(spiralFrames); - } - - Frame endFrame = new Frame() - { - position = new Position() - { - x = xHorizontal * zVertical * endDistance, - y = yVertical * endDistance + endHeight, - z = zHorizontal * zVertical * endDistance - }, - - rotation = new Rotation() - { - x = verticalRot, - y = horizontalRot - 180, - z = spiralAmmount > 0 ? (spiralClockwise ? -360 : 360) : 0 - }, - - holdTime = endHold, - - transition = ease && spiralAmmount < 0 ? "Eased" : "Linear", - - duration = spiralAmmount > 0 ? (duration / spiralAmmount / 360) : duration - //duration = spiralAmmount > 0 ? (duration / spiralAmmount / 2) : duration - }; - frames.Add(endFrame); - return frames; - } - } -} diff --git a/MovementScriptGenerator/SpiralControl.Designer.cs b/MovementScriptGenerator/SpiralControl.Designer.cs index 8c5d902..f8f7b0f 100644 --- a/MovementScriptGenerator/SpiralControl.Designer.cs +++ b/MovementScriptGenerator/SpiralControl.Designer.cs @@ -38,8 +38,8 @@ private void InitializeComponent() this.numEndDistance = new System.Windows.Forms.NumericUpDown(); this.lblEndDistance = new System.Windows.Forms.Label(); this.tableLayoutPanel11 = new System.Windows.Forms.TableLayoutPanel(); - this.numEndHeight = new System.Windows.Forms.NumericUpDown(); - this.lblEndHeight = new System.Windows.Forms.Label(); + this.numHeight = new System.Windows.Forms.NumericUpDown(); + this.lblHeight = new System.Windows.Forms.Label(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.numHorizontalRot = new System.Windows.Forms.NumericUpDown(); this.lblHorizontalRot = new System.Windows.Forms.Label(); @@ -74,7 +74,7 @@ private void InitializeComponent() this.tableLayoutPanel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numEndDistance)).BeginInit(); this.tableLayoutPanel11.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numEndHeight)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numHeight)).BeginInit(); this.tableLayoutPanel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numHorizontalRot)).BeginInit(); this.tableLayoutPanel10.SuspendLayout(); @@ -216,8 +216,8 @@ private void InitializeComponent() this.tableLayoutPanel11.ColumnCount = 2; this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel11.Controls.Add(this.numEndHeight, 0, 0); - this.tableLayoutPanel11.Controls.Add(this.lblEndHeight, 0, 0); + this.tableLayoutPanel11.Controls.Add(this.numHeight, 0, 0); + this.tableLayoutPanel11.Controls.Add(this.lblHeight, 0, 0); this.tableLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel11.Location = new System.Drawing.Point(3, 73); this.tableLayoutPanel11.Name = "tableLayoutPanel11"; @@ -227,31 +227,31 @@ private void InitializeComponent() this.tableLayoutPanel11.Size = new System.Drawing.Size(254, 26); this.tableLayoutPanel11.TabIndex = 3; // - // numEndHeight + // numHeight // - this.numEndHeight.DecimalPlaces = 5; - this.numEndHeight.Location = new System.Drawing.Point(130, 3); - this.numEndHeight.Minimum = new decimal(new int[] { + this.numHeight.DecimalPlaces = 5; + this.numHeight.Location = new System.Drawing.Point(130, 3); + this.numHeight.Minimum = new decimal(new int[] { 100, 0, 0, -2147483648}); - this.numEndHeight.Name = "numEndHeight"; - this.numEndHeight.Size = new System.Drawing.Size(120, 20); - this.numEndHeight.TabIndex = 1; + this.numHeight.Name = "numHeight"; + this.numHeight.Size = new System.Drawing.Size(120, 20); + this.numHeight.TabIndex = 1; // - // lblEndHeight + // lblHeight // - this.lblEndHeight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.lblHeight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); - this.lblEndHeight.AutoSize = true; - this.lblEndHeight.Location = new System.Drawing.Point(3, 0); - this.lblEndHeight.Name = "lblEndHeight"; - this.lblEndHeight.Size = new System.Drawing.Size(38, 26); - this.lblEndHeight.TabIndex = 1; - this.lblEndHeight.Text = "Height"; - this.lblEndHeight.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.ToolTip.SetToolTip(this.lblEndHeight, "Defines at what height (on the y-axis) the move will be executed at.\r\nIf End Dist" + + this.lblHeight.AutoSize = true; + this.lblHeight.Location = new System.Drawing.Point(3, 0); + this.lblHeight.Name = "lblHeight"; + this.lblHeight.Size = new System.Drawing.Size(38, 26); + this.lblHeight.TabIndex = 1; + this.lblHeight.Text = "Height"; + this.lblHeight.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.ToolTip.SetToolTip(this.lblHeight, "Defines at what height (on the y-axis) the move will be executed at.\r\nIf End Dist" + "ance is defined as 0, this will be the height at which the camera will stop at."); // // tableLayoutPanel3 @@ -702,7 +702,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numEndDistance)).EndInit(); this.tableLayoutPanel11.ResumeLayout(false); this.tableLayoutPanel11.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numEndHeight)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numHeight)).EndInit(); this.tableLayoutPanel3.ResumeLayout(false); this.tableLayoutPanel3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numHorizontalRot)).EndInit(); @@ -768,8 +768,8 @@ private void InitializeComponent() private System.Windows.Forms.Label lblEndHoldTime; private System.Windows.Forms.NumericUpDown numEndDistance; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel11; - private System.Windows.Forms.NumericUpDown numEndHeight; - private System.Windows.Forms.Label lblEndHeight; + private System.Windows.Forms.NumericUpDown numHeight; + private System.Windows.Forms.Label lblHeight; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel12; private System.Windows.Forms.Label lblEase; private System.Windows.Forms.CheckBox checkEase; diff --git a/MovementScriptGenerator/SpiralControl.cs b/MovementScriptGenerator/SpiralControl.cs index ac3c171..14aec92 100644 --- a/MovementScriptGenerator/SpiralControl.cs +++ b/MovementScriptGenerator/SpiralControl.cs @@ -1,19 +1,11 @@ -using MovementScriptGenerator.Modules; -using System; +using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace MovementScriptGenerator { public partial class SpiralControl : UserControl { - private static Spiral spiral = new Spiral(); List rotationTypes = new List() { @@ -48,30 +40,25 @@ private void numSpiralAmmount_ValueChanged(object sender, EventArgs e) } } - public MovementScript CreateMovementScript() + public Spiral CreateMove(string moveName) { - MovementScript movementScript = new MovementScript(); - bool spiralClockwise = false; - if (cbSpiralRotation.SelectedIndex == 0) - { - spiralClockwise = true; - } - movementScript.frames = spiral.GenerateFrames( - (int)numFOV.Value, - (float)numDuration.Value, - (float)numStartDistance.Value, - (float)numEndDistance.Value, - (float)numEndHeight.Value, - (float)numHorizontalRot.Value, - (float)numVerticalRot.Value, - (int)numSpiralAmmount.Value, - spiralClockwise, - (float)numStartHoldTime.Value, - (float)numEndHoldTime.Value, + Spiral spiral = new Spiral( + moveName, + (int) numFOV.Value, + (float) numDuration.Value, + (float) numHeight.Value, + (float) numStartDistance.Value, + (float) numEndDistance.Value, + (float) numHorizontalRot.Value, + (float) numVerticalRot.Value, + (int) numSpiralAmmount.Value, + cbSpiralRotation.SelectedIndex == 0 ? true : false, + (float) numStartHoldTime.Value, + (float) numEndHoldTime.Value, checkEase.Checked - ); + ); - return movementScript; + return spiral; } } } From f118a3ab263da9e015de7dc182bd8f2b5a9d5048 Mon Sep 17 00:00:00 2001 From: DragonirHD Date: Tue, 13 Dec 2022 23:42:32 +0100 Subject: [PATCH 2/6] - added getters to Circle and Spiral - fixed naming violations in Circle and Spiral - added functionality to copy settings of an existing chain element - added functionality to update settings of an existing chain element - added ui for chain element handling --- MovementScriptGenerator/CircleControl.cs | 25 +- MovementScriptGenerator/Form1.Designer.cs | 238 +++++++++++++++++- MovementScriptGenerator/Form1.cs | 134 +++++++++- MovementScriptGenerator/Form1.resx | 3 + .../Modules/Moves/Circle.cs | 47 ++-- .../Modules/Moves/Spiral.cs | 90 +++---- MovementScriptGenerator/SpiralControl.cs | 25 ++ 7 files changed, 482 insertions(+), 80 deletions(-) diff --git a/MovementScriptGenerator/CircleControl.cs b/MovementScriptGenerator/CircleControl.cs index 9b24f77..d693ab6 100644 --- a/MovementScriptGenerator/CircleControl.cs +++ b/MovementScriptGenerator/CircleControl.cs @@ -24,6 +24,29 @@ private void initializeComboBoxes() cbRotation.SelectedIndex = 0; } + public bool Populate(Circle original) + { + try + { + numFOV.Value = original.Fov; + numDuration.Value = (decimal)original.Duration; + numHeight.Value = (decimal)original.Height; + numRotX.Value = (decimal)original.RotX; + numRotZ.Value = (decimal)original.RotZ; + numDistance.Value = (decimal)original.Distance; + numStartingPoint.Value = (decimal)original.StartingPointDegree; + numSector.Value = (decimal)original.SectorDegrees; + numIterations.Value = original.Iterations; + cbRotation.SelectedIndex = original.RotateClockwise ? 0 : 1; + } + catch + { + return false; + } + + return true; + } + public Circle CreateMove(string moveName) { Circle circle = new Circle( @@ -37,7 +60,7 @@ public Circle CreateMove(string moveName) (float)numStartingPoint.Value, (float)numSector.Value, (int)numIterations.Value, - cbRotation.SelectedIndex == 0 ? true : false + cbRotation.SelectedIndex == 0 ); return circle; diff --git a/MovementScriptGenerator/Form1.Designer.cs b/MovementScriptGenerator/Form1.Designer.cs index be0d19f..45b3c79 100644 --- a/MovementScriptGenerator/Form1.Designer.cs +++ b/MovementScriptGenerator/Form1.Designer.cs @@ -54,9 +54,22 @@ private void InitializeComponent() this.tableLayoutPanel12 = new System.Windows.Forms.TableLayoutPanel(); this.lblAddToScript = new System.Windows.Forms.Label(); this.checkAddToScript = new System.Windows.Forms.CheckBox(); + this.tableLayoutPanel18 = new System.Windows.Forms.TableLayoutPanel(); this.tvChain = new System.Windows.Forms.TreeView(); + this.tableLayoutPanel19 = new System.Windows.Forms.TableLayoutPanel(); + this.lblElementOptions = new System.Windows.Forms.Label(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); + this.tableLayoutPanel20 = new System.Windows.Forms.TableLayoutPanel(); + this.btnElementMoveDown = new System.Windows.Forms.Button(); + this.btnElementMoveUp = new System.Windows.Forms.Button(); + this.btnElementDuplicate = new System.Windows.Forms.Button(); + this.btnElementEditSettings = new System.Windows.Forms.Button(); + this.btnElementApplySettings = new System.Windows.Forms.Button(); + this.btnElementDelete = new System.Windows.Forms.Button(); this.tableLayoutPanel16 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); this.btnAddMoveToChain = new System.Windows.Forms.Button(); + this.btnResetMoveSettings = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.flpContent = new System.Windows.Forms.FlowLayoutPanel(); this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); @@ -87,7 +100,12 @@ private void InitializeComponent() this.tableLayoutPanel10.SuspendLayout(); this.tableLayoutPanel9.SuspendLayout(); this.tableLayoutPanel12.SuspendLayout(); + this.tableLayoutPanel18.SuspendLayout(); + this.tableLayoutPanel19.SuspendLayout(); + this.flowLayoutPanel4.SuspendLayout(); + this.tableLayoutPanel20.SuspendLayout(); this.tableLayoutPanel16.SuspendLayout(); + this.flowLayoutPanel3.SuspendLayout(); this.flpContent.SuspendLayout(); this.tableLayoutPanel5.SuspendLayout(); this.tableLayoutPanel7.SuspendLayout(); @@ -150,7 +168,7 @@ private void InitializeComponent() this.tableLayoutPanel14.Controls.Add(this.label2, 0, 0); this.tableLayoutPanel14.Controls.Add(this.tableLayoutPanel15, 0, 3); this.tableLayoutPanel14.Controls.Add(this.flowLayoutPanel1, 0, 1); - this.tableLayoutPanel14.Controls.Add(this.tvChain, 0, 2); + this.tableLayoutPanel14.Controls.Add(this.tableLayoutPanel18, 0, 2); this.tableLayoutPanel14.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel14.Location = new System.Drawing.Point(303, 0); this.tableLayoutPanel14.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); @@ -427,19 +445,176 @@ private void InitializeComponent() this.checkAddToScript.TabIndex = 1; this.checkAddToScript.UseVisualStyleBackColor = true; // + // tableLayoutPanel18 + // + this.tableLayoutPanel18.ColumnCount = 2; + this.tableLayoutPanel18.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); + this.tableLayoutPanel18.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel18.Controls.Add(this.tvChain, 0, 0); + this.tableLayoutPanel18.Controls.Add(this.tableLayoutPanel19, 1, 0); + this.tableLayoutPanel18.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel18.Location = new System.Drawing.Point(0, 70); + this.tableLayoutPanel18.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel18.Name = "tableLayoutPanel18"; + this.tableLayoutPanel18.RowCount = 1; + this.tableLayoutPanel18.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel18.Size = new System.Drawing.Size(605, 597); + this.tableLayoutPanel18.TabIndex = 7; + // // tvChain // this.tvChain.Dock = System.Windows.Forms.DockStyle.Fill; - this.tvChain.Location = new System.Drawing.Point(3, 73); + this.tvChain.HideSelection = false; + this.tvChain.Location = new System.Drawing.Point(3, 3); this.tvChain.Name = "tvChain"; - this.tvChain.Size = new System.Drawing.Size(599, 591); + this.tvChain.Size = new System.Drawing.Size(478, 591); this.tvChain.TabIndex = 7; // + // tableLayoutPanel19 + // + this.tableLayoutPanel19.ColumnCount = 1; + this.tableLayoutPanel19.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel19.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel19.Controls.Add(this.lblElementOptions, 0, 0); + this.tableLayoutPanel19.Controls.Add(this.flowLayoutPanel4, 0, 1); + this.tableLayoutPanel19.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel19.Location = new System.Drawing.Point(484, 0); + this.tableLayoutPanel19.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel19.Name = "tableLayoutPanel19"; + this.tableLayoutPanel19.RowCount = 2; + this.tableLayoutPanel19.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel19.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 90F)); + this.tableLayoutPanel19.Size = new System.Drawing.Size(121, 597); + this.tableLayoutPanel19.TabIndex = 8; + // + // lblElementOptions + // + this.lblElementOptions.AutoSize = true; + this.lblElementOptions.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblElementOptions.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblElementOptions.Location = new System.Drawing.Point(3, 0); + this.lblElementOptions.MaximumSize = new System.Drawing.Size(0, 59); + this.lblElementOptions.Name = "lblElementOptions"; + this.lblElementOptions.Size = new System.Drawing.Size(115, 59); + this.lblElementOptions.TabIndex = 5; + this.lblElementOptions.Text = "Element Options"; + this.lblElementOptions.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // flowLayoutPanel4 + // + this.flowLayoutPanel4.AutoScroll = true; + this.flowLayoutPanel4.Controls.Add(this.tableLayoutPanel20); + this.flowLayoutPanel4.Controls.Add(this.btnElementDuplicate); + this.flowLayoutPanel4.Controls.Add(this.btnElementEditSettings); + this.flowLayoutPanel4.Controls.Add(this.btnElementApplySettings); + this.flowLayoutPanel4.Controls.Add(this.btnElementDelete); + this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel4.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel4.Location = new System.Drawing.Point(0, 59); + this.flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + this.flowLayoutPanel4.Size = new System.Drawing.Size(121, 538); + this.flowLayoutPanel4.TabIndex = 6; + this.flowLayoutPanel4.WrapContents = false; + // + // tableLayoutPanel20 + // + this.tableLayoutPanel20.ColumnCount = 2; + this.tableLayoutPanel20.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel20.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel20.Controls.Add(this.btnElementMoveDown, 1, 0); + this.tableLayoutPanel20.Controls.Add(this.btnElementMoveUp, 0, 0); + this.tableLayoutPanel20.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel20.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel20.Name = "tableLayoutPanel20"; + this.tableLayoutPanel20.RowCount = 1; + this.tableLayoutPanel20.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel20.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel20.Size = new System.Drawing.Size(121, 40); + this.tableLayoutPanel20.TabIndex = 2; + // + // btnElementMoveDown + // + this.btnElementMoveDown.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnElementMoveDown.Enabled = false; + this.btnElementMoveDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnElementMoveDown.Location = new System.Drawing.Point(63, 3); + this.btnElementMoveDown.Name = "btnElementMoveDown"; + this.btnElementMoveDown.Size = new System.Drawing.Size(55, 34); + this.btnElementMoveDown.TabIndex = 1; + this.btnElementMoveDown.Text = "↓"; + this.btnElementMoveDown.UseVisualStyleBackColor = true; + // + // btnElementMoveUp + // + this.btnElementMoveUp.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnElementMoveUp.Enabled = false; + this.btnElementMoveUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnElementMoveUp.Location = new System.Drawing.Point(3, 3); + this.btnElementMoveUp.Name = "btnElementMoveUp"; + this.btnElementMoveUp.Size = new System.Drawing.Size(54, 34); + this.btnElementMoveUp.TabIndex = 0; + this.btnElementMoveUp.Text = "↑"; + this.btnElementMoveUp.UseVisualStyleBackColor = true; + // + // btnElementDuplicate + // + this.btnElementDuplicate.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnElementDuplicate.Enabled = false; + this.btnElementDuplicate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnElementDuplicate.Location = new System.Drawing.Point(3, 43); + this.btnElementDuplicate.MinimumSize = new System.Drawing.Size(115, 0); + this.btnElementDuplicate.Name = "btnElementDuplicate"; + this.btnElementDuplicate.Size = new System.Drawing.Size(115, 23); + this.btnElementDuplicate.TabIndex = 3; + this.btnElementDuplicate.Text = "Duplicate"; + this.btnElementDuplicate.UseVisualStyleBackColor = true; + // + // btnElementEditSettings + // + this.btnElementEditSettings.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnElementEditSettings.Enabled = false; + this.btnElementEditSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnElementEditSettings.Location = new System.Drawing.Point(3, 72); + this.btnElementEditSettings.MinimumSize = new System.Drawing.Size(115, 0); + this.btnElementEditSettings.Name = "btnElementEditSettings"; + this.btnElementEditSettings.Size = new System.Drawing.Size(115, 23); + this.btnElementEditSettings.TabIndex = 5; + this.btnElementEditSettings.Text = "Edit Settings"; + this.btnElementEditSettings.UseVisualStyleBackColor = true; + this.btnElementEditSettings.Click += new System.EventHandler(this.btnElementEditSettings_Click); + // + // btnElementApplySettings + // + this.btnElementApplySettings.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnElementApplySettings.Enabled = false; + this.btnElementApplySettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnElementApplySettings.Location = new System.Drawing.Point(3, 101); + this.btnElementApplySettings.MinimumSize = new System.Drawing.Size(115, 0); + this.btnElementApplySettings.Name = "btnElementApplySettings"; + this.btnElementApplySettings.Size = new System.Drawing.Size(115, 23); + this.btnElementApplySettings.TabIndex = 6; + this.btnElementApplySettings.Text = "Apply Settings"; + this.btnElementApplySettings.UseVisualStyleBackColor = true; + // + // btnElementDelete + // + this.btnElementDelete.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnElementDelete.Enabled = false; + this.btnElementDelete.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnElementDelete.Location = new System.Drawing.Point(3, 130); + this.btnElementDelete.MinimumSize = new System.Drawing.Size(115, 0); + this.btnElementDelete.Name = "btnElementDelete"; + this.btnElementDelete.Size = new System.Drawing.Size(115, 23); + this.btnElementDelete.TabIndex = 4; + this.btnElementDelete.Text = "Delete"; + this.btnElementDelete.UseVisualStyleBackColor = true; + // // tableLayoutPanel16 // this.tableLayoutPanel16.ColumnCount = 1; this.tableLayoutPanel16.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel16.Controls.Add(this.btnAddMoveToChain, 0, 3); + this.tableLayoutPanel16.Controls.Add(this.flowLayoutPanel3, 0, 3); this.tableLayoutPanel16.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel16.Controls.Add(this.flpContent, 0, 2); this.tableLayoutPanel16.Controls.Add(this.flowLayoutPanel2, 0, 1); @@ -455,18 +630,49 @@ private void InitializeComponent() this.tableLayoutPanel16.Size = new System.Drawing.Size(297, 703); this.tableLayoutPanel16.TabIndex = 5; // + // flowLayoutPanel3 + // + this.flowLayoutPanel3.Controls.Add(this.btnAddMoveToChain); + this.flowLayoutPanel3.Controls.Add(this.btnResetMoveSettings); + this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel3.Location = new System.Drawing.Point(0, 667); + this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel3.MinimumSize = new System.Drawing.Size(0, 30); + this.flowLayoutPanel3.Name = "flowLayoutPanel3"; + this.flowLayoutPanel3.Size = new System.Drawing.Size(297, 36); + this.flowLayoutPanel3.TabIndex = 7; + // // btnAddMoveToChain // this.btnAddMoveToChain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); - this.btnAddMoveToChain.Location = new System.Drawing.Point(3, 670); + this.btnAddMoveToChain.AutoSize = true; + this.btnAddMoveToChain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnAddMoveToChain.Location = new System.Drawing.Point(0, 3); + this.btnAddMoveToChain.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.btnAddMoveToChain.MinimumSize = new System.Drawing.Size(0, 26); this.btnAddMoveToChain.Name = "btnAddMoveToChain"; - this.btnAddMoveToChain.Size = new System.Drawing.Size(82, 30); + this.btnAddMoveToChain.Size = new System.Drawing.Size(82, 26); this.btnAddMoveToChain.TabIndex = 2; this.btnAddMoveToChain.Text = "Add To Chain"; this.btnAddMoveToChain.UseVisualStyleBackColor = true; this.btnAddMoveToChain.Click += new System.EventHandler(this.btnAddMoveToChain_Click); // + // btnResetMoveSettings + // + this.btnResetMoveSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.btnResetMoveSettings.Location = new System.Drawing.Point(88, 3); + this.btnResetMoveSettings.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.btnResetMoveSettings.MinimumSize = new System.Drawing.Size(0, 26); + this.btnResetMoveSettings.Name = "btnResetMoveSettings"; + this.btnResetMoveSettings.Size = new System.Drawing.Size(103, 26); + this.btnResetMoveSettings.TabIndex = 3; + this.btnResetMoveSettings.Text = "Reset To Defaults"; + this.ToolTip.SetToolTip(this.btnResetMoveSettings, "Resets the currently selected move settings to their default values."); + this.btnResetMoveSettings.UseVisualStyleBackColor = true; + this.btnResetMoveSettings.Click += new System.EventHandler(this.btnResetMoveControl_Click); + // // label1 // this.label1.AutoSize = true; @@ -763,8 +969,15 @@ private void InitializeComponent() this.tableLayoutPanel9.PerformLayout(); this.tableLayoutPanel12.ResumeLayout(false); this.tableLayoutPanel12.PerformLayout(); + this.tableLayoutPanel18.ResumeLayout(false); + this.tableLayoutPanel19.ResumeLayout(false); + this.tableLayoutPanel19.PerformLayout(); + this.flowLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel20.ResumeLayout(false); this.tableLayoutPanel16.ResumeLayout(false); this.tableLayoutPanel16.PerformLayout(); + this.flowLayoutPanel3.ResumeLayout(false); + this.flowLayoutPanel3.PerformLayout(); this.flpContent.ResumeLayout(false); this.flpContent.PerformLayout(); this.tableLayoutPanel5.ResumeLayout(false); @@ -831,6 +1044,19 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtMoveName; private System.Windows.Forms.Label lblMoveName; private System.Windows.Forms.TreeView tvChain; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; + private System.Windows.Forms.Button btnResetMoveSettings; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel18; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel19; + private System.Windows.Forms.Label lblElementOptions; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; + private System.Windows.Forms.Button btnElementMoveUp; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel20; + private System.Windows.Forms.Button btnElementMoveDown; + private System.Windows.Forms.Button btnElementDuplicate; + private System.Windows.Forms.Button btnElementEditSettings; + private System.Windows.Forms.Button btnElementApplySettings; + private System.Windows.Forms.Button btnElementDelete; } } diff --git a/MovementScriptGenerator/Form1.cs b/MovementScriptGenerator/Form1.cs index c3ac04e..e9a25cd 100644 --- a/MovementScriptGenerator/Form1.cs +++ b/MovementScriptGenerator/Form1.cs @@ -10,6 +10,7 @@ namespace MovementScriptGenerator { public partial class Main : Form { + //Move Controls CircleControl circleControl = new CircleControl(); SpiralControl spiralControl = new SpiralControl(); @@ -39,7 +40,7 @@ public Main() InitializeComponent(); InitializeComboBoxes(); UpdateDescription(); - UpdateContent(); + OnMoveTypeChanged(); UpdateChainWindow(); } @@ -54,7 +55,7 @@ private void UpdateDescription() lblMoveDescription.Text = moveDescriptions[cbType.SelectedIndex]; } - private void UpdateContent() + private void OnMoveTypeChanged() { tlContent.Controls.Clear(); switch (cbType.SelectedIndex) @@ -68,12 +69,26 @@ private void UpdateContent() } } + private void ResetContent() + { + txtMoveName.Text = string.Empty; + switch (tlContent.Controls[0]) + { + case CircleControl _: + circleControl = new CircleControl(); + break; + case SpiralControl _: + spiralControl = new SpiralControl(); + break; + } + } + private void UpdateChainWindow() { foreach(ChainElement el in chain.Elements) { - tvChain.BeginUpdate(); tvChain.Nodes.Clear(); + tvChain.BeginUpdate(); tvChain.Nodes.Add(el.Name); tvChain.EndUpdate(); } @@ -145,16 +160,17 @@ private bool AddToMovementScriptFile(MovementScript script, string filePath) private void cbType_SelectedIndexChanged(object sender, EventArgs e) { UpdateDescription(); - UpdateContent(); + OnMoveTypeChanged(); } private void btnAddMoveToChain_Click(object sender, EventArgs e) { string moveName = txtMoveName.Text; - if (moveName.Replace(" ", String.Empty) == "") + if (!MoveNameValid(moveName)) { moveName = null; } + switch (cbType.SelectedIndex) { case 0: @@ -165,6 +181,9 @@ private void btnAddMoveToChain_Click(object sender, EventArgs e) Spiral spiral = spiralControl.CreateMove(moveName); chain.Elements.Add(spiral); break; + default: + MessageBox.Show("can't add move to chain."); + return; } tvChain.Nodes.Add(chain.Elements.Last().Name); @@ -239,5 +258,110 @@ private void btnGenerateScript_Click(object sender, EventArgs e) }; } } + + private void btnResetMoveControl_Click(object sender, EventArgs e) + { + ResetContent(); + OnMoveTypeChanged(); + } + + private void btnApplySettingsToSelected_Click(object sender, EventArgs e) + { + string newMoveName = txtMoveName.Text; + if (!MoveNameValid(newMoveName)) + { + newMoveName = null; + } + try + { + TreeNode selectedNode = tvChain.SelectedNode; + if(selectedNode == null) + { + MessageBox.Show("Couldn't apply settings. Make sure that you have selected an element of the chain."); + return; + } + ChainElement selectedElement = chain.Elements[selectedNode.Index]; + + switch (cbType.SelectedIndex) + { + case 0: + if(selectedElement is Circle) + { + Circle circle = circleControl.CreateMove(newMoveName); + chain.Elements[selectedNode.Index] = circle; + selectedElement = circle; + } + else + { + MessageBox.Show("Can't apply these settings to the currently selected chain element because the element is not a circle move."); + return; + } + break; + case 1: + if(selectedElement is Spiral) + { + Spiral spiral = spiralControl.CreateMove(newMoveName); + selectedElement = spiral; + } + else + { + MessageBox.Show("Can't apply these settings to the currently selected chain element because the element is not a spiral move."); + return; + } + break; + + default: + MessageBox.Show("Can't apply these settings to the currently selected chain element."); + return; + } + + UpdateChainWindow(); + } + catch + { + MessageBox.Show("Couldn't apply settings. Make sure that you have selected an element of the chain that is the same type of element as your settings."); + } + } + + private bool MoveNameValid(string moveName) + { + if (moveName.Replace(" ", String.Empty) == "") + { + return false; + } + + return true; + } + + private void btnElementEditSettings_Click(object sender, EventArgs e) + { + if(tvChain.SelectedNode == null) + { + MessageBox.Show("No element selected to edit.\nPlease select an element from the chain."); + return; + } + ChainElement selectedElementInChain = chain.Elements[tvChain.SelectedNode.Index]; + bool populatingOfFieldsSuccessful = true; + switch (selectedElementInChain) + { + case Circle circleElement: + populatingOfFieldsSuccessful = circleControl.Populate(circleElement); + break; + case Spiral spiralElement: + populatingOfFieldsSuccessful = spiralControl.Populate(spiralElement); + break; + default: + MessageBox.Show("Can't get the settings of the selected element."); + return; + } + if (!populatingOfFieldsSuccessful) + { + MessageBox.Show("Couldn't edit the selected element."); + } + else + { + txtMoveName.Text = selectedElementInChain.Name; + } + } } } diff --git a/MovementScriptGenerator/Form1.resx b/MovementScriptGenerator/Form1.resx index 167a161..44d9a53 100644 --- a/MovementScriptGenerator/Form1.resx +++ b/MovementScriptGenerator/Form1.resx @@ -120,6 +120,9 @@ 17, 17 + + 17, 17 + On -> the script will pause, while the song is paused and start playing when the song starts. diff --git a/MovementScriptGenerator/Modules/Moves/Circle.cs b/MovementScriptGenerator/Modules/Moves/Circle.cs index 145ab3b..d3ff149 100644 --- a/MovementScriptGenerator/Modules/Moves/Circle.cs +++ b/MovementScriptGenerator/Modules/Moves/Circle.cs @@ -6,13 +6,13 @@ namespace MovementScriptGenerator { public class Circle : Move { - private float rotX; - private float rotZ; - private float distance; - private float startingPointDegree; - private float sectorDegrees; - private int iterations; - private bool rotateClockwise; + public float RotX { get; } + public float RotZ { get; } + public float Distance { get; } + public float StartingPointDegree { get; } + public float SectorDegrees { get; } + public int Iterations { get; } + public bool RotateClockwise { get; } public Circle( string name, int fov, @@ -30,43 +30,44 @@ public Circle( Fov = fov; Duration = duration; Height = height; - this.rotX = rotX; - this.rotZ = rotZ; - this.distance = distance; - this.startingPointDegree = startingPointDegree; - this.sectorDegrees = sectorDegrees; - this.iterations = iterations; - this.rotateClockwise = rotateClockwise; + RotX = rotX; + RotZ = rotZ; + Distance = distance; + StartingPointDegree = startingPointDegree; + SectorDegrees = sectorDegrees; + Iterations = iterations; + RotateClockwise = rotateClockwise; } + public override List GenerateFrames() { List frames = new List(); float initialDegree = 0; - float maxDegrees = sectorDegrees - 1; + float maxDegrees = SectorDegrees - 1; float initialDegreeAddend = 1; - if (!rotateClockwise) { + if (!RotateClockwise) { initialDegree *= -1; maxDegrees *= -1; initialDegreeAddend *= -1; } - for (float i = initialDegree; (rotateClockwise && i <= maxDegrees) || (!rotateClockwise && i >= maxDegrees); i += (float)initialDegreeAddend / iterations) + for (float i = initialDegree; (RotateClockwise && i <= maxDegrees) || (!RotateClockwise && i >= maxDegrees); i += (float)initialDegreeAddend / Iterations) { - float usedDegree = i + startingPointDegree; + float usedDegree = i + StartingPointDegree; double radiant = usedDegree * Math.PI / 180; Frame frame = new Frame(); frame.Position = new Position(); frame.Rotation = new Rotation(); - frame.Position.X = (float)Math.Sin(radiant) * distance; + frame.Position.X = (float)Math.Sin(radiant) * Distance; frame.Position.Y = Height; - frame.Position.Z = (float)Math.Cos(radiant) * distance; + frame.Position.Z = (float)Math.Cos(radiant) * Distance; - frame.Rotation.Z = rotZ; - frame.Rotation.X = rotX; + frame.Rotation.Z = RotZ; + frame.Rotation.X = RotX; frame.Rotation.Y = usedDegree -180; if (usedDegree == 0 || usedDegree == 180 || usedDegree == 360) @@ -79,7 +80,7 @@ public override List GenerateFrames() } - frame.Duration = Duration / Math.Abs(maxDegrees) / iterations; + frame.Duration = Duration / Math.Abs(maxDegrees) / Iterations; if(Fov > 0) { diff --git a/MovementScriptGenerator/Modules/Moves/Spiral.cs b/MovementScriptGenerator/Modules/Moves/Spiral.cs index 007d83a..ef0930a 100644 --- a/MovementScriptGenerator/Modules/Moves/Spiral.cs +++ b/MovementScriptGenerator/Modules/Moves/Spiral.cs @@ -6,15 +6,15 @@ namespace MovementScriptGenerator { public class Spiral : Move { - private float startDistance; - private float endDistance; - private float horizontalRot; - private float verticalRot; - private float spiralAmmount; - private bool spiralClockwise; - private float startHold; - private float endHold; - private bool ease; + public float StartDistance { get; } + public float EndDistance { get; } + public float HorizontalRot { get; } + public float VerticalRot { get; } + public float SpiralAmmount { get; } + public bool SpiralClockwise { get; } + public float StartHold { get; } + public float EndHold { get; } + public bool Ease { get; } public Spiral( string name, int fov, @@ -34,34 +34,34 @@ public Spiral( Fov = fov; Duration = duration; Height = height; - this.startDistance = startDistance; - this.endDistance = endDistance; - this.horizontalRot = horizontalRot; - this.verticalRot = verticalRot; - this.spiralAmmount = spiralAmmount; - this.spiralClockwise = spiralClockwise; - this.startHold = startHold; - this.endHold = endHold; - this.ease = ease; + StartDistance = startDistance; + EndDistance = endDistance; + HorizontalRot = horizontalRot; + VerticalRot = verticalRot; + SpiralAmmount = spiralAmmount; + SpiralClockwise = spiralClockwise; + StartHold = startHold; + EndHold = endHold; + Ease = ease; } public override List GenerateFrames() { List frames = new List(); - double horizontalRadiant = horizontalRot * Math.PI / 180; + double horizontalRadiant = HorizontalRot * Math.PI / 180; float xHorizontal = (float)Math.Sin(horizontalRadiant); float zHorizontal = (float)Math.Cos(horizontalRadiant); - double verticalRadiant = verticalRot * Math.PI / 180; + double verticalRadiant = VerticalRot * Math.PI / 180; float yVertical = (float)Math.Sin(verticalRadiant); float zVertical = (float)Math.Cos(verticalRadiant); - float pathLength = startDistance - endDistance; - float spiralLength = pathLength / spiralAmmount; + float pathLength = StartDistance - EndDistance; + float spiralLength = pathLength / SpiralAmmount; - switch (horizontalRot) + switch (HorizontalRot) { case 0: zHorizontal = 1; @@ -80,7 +80,7 @@ public override List GenerateFrames() break; } - switch (verticalRot) + switch (VerticalRot) { case 0: yVertical = 0; @@ -97,29 +97,29 @@ public override List GenerateFrames() { Position = new Position() { - X = xHorizontal * zVertical * startDistance, - Y = yVertical * startDistance + Height, - Z = zHorizontal * zVertical * startDistance + X = xHorizontal * zVertical * StartDistance, + Y = yVertical * StartDistance + Height, + Z = zHorizontal * zVertical * StartDistance }, Rotation = new Rotation() { - X = verticalRot, - Y = horizontalRot - 180, + X = VerticalRot, + Y = HorizontalRot - 180, Z = 0 }, - HoldTime = startHold, + HoldTime = StartHold, Fov = Fov }; frames.Add(startFrame); - for(int i = 0; i < spiralAmmount; i++) + for(int i = 0; i < SpiralAmmount; i++) { List spiralFrames = new List(); - float SpiralStartDistance = startDistance - (i*spiralLength); + float SpiralStartDistance = StartDistance - (i*spiralLength); float spiralHalfwayDistance = SpiralStartDistance - (spiralLength / 2); float spiralEndDistance = spiralHalfwayDistance - (spiralLength / 2); @@ -138,12 +138,12 @@ public override List GenerateFrames() Rotation = new Rotation() { - X = verticalRot, - Y = horizontalRot - 180, - Z = spiralClockwise ? -rotation : rotation + X = VerticalRot, + Y = HorizontalRot - 180, + Z = SpiralClockwise ? -rotation : rotation }, - Duration = Duration / spiralAmmount / 360, + Duration = Duration / SpiralAmmount / 360, Fov = Fov }; @@ -158,23 +158,23 @@ public override List GenerateFrames() { Position = new Position() { - X = xHorizontal * zVertical * endDistance, - Y = yVertical * endDistance + Height, - Z = zHorizontal * zVertical * endDistance + X = xHorizontal * zVertical * EndDistance, + Y = yVertical * EndDistance + Height, + Z = zHorizontal * zVertical * EndDistance }, Rotation = new Rotation() { - X = verticalRot, - Y = horizontalRot - 180, - Z = spiralAmmount > 0 ? (spiralClockwise ? -360 : 360) : 0 + X = VerticalRot, + Y = HorizontalRot - 180, + Z = SpiralAmmount > 0 ? (SpiralClockwise ? -360 : 360) : 0 }, - HoldTime = endHold, + HoldTime = EndHold, - Transition = ease && spiralAmmount <= 0 ? "Eased" : "Linear", + Transition = Ease && SpiralAmmount <= 0 ? "Eased" : "Linear", - Duration = spiralAmmount > 0 ? (Duration / spiralAmmount / 360) : Duration, + Duration = SpiralAmmount > 0 ? (Duration / SpiralAmmount / 360) : Duration, Fov = Fov }; diff --git a/MovementScriptGenerator/SpiralControl.cs b/MovementScriptGenerator/SpiralControl.cs index 14aec92..cd94fbf 100644 --- a/MovementScriptGenerator/SpiralControl.cs +++ b/MovementScriptGenerator/SpiralControl.cs @@ -25,6 +25,31 @@ private void initializeComboBoxes() cbSpiralRotation.SelectedIndex = 0; } + public bool Populate(Spiral original) + { + try + { + numFOV.Value = original.Fov; + numDuration.Value = (decimal)original.Duration; + numHeight.Value = (decimal)original.Height; + numStartDistance.Value = (decimal)original.StartDistance; + numEndDistance.Value = (decimal)original.EndDistance; + numHorizontalRot.Value = (decimal)original.HorizontalRot; + numVerticalRot.Value = (decimal)original.VerticalRot; + numSpiralAmmount.Value = (decimal)original.SpiralAmmount; + cbSpiralRotation.SelectedIndex = original.SpiralClockwise ? 0 : 1; + numStartHoldTime.Value = (decimal)original.StartHold; + numEndHoldTime.Value = (decimal)original.EndHold; + checkEase.Checked = original.Ease; + } + catch + { + return false; + } + + return true; + } + private void numSpiralAmmount_ValueChanged(object sender, EventArgs e) { if (numSpiralAmmount.Value > 0) From 012f29726f2e0c73776b311458655585174bdd2c Mon Sep 17 00:00:00 2001 From: DragonirHD Date: Wed, 14 Dec 2022 23:49:51 +0100 Subject: [PATCH 3/6] - Added functionality to Element Move Up / Down Buttons --- MovementScriptGenerator/Form1.Designer.cs | 18 +++--- MovementScriptGenerator/Form1.cs | 75 ++++++++++++++++++++++- 2 files changed, 83 insertions(+), 10 deletions(-) diff --git a/MovementScriptGenerator/Form1.Designer.cs b/MovementScriptGenerator/Form1.Designer.cs index 45b3c79..344d508 100644 --- a/MovementScriptGenerator/Form1.Designer.cs +++ b/MovementScriptGenerator/Form1.Designer.cs @@ -469,6 +469,7 @@ private void InitializeComponent() this.tvChain.Name = "tvChain"; this.tvChain.Size = new System.Drawing.Size(478, 591); this.tvChain.TabIndex = 7; + this.tvChain.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvChain_AfterSelect); // // tableLayoutPanel19 // @@ -530,7 +531,7 @@ private void InitializeComponent() this.tableLayoutPanel20.RowCount = 1; this.tableLayoutPanel20.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel20.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); - this.tableLayoutPanel20.Size = new System.Drawing.Size(121, 40); + this.tableLayoutPanel20.Size = new System.Drawing.Size(121, 32); this.tableLayoutPanel20.TabIndex = 2; // // btnElementMoveDown @@ -540,10 +541,11 @@ private void InitializeComponent() this.btnElementMoveDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnElementMoveDown.Location = new System.Drawing.Point(63, 3); this.btnElementMoveDown.Name = "btnElementMoveDown"; - this.btnElementMoveDown.Size = new System.Drawing.Size(55, 34); + this.btnElementMoveDown.Size = new System.Drawing.Size(55, 26); this.btnElementMoveDown.TabIndex = 1; this.btnElementMoveDown.Text = "↓"; this.btnElementMoveDown.UseVisualStyleBackColor = true; + this.btnElementMoveDown.Click += new System.EventHandler(this.btnElementMoveDown_Click); // // btnElementMoveUp // @@ -552,17 +554,18 @@ private void InitializeComponent() this.btnElementMoveUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnElementMoveUp.Location = new System.Drawing.Point(3, 3); this.btnElementMoveUp.Name = "btnElementMoveUp"; - this.btnElementMoveUp.Size = new System.Drawing.Size(54, 34); + this.btnElementMoveUp.Size = new System.Drawing.Size(54, 26); this.btnElementMoveUp.TabIndex = 0; this.btnElementMoveUp.Text = "↑"; this.btnElementMoveUp.UseVisualStyleBackColor = true; + this.btnElementMoveUp.Click += new System.EventHandler(this.btnElementMoveUp_Click); // // btnElementDuplicate // this.btnElementDuplicate.Dock = System.Windows.Forms.DockStyle.Fill; this.btnElementDuplicate.Enabled = false; this.btnElementDuplicate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnElementDuplicate.Location = new System.Drawing.Point(3, 43); + this.btnElementDuplicate.Location = new System.Drawing.Point(3, 35); this.btnElementDuplicate.MinimumSize = new System.Drawing.Size(115, 0); this.btnElementDuplicate.Name = "btnElementDuplicate"; this.btnElementDuplicate.Size = new System.Drawing.Size(115, 23); @@ -575,7 +578,7 @@ private void InitializeComponent() this.btnElementEditSettings.Dock = System.Windows.Forms.DockStyle.Fill; this.btnElementEditSettings.Enabled = false; this.btnElementEditSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnElementEditSettings.Location = new System.Drawing.Point(3, 72); + this.btnElementEditSettings.Location = new System.Drawing.Point(3, 64); this.btnElementEditSettings.MinimumSize = new System.Drawing.Size(115, 0); this.btnElementEditSettings.Name = "btnElementEditSettings"; this.btnElementEditSettings.Size = new System.Drawing.Size(115, 23); @@ -589,20 +592,21 @@ private void InitializeComponent() this.btnElementApplySettings.Dock = System.Windows.Forms.DockStyle.Fill; this.btnElementApplySettings.Enabled = false; this.btnElementApplySettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnElementApplySettings.Location = new System.Drawing.Point(3, 101); + this.btnElementApplySettings.Location = new System.Drawing.Point(3, 93); this.btnElementApplySettings.MinimumSize = new System.Drawing.Size(115, 0); this.btnElementApplySettings.Name = "btnElementApplySettings"; this.btnElementApplySettings.Size = new System.Drawing.Size(115, 23); this.btnElementApplySettings.TabIndex = 6; this.btnElementApplySettings.Text = "Apply Settings"; this.btnElementApplySettings.UseVisualStyleBackColor = true; + this.btnElementApplySettings.Click += new System.EventHandler(this.btnElementApplySettings_Click); // // btnElementDelete // this.btnElementDelete.Dock = System.Windows.Forms.DockStyle.Fill; this.btnElementDelete.Enabled = false; this.btnElementDelete.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnElementDelete.Location = new System.Drawing.Point(3, 130); + this.btnElementDelete.Location = new System.Drawing.Point(3, 122); this.btnElementDelete.MinimumSize = new System.Drawing.Size(115, 0); this.btnElementDelete.Name = "btnElementDelete"; this.btnElementDelete.Size = new System.Drawing.Size(115, 23); diff --git a/MovementScriptGenerator/Form1.cs b/MovementScriptGenerator/Form1.cs index e9a25cd..03db1c3 100644 --- a/MovementScriptGenerator/Form1.cs +++ b/MovementScriptGenerator/Form1.cs @@ -85,9 +85,9 @@ private void ResetContent() private void UpdateChainWindow() { - foreach(ChainElement el in chain.Elements) + tvChain.Nodes.Clear(); + foreach (ChainElement el in chain.Elements) { - tvChain.Nodes.Clear(); tvChain.BeginUpdate(); tvChain.Nodes.Add(el.Name); tvChain.EndUpdate(); @@ -265,7 +265,7 @@ private void btnResetMoveControl_Click(object sender, EventArgs e) OnMoveTypeChanged(); } - private void btnApplySettingsToSelected_Click(object sender, EventArgs e) + private void btnElementApplySettings_Click(object sender, EventArgs e) { string newMoveName = txtMoveName.Text; if (!MoveNameValid(newMoveName)) @@ -363,5 +363,74 @@ private void btnElementEditSettings_Click(object sender, EventArgs e) txtMoveName.Text = selectedElementInChain.Name; } } + + private void tvChain_AfterSelect(object sender, TreeViewEventArgs e) + { + ChainElement selectedElementInChain = chain.Elements[tvChain.SelectedNode.Index]; + + if (typeof(Move).IsInstanceOfType(selectedElementInChain)) + { + EnableElementOptionsMoveType(); + return; + } + + DisableElementOptionsAll(); + } + + private void EnableElementOptionsMoveType() + { + btnElementMoveUp.Enabled = true; + btnElementMoveDown.Enabled = true; + btnElementEditSettings.Enabled = true; + btnElementApplySettings.Enabled = true; + btnElementDuplicate.Enabled = true; + btnElementDelete.Enabled = true; + } + + private void DisableElementOptionsAll() + { + btnElementMoveUp.Enabled = false; + btnElementMoveDown.Enabled = false; + btnElementEditSettings.Enabled = false; + btnElementApplySettings.Enabled = false; + btnElementDuplicate.Enabled = false; + btnElementDelete.Enabled = false; + } + + private void btnElementMoveUp_Click(object sender, EventArgs e) + { + if(tvChain.SelectedNode.Index != 0) + { + TreeNode selectedTreeElement = tvChain.SelectedNode; + ChainElement selectedChainElement = chain.Elements[selectedTreeElement.Index]; + + chain.Elements.Remove(selectedChainElement); + chain.Elements.Insert(selectedTreeElement.Index - 1, selectedChainElement); + + tvChain.BeginUpdate(); + tvChain.Nodes.Remove(selectedTreeElement); + tvChain.Nodes.Insert(selectedTreeElement.Index - 1, selectedTreeElement); + tvChain.SelectedNode = selectedTreeElement; + tvChain.EndUpdate(); + } + } + + private void btnElementMoveDown_Click(object sender, EventArgs e) + { + if (tvChain.SelectedNode.Index != tvChain.Nodes.Count -1) + { + TreeNode selectedTreeElement = tvChain.SelectedNode; + ChainElement selectedChainElement = chain.Elements[selectedTreeElement.Index]; + + chain.Elements.Remove(selectedChainElement); + chain.Elements.Insert(selectedTreeElement.Index + 1, selectedChainElement); + + tvChain.BeginUpdate(); + tvChain.Nodes.Remove(selectedTreeElement); + tvChain.Nodes.Insert(selectedTreeElement.Index + 1, selectedTreeElement); + tvChain.SelectedNode = selectedTreeElement; + tvChain.EndUpdate(); + } + } } } From 6997fac9d28357eff33b5b23729111ef9dd8b3b0 Mon Sep 17 00:00:00 2001 From: DragonirHD Date: Sun, 18 Dec 2022 01:06:36 +0100 Subject: [PATCH 4/6] - improved functionality of "Element Get Settings" and "Element Apply Settings" - Added functionality for Duplicate Element - Duplicate now creates a new element instead of referencing the original - Added icons for chain elements - Added enum for chain elements - tweaked ui - Added functionality to edit the save path via ui --- MovementScriptGenerator/ChainElementsEnum.cs | 11 + MovementScriptGenerator/Form1.Designer.cs | 166 ++++++----- MovementScriptGenerator/Form1.cs | 272 +++++++++++++----- MovementScriptGenerator/Form1.resx | 7 + .../Icons/0_Circle_Icon.png | Bin 0 -> 1807 bytes .../Icons/1_Spiral_Icon.png | Bin 0 -> 1956 bytes .../Icons/2_JTurn_Icon.png | Bin 0 -> 1718 bytes .../Modules/ChainElement.cs | 14 +- MovementScriptGenerator/Modules/Move.cs | 1 - .../Modules/Moves/Spiral.cs | 2 +- .../MovementScriptGenerator.csproj | 1 + 11 files changed, 310 insertions(+), 164 deletions(-) create mode 100644 MovementScriptGenerator/ChainElementsEnum.cs create mode 100644 MovementScriptGenerator/Icons/0_Circle_Icon.png create mode 100644 MovementScriptGenerator/Icons/1_Spiral_Icon.png create mode 100644 MovementScriptGenerator/Icons/2_JTurn_Icon.png diff --git a/MovementScriptGenerator/ChainElementsEnum.cs b/MovementScriptGenerator/ChainElementsEnum.cs new file mode 100644 index 0000000..96fc53c --- /dev/null +++ b/MovementScriptGenerator/ChainElementsEnum.cs @@ -0,0 +1,11 @@ + +namespace MovementScriptGenerator +{ + enum ChainElementsEnum + { + Circle, + Spiral, + JTurn, + Group + } +} diff --git a/MovementScriptGenerator/Form1.Designer.cs b/MovementScriptGenerator/Form1.Designer.cs index 344d508..9d0329e 100644 --- a/MovementScriptGenerator/Form1.Designer.cs +++ b/MovementScriptGenerator/Form1.Designer.cs @@ -36,8 +36,6 @@ private void InitializeComponent() this.tableLayoutPanel13 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel14 = new System.Windows.Forms.TableLayoutPanel(); this.label2 = new System.Windows.Forms.Label(); - this.tableLayoutPanel15 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel11 = new System.Windows.Forms.TableLayoutPanel(); this.txtPath = new System.Windows.Forms.TextBox(); this.lblPath = new System.Windows.Forms.Label(); this.btnGenerateScript = new System.Windows.Forms.Button(); @@ -63,7 +61,7 @@ private void InitializeComponent() this.btnElementMoveDown = new System.Windows.Forms.Button(); this.btnElementMoveUp = new System.Windows.Forms.Button(); this.btnElementDuplicate = new System.Windows.Forms.Button(); - this.btnElementEditSettings = new System.Windows.Forms.Button(); + this.btnElementGetSettings = new System.Windows.Forms.Button(); this.btnElementApplySettings = new System.Windows.Forms.Button(); this.btnElementDelete = new System.Windows.Forms.Button(); this.tableLayoutPanel16 = new System.Windows.Forms.TableLayoutPanel(); @@ -90,11 +88,11 @@ private void InitializeComponent() this.txtMoveName = new System.Windows.Forms.TextBox(); this.lblMoveName = new System.Windows.Forms.Label(); this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.tableLayoutPanel21 = new System.Windows.Forms.TableLayoutPanel(); + this.btnEditPath = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel13.SuspendLayout(); this.tableLayoutPanel14.SuspendLayout(); - this.tableLayoutPanel15.SuspendLayout(); - this.tableLayoutPanel11.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel10.SuspendLayout(); @@ -114,6 +112,7 @@ private void InitializeComponent() this.flowLayoutPanel2.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); this.tableLayoutPanel17.SuspendLayout(); + this.tableLayoutPanel21.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 @@ -131,7 +130,7 @@ private void InitializeComponent() this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 7.5F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 87.5F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(954, 811); + this.tableLayoutPanel1.Size = new System.Drawing.Size(894, 811); this.tableLayoutPanel1.TabIndex = 2; // // lblTitle @@ -141,7 +140,7 @@ private void InitializeComponent() this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblTitle.Location = new System.Drawing.Point(23, 0); this.lblTitle.Name = "lblTitle"; - this.lblTitle.Size = new System.Drawing.Size(908, 60); + this.lblTitle.Size = new System.Drawing.Size(848, 60); this.lblTitle.TabIndex = 0; this.lblTitle.Text = "MovementScriptGenerator"; this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -158,7 +157,7 @@ private void InitializeComponent() this.tableLayoutPanel13.Name = "tableLayoutPanel13"; this.tableLayoutPanel13.RowCount = 1; this.tableLayoutPanel13.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel13.Size = new System.Drawing.Size(908, 703); + this.tableLayoutPanel13.Size = new System.Drawing.Size(848, 703); this.tableLayoutPanel13.TabIndex = 7; // // tableLayoutPanel14 @@ -166,9 +165,9 @@ private void InitializeComponent() this.tableLayoutPanel14.ColumnCount = 1; this.tableLayoutPanel14.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel14.Controls.Add(this.label2, 0, 0); - this.tableLayoutPanel14.Controls.Add(this.tableLayoutPanel15, 0, 3); this.tableLayoutPanel14.Controls.Add(this.flowLayoutPanel1, 0, 1); this.tableLayoutPanel14.Controls.Add(this.tableLayoutPanel18, 0, 2); + this.tableLayoutPanel14.Controls.Add(this.tableLayoutPanel21, 0, 3); this.tableLayoutPanel14.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel14.Location = new System.Drawing.Point(303, 0); this.tableLayoutPanel14.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); @@ -178,7 +177,7 @@ private void InitializeComponent() this.tableLayoutPanel14.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); this.tableLayoutPanel14.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85F)); this.tableLayoutPanel14.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); - this.tableLayoutPanel14.Size = new System.Drawing.Size(605, 703); + this.tableLayoutPanel14.Size = new System.Drawing.Size(545, 703); this.tableLayoutPanel14.TabIndex = 4; // // label2 @@ -188,53 +187,19 @@ private void InitializeComponent() this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(3, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(599, 35); + this.label2.Size = new System.Drawing.Size(539, 35); this.label2.TabIndex = 5; this.label2.Text = "Move Chain"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // tableLayoutPanel15 - // - this.tableLayoutPanel15.ColumnCount = 2; - this.tableLayoutPanel15.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); - this.tableLayoutPanel15.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel15.Controls.Add(this.tableLayoutPanel11, 0, 0); - this.tableLayoutPanel15.Controls.Add(this.btnGenerateScript, 1, 0); - this.tableLayoutPanel15.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel15.Location = new System.Drawing.Point(0, 667); - this.tableLayoutPanel15.Margin = new System.Windows.Forms.Padding(0); - this.tableLayoutPanel15.MinimumSize = new System.Drawing.Size(0, 30); - this.tableLayoutPanel15.Name = "tableLayoutPanel15"; - this.tableLayoutPanel15.RowCount = 1; - this.tableLayoutPanel15.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel15.Size = new System.Drawing.Size(605, 36); - this.tableLayoutPanel15.TabIndex = 0; - // - // tableLayoutPanel11 - // - this.tableLayoutPanel11.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel11.ColumnCount = 2; - this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); - this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel11.Controls.Add(this.txtPath, 1, 0); - this.tableLayoutPanel11.Controls.Add(this.lblPath, 0, 0); - this.tableLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel11.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel11.Margin = new System.Windows.Forms.Padding(0); - this.tableLayoutPanel11.Name = "tableLayoutPanel11"; - this.tableLayoutPanel11.RowCount = 1; - this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel11.Size = new System.Drawing.Size(484, 36); - this.tableLayoutPanel11.TabIndex = 6; - // // txtPath // - this.txtPath.Dock = System.Windows.Forms.DockStyle.Bottom; - this.txtPath.Location = new System.Drawing.Point(43, 13); + this.txtPath.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtPath.Location = new System.Drawing.Point(164, 3); this.txtPath.Name = "txtPath"; - this.txtPath.Size = new System.Drawing.Size(438, 20); + this.txtPath.Size = new System.Drawing.Size(257, 20); this.txtPath.TabIndex = 1; - this.txtPath.Text = "D:\\SteamLibrary\\steamapps\\common\\Beat Saber\\UserData\\Camera2\\MovementScripts\\"; + this.txtPath.Text = "D:\\SteamLibrary\\steamapps\\common\\Beat Saber\\UserData\\Camera2\\MovementScripts"; // // lblPath // @@ -245,15 +210,15 @@ private void InitializeComponent() this.lblPath.Size = new System.Drawing.Size(34, 36); this.lblPath.TabIndex = 0; this.lblPath.Text = "Path:"; - this.lblPath.TextAlign = System.Drawing.ContentAlignment.BottomLeft; - this.ToolTip.SetToolTip(this.lblPath, "Only edit this if you want to change the directory/path where the file will be sa" + - "ved"); + this.lblPath.TextAlign = System.Drawing.ContentAlignment.TopCenter; + this.ToolTip.SetToolTip(this.lblPath, resources.GetString("lblPath.ToolTip")); // // btnGenerateScript // - this.btnGenerateScript.Location = new System.Drawing.Point(487, 3); + this.btnGenerateScript.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnGenerateScript.Location = new System.Drawing.Point(427, 3); this.btnGenerateScript.Name = "btnGenerateScript"; - this.btnGenerateScript.Size = new System.Drawing.Size(97, 30); + this.btnGenerateScript.Size = new System.Drawing.Size(115, 30); this.btnGenerateScript.TabIndex = 1; this.btnGenerateScript.Text = "Generate Script"; this.btnGenerateScript.UseVisualStyleBackColor = true; @@ -270,7 +235,7 @@ private void InitializeComponent() this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel1.MinimumSize = new System.Drawing.Size(0, 30); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(605, 35); + this.flowLayoutPanel1.Size = new System.Drawing.Size(545, 35); this.flowLayoutPanel1.TabIndex = 6; // // tableLayoutPanel2 @@ -448,8 +413,8 @@ private void InitializeComponent() // tableLayoutPanel18 // this.tableLayoutPanel18.ColumnCount = 2; - this.tableLayoutPanel18.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); - this.tableLayoutPanel18.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel18.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel18.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 121F)); this.tableLayoutPanel18.Controls.Add(this.tvChain, 0, 0); this.tableLayoutPanel18.Controls.Add(this.tableLayoutPanel19, 1, 0); this.tableLayoutPanel18.Dock = System.Windows.Forms.DockStyle.Fill; @@ -458,16 +423,17 @@ private void InitializeComponent() this.tableLayoutPanel18.Name = "tableLayoutPanel18"; this.tableLayoutPanel18.RowCount = 1; this.tableLayoutPanel18.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel18.Size = new System.Drawing.Size(605, 597); + this.tableLayoutPanel18.Size = new System.Drawing.Size(545, 597); this.tableLayoutPanel18.TabIndex = 7; // // tvChain // this.tvChain.Dock = System.Windows.Forms.DockStyle.Fill; + this.tvChain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tvChain.HideSelection = false; this.tvChain.Location = new System.Drawing.Point(3, 3); this.tvChain.Name = "tvChain"; - this.tvChain.Size = new System.Drawing.Size(478, 591); + this.tvChain.Size = new System.Drawing.Size(418, 591); this.tvChain.TabIndex = 7; this.tvChain.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvChain_AfterSelect); // @@ -479,7 +445,7 @@ private void InitializeComponent() this.tableLayoutPanel19.Controls.Add(this.lblElementOptions, 0, 0); this.tableLayoutPanel19.Controls.Add(this.flowLayoutPanel4, 0, 1); this.tableLayoutPanel19.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel19.Location = new System.Drawing.Point(484, 0); + this.tableLayoutPanel19.Location = new System.Drawing.Point(424, 0); this.tableLayoutPanel19.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel19.Name = "tableLayoutPanel19"; this.tableLayoutPanel19.RowCount = 2; @@ -506,7 +472,7 @@ private void InitializeComponent() this.flowLayoutPanel4.AutoScroll = true; this.flowLayoutPanel4.Controls.Add(this.tableLayoutPanel20); this.flowLayoutPanel4.Controls.Add(this.btnElementDuplicate); - this.flowLayoutPanel4.Controls.Add(this.btnElementEditSettings); + this.flowLayoutPanel4.Controls.Add(this.btnElementGetSettings); this.flowLayoutPanel4.Controls.Add(this.btnElementApplySettings); this.flowLayoutPanel4.Controls.Add(this.btnElementDelete); this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; @@ -530,7 +496,7 @@ private void InitializeComponent() this.tableLayoutPanel20.Name = "tableLayoutPanel20"; this.tableLayoutPanel20.RowCount = 1; this.tableLayoutPanel20.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel20.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel20.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); this.tableLayoutPanel20.Size = new System.Drawing.Size(121, 32); this.tableLayoutPanel20.TabIndex = 2; // @@ -572,20 +538,21 @@ private void InitializeComponent() this.btnElementDuplicate.TabIndex = 3; this.btnElementDuplicate.Text = "Duplicate"; this.btnElementDuplicate.UseVisualStyleBackColor = true; - // - // btnElementEditSettings - // - this.btnElementEditSettings.Dock = System.Windows.Forms.DockStyle.Fill; - this.btnElementEditSettings.Enabled = false; - this.btnElementEditSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnElementEditSettings.Location = new System.Drawing.Point(3, 64); - this.btnElementEditSettings.MinimumSize = new System.Drawing.Size(115, 0); - this.btnElementEditSettings.Name = "btnElementEditSettings"; - this.btnElementEditSettings.Size = new System.Drawing.Size(115, 23); - this.btnElementEditSettings.TabIndex = 5; - this.btnElementEditSettings.Text = "Edit Settings"; - this.btnElementEditSettings.UseVisualStyleBackColor = true; - this.btnElementEditSettings.Click += new System.EventHandler(this.btnElementEditSettings_Click); + this.btnElementDuplicate.Click += new System.EventHandler(this.btnElementDuplicate_Click); + // + // btnElementGetSettings + // + this.btnElementGetSettings.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnElementGetSettings.Enabled = false; + this.btnElementGetSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnElementGetSettings.Location = new System.Drawing.Point(3, 64); + this.btnElementGetSettings.MinimumSize = new System.Drawing.Size(115, 0); + this.btnElementGetSettings.Name = "btnElementGetSettings"; + this.btnElementGetSettings.Size = new System.Drawing.Size(115, 23); + this.btnElementGetSettings.TabIndex = 5; + this.btnElementGetSettings.Text = "Get Settings"; + this.btnElementGetSettings.UseVisualStyleBackColor = true; + this.btnElementGetSettings.Click += new System.EventHandler(this.btnElementEditSettings_Click); // // btnElementApplySettings // @@ -613,6 +580,7 @@ private void InitializeComponent() this.btnElementDelete.TabIndex = 4; this.btnElementDelete.Text = "Delete"; this.btnElementDelete.UseVisualStyleBackColor = true; + this.btnElementDelete.Click += new System.EventHandler(this.btnElementDelete_Click); // // tableLayoutPanel16 // @@ -945,14 +913,45 @@ private void InitializeComponent() this.ToolTip.IsBalloon = true; this.ToolTip.ReshowDelay = 100; // + // tableLayoutPanel21 + // + this.tableLayoutPanel21.ColumnCount = 4; + this.tableLayoutPanel21.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel21.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 121F)); + this.tableLayoutPanel21.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel21.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 121F)); + this.tableLayoutPanel21.Controls.Add(this.btnEditPath, 1, 0); + this.tableLayoutPanel21.Controls.Add(this.txtPath, 2, 0); + this.tableLayoutPanel21.Controls.Add(this.btnGenerateScript, 3, 0); + this.tableLayoutPanel21.Controls.Add(this.lblPath, 0, 0); + this.tableLayoutPanel21.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel21.Location = new System.Drawing.Point(0, 667); + this.tableLayoutPanel21.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel21.Name = "tableLayoutPanel21"; + this.tableLayoutPanel21.RowCount = 1; + this.tableLayoutPanel21.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel21.Size = new System.Drawing.Size(545, 36); + this.tableLayoutPanel21.TabIndex = 8; + // + // btnEditPath + // + this.btnEditPath.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnEditPath.Location = new System.Drawing.Point(43, 3); + this.btnEditPath.Name = "btnEditPath"; + this.btnEditPath.Size = new System.Drawing.Size(115, 30); + this.btnEditPath.TabIndex = 2; + this.btnEditPath.Text = "Edit Path"; + this.btnEditPath.UseVisualStyleBackColor = true; + this.btnEditPath.Click += new System.EventHandler(this.btnEditPath_Click); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(954, 811); + this.ClientSize = new System.Drawing.Size(894, 811); this.Controls.Add(this.tableLayoutPanel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(970, 100); + this.MinimumSize = new System.Drawing.Size(910, 100); this.Name = "Main"; this.Text = "MovementScriptGenerator"; this.tableLayoutPanel1.ResumeLayout(false); @@ -960,9 +959,6 @@ private void InitializeComponent() this.tableLayoutPanel13.ResumeLayout(false); this.tableLayoutPanel14.ResumeLayout(false); this.tableLayoutPanel14.PerformLayout(); - this.tableLayoutPanel15.ResumeLayout(false); - this.tableLayoutPanel11.ResumeLayout(false); - this.tableLayoutPanel11.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); this.tableLayoutPanel2.ResumeLayout(false); @@ -996,6 +992,8 @@ private void InitializeComponent() this.tableLayoutPanel4.PerformLayout(); this.tableLayoutPanel17.ResumeLayout(false); this.tableLayoutPanel17.PerformLayout(); + this.tableLayoutPanel21.ResumeLayout(false); + this.tableLayoutPanel21.PerformLayout(); this.ResumeLayout(false); } @@ -1019,7 +1017,6 @@ private void InitializeComponent() private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel10; private System.Windows.Forms.Label lblSyncToSong; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel11; private System.Windows.Forms.CheckBox checkSyncToSong; private System.Windows.Forms.Label lblMoveDescriptionTitle; private System.Windows.Forms.Label lblMoveDescription; @@ -1035,7 +1032,6 @@ private void InitializeComponent() private System.Windows.Forms.TableLayoutPanel tableLayoutPanel13; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel14; private System.Windows.Forms.Label label2; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel15; private System.Windows.Forms.Button btnAddMoveToChain; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel16; private System.Windows.Forms.Label label1; @@ -1058,9 +1054,11 @@ private void InitializeComponent() private System.Windows.Forms.TableLayoutPanel tableLayoutPanel20; private System.Windows.Forms.Button btnElementMoveDown; private System.Windows.Forms.Button btnElementDuplicate; - private System.Windows.Forms.Button btnElementEditSettings; + private System.Windows.Forms.Button btnElementGetSettings; private System.Windows.Forms.Button btnElementApplySettings; private System.Windows.Forms.Button btnElementDelete; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel21; + private System.Windows.Forms.Button btnEditPath; } } diff --git a/MovementScriptGenerator/Form1.cs b/MovementScriptGenerator/Form1.cs index 03db1c3..32542b3 100644 --- a/MovementScriptGenerator/Form1.cs +++ b/MovementScriptGenerator/Form1.cs @@ -16,29 +16,27 @@ public partial class Main : Form private static readonly char[] illegalCharsForExplorer = "/<>:/\\\"|?*".ToCharArray(); + private static readonly DirectoryInfo iconsDirectory = new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.GetDirectories().Where(directory => directory.Name == "Icons").FirstOrDefault(); + private static readonly string iconsDataType = ".png"; + Chain chain = new Chain() { Elements = new List() }; - List moveTypes = new List() - { - "circle", - "spiral", - "J-Turn" - }; - List moveDescriptions = new List() { "The camera will move in a circle around the player.", "The camera will move from the starting distance to the end distance while spinning around its axis, creating a spiralling shot.", - "The camera will move from the given direction towards the player. Then at a surtain point, it will do a 180 degree turn, making the move into something that resembles a J.\nCurrently not implemented!" + "The camera will move from the given direction towards the player. Then at a surtain point, it will do a 180 degree turn, making the move into something that resembles a J.\nCurrently not implemented!", + "Groups multiple moves together.\nCurrently not implemented!" }; public Main() { InitializeComponent(); InitializeComboBoxes(); + InitializeChainWindow(); UpdateDescription(); OnMoveTypeChanged(); UpdateChainWindow(); @@ -46,10 +44,22 @@ public Main() private void InitializeComboBoxes() { - cbType.DataSource = moveTypes; + cbType.DataSource = Enum.GetNames(typeof(ChainElementsEnum)); cbType.SelectedIndex = 0; } + private void InitializeChainWindow() + { + ImageList chainElementIcons = new ImageList(); + chainElementIcons.ImageSize = new System.Drawing.Size(32, 32); + FileInfo[] archives = iconsDirectory.GetFiles($"*{iconsDataType}"); + foreach(FileInfo iconInfo in archives) + { + chainElementIcons.Images.Add(System.Drawing.Image.FromFile(iconInfo.FullName)); + } + tvChain.ImageList = chainElementIcons; + } + private void UpdateDescription() { lblMoveDescription.Text = moveDescriptions[cbType.SelectedIndex]; @@ -72,6 +82,10 @@ private void OnMoveTypeChanged() private void ResetContent() { txtMoveName.Text = string.Empty; + if(tlContent.Controls.Count == 0) + { + return; + } switch (tlContent.Controls[0]) { case CircleControl _: @@ -80,81 +94,84 @@ private void ResetContent() case SpiralControl _: spiralControl = new SpiralControl(); break; + default: + break; } } private void UpdateChainWindow() { + tvChain.BeginUpdate(); tvChain.Nodes.Clear(); foreach (ChainElement el in chain.Elements) { - tvChain.BeginUpdate(); - tvChain.Nodes.Add(el.Name); - tvChain.EndUpdate(); + tvChain.Nodes.Add(string.Empty, el.Name, el.IconIndex, el.IconIndex); } + if (tvChain.Nodes.Count > 0) + { + tvChain.SelectedNode = tvChain.Nodes[tvChain.Nodes.Count - 1]; + } + if (tvChain.SelectedNode == null) + { + DisableElementOptionsAll(); + } + tvChain.EndUpdate(); } - private bool GenerateMovementScriptFile(MovementScript script, string filePath) + private void UpdateChainWindow(int indexOfNodeToBeSelected) { - if (File.Exists(filePath)) + //TODO Dont scroll to top on update + tvChain.BeginUpdate(); + tvChain.Nodes.Clear(); + foreach (ChainElement el in chain.Elements) { - if(MessageBox.Show("A file with the given name already exists.\nWould you like to overwrite that file?", "Overwrite existing File", MessageBoxButtons.YesNo) == DialogResult.No) - { - return false; - } + tvChain.Nodes.Add(string.Empty, el.Name, el.IconIndex, el.IconIndex); } - - try + if(indexOfNodeToBeSelected < tvChain.Nodes.Count) { - using (StreamWriter file = File.CreateText(filePath)) + tvChain.SelectedNode = tvChain.Nodes[indexOfNodeToBeSelected]; + } + else + { + if(tvChain.Nodes.Count > 0) { - JsonSerializer serializer = new JsonSerializer(); - serializer.Formatting = Formatting.Indented; - - serializer.Serialize(file, script); + tvChain.SelectedNode = tvChain.Nodes[tvChain.Nodes.Count - 1]; } - return true; } - catch + if(tvChain.SelectedNode == null) { - MessageBox.Show($"Something went wrong while generating the file.\nPlease make sure that the file name and file path are viable and don't contain any not allowed characters."); - return false; + DisableElementOptionsAll(); } - + tvChain.EndUpdate(); } - private bool AddToMovementScriptFile(MovementScript script, string filePath) + private bool GenerateMovementScriptFile(MovementScript script, string filePath) { - JsonSerializer serializer = new JsonSerializer(); - - if (!File.Exists(filePath)) + if (File.Exists(filePath)) { - MessageBox.Show("File doesn't exist!"); - return false; + if(MessageBox.Show("A file with the given name already exists.\nWould you like to overwrite that file?", "Overwrite existing File", MessageBoxButtons.YesNo) == DialogResult.No) + { + return false; + } } - string previousFileContent = File.ReadAllText(filePath); - try { - MovementScript previousMovementScript = JsonConvert.DeserializeObject(previousFileContent); - - script.Frames.InsertRange(0, previousMovementScript.Frames); - using (StreamWriter file = File.CreateText(filePath)) { + JsonSerializer serializer = new JsonSerializer(); serializer.Formatting = Formatting.Indented; serializer.Serialize(file, script); } - return true; } catch { - MessageBox.Show("Move could not be added.\nMake sure that the file is a correct MovementScript file."); + MessageBox.Show($"Something went wrong while generating the file.\nPlease make sure that the file name and file path are viable and don't contain any not allowed characters."); return false; - }; + } + } private void cbType_SelectedIndexChanged(object sender, EventArgs e) @@ -173,11 +190,11 @@ private void btnAddMoveToChain_Click(object sender, EventArgs e) switch (cbType.SelectedIndex) { - case 0: + case (int)ChainElementsEnum.Circle: Circle circle = circleControl.CreateMove(moveName); chain.Elements.Add(circle); break; - case 1: + case (int)ChainElementsEnum.Spiral: Spiral spiral = spiralControl.CreateMove(moveName); chain.Elements.Add(spiral); break; @@ -186,14 +203,14 @@ private void btnAddMoveToChain_Click(object sender, EventArgs e) return; } - tvChain.Nodes.Add(chain.Elements.Last().Name); + UpdateChainWindow(); } private void btnGenerateScript_Click(object sender, EventArgs e) { - string filePath = $@"{txtPath.Text}{txtFileName.Text}.Json"; + string filePath = $@"{txtPath.Text}\{txtFileName.Text}.Json"; - if (txtFileName.Text.Replace(" ", String.Empty) == "") + if (txtFileName.Text.Replace(" ", string.Empty) == "") { MessageBox.Show("Filename is missing!"); txtFileName.Focus(); @@ -259,6 +276,40 @@ private void btnGenerateScript_Click(object sender, EventArgs e) } } + private bool AddToMovementScriptFile(MovementScript script, string filePath) + { + JsonSerializer serializer = new JsonSerializer(); + + if (!File.Exists(filePath)) + { + MessageBox.Show("File doesn't exist!"); + return false; + } + + string previousFileContent = File.ReadAllText(filePath); + + try + { + MovementScript previousMovementScript = JsonConvert.DeserializeObject(previousFileContent); + + script.Frames.InsertRange(0, previousMovementScript.Frames); + + using (StreamWriter file = File.CreateText(filePath)) + { + serializer.Formatting = Formatting.Indented; + + serializer.Serialize(file, script); + } + + return true; + } + catch + { + MessageBox.Show("Move could not be added.\nMake sure that the file is a correct MovementScript file."); + return false; + }; + } + private void btnResetMoveControl_Click(object sender, EventArgs e) { ResetContent(); @@ -284,12 +335,11 @@ private void btnElementApplySettings_Click(object sender, EventArgs e) switch (cbType.SelectedIndex) { - case 0: + case (int)ChainElementsEnum.Circle: if(selectedElement is Circle) { Circle circle = circleControl.CreateMove(newMoveName); chain.Elements[selectedNode.Index] = circle; - selectedElement = circle; } else { @@ -297,11 +347,11 @@ private void btnElementApplySettings_Click(object sender, EventArgs e) return; } break; - case 1: + case (int)ChainElementsEnum.Spiral: if(selectedElement is Spiral) { Spiral spiral = spiralControl.CreateMove(newMoveName); - selectedElement = spiral; + chain.Elements[selectedNode.Index] = spiral; } else { @@ -315,7 +365,7 @@ private void btnElementApplySettings_Click(object sender, EventArgs e) return; } - UpdateChainWindow(); + UpdateChainWindow(selectedNode.Index); } catch { @@ -325,7 +375,7 @@ private void btnElementApplySettings_Click(object sender, EventArgs e) private bool MoveNameValid(string moveName) { - if (moveName.Replace(" ", String.Empty) == "") + if (moveName.Replace(" ", string.Empty) == "") { return false; } @@ -341,14 +391,16 @@ private void btnElementEditSettings_Click(object sender, EventArgs e) return; } ChainElement selectedElementInChain = chain.Elements[tvChain.SelectedNode.Index]; - bool populatingOfFieldsSuccessful = true; + bool populatingOfFieldsSuccessful; switch (selectedElementInChain) { case Circle circleElement: populatingOfFieldsSuccessful = circleControl.Populate(circleElement); + cbType.SelectedIndex = (int)ChainElementsEnum.Circle; break; case Spiral spiralElement: populatingOfFieldsSuccessful = spiralControl.Populate(spiralElement); + cbType.SelectedIndex = (int)ChainElementsEnum.Spiral; break; default: MessageBox.Show("Can't get the settings of the selected element."); @@ -381,7 +433,7 @@ private void EnableElementOptionsMoveType() { btnElementMoveUp.Enabled = true; btnElementMoveDown.Enabled = true; - btnElementEditSettings.Enabled = true; + btnElementGetSettings.Enabled = true; btnElementApplySettings.Enabled = true; btnElementDuplicate.Enabled = true; btnElementDelete.Enabled = true; @@ -391,7 +443,7 @@ private void DisableElementOptionsAll() { btnElementMoveUp.Enabled = false; btnElementMoveDown.Enabled = false; - btnElementEditSettings.Enabled = false; + btnElementGetSettings.Enabled = false; btnElementApplySettings.Enabled = false; btnElementDuplicate.Enabled = false; btnElementDelete.Enabled = false; @@ -399,37 +451,103 @@ private void DisableElementOptionsAll() private void btnElementMoveUp_Click(object sender, EventArgs e) { - if(tvChain.SelectedNode.Index != 0) + TreeNode selectedNode = tvChain.SelectedNode; + if (selectedNode == null) { - TreeNode selectedTreeElement = tvChain.SelectedNode; - ChainElement selectedChainElement = chain.Elements[selectedTreeElement.Index]; + MessageBox.Show("No element selected.\nPlease select an element from the chain."); + return; + } + if (selectedNode.Index != 0) + { + ChainElement selectedChainElement = chain.Elements[selectedNode.Index]; chain.Elements.Remove(selectedChainElement); - chain.Elements.Insert(selectedTreeElement.Index - 1, selectedChainElement); + chain.Elements.Insert(selectedNode.Index - 1, selectedChainElement); - tvChain.BeginUpdate(); - tvChain.Nodes.Remove(selectedTreeElement); - tvChain.Nodes.Insert(selectedTreeElement.Index - 1, selectedTreeElement); - tvChain.SelectedNode = selectedTreeElement; - tvChain.EndUpdate(); + UpdateChainWindow(selectedNode.Index - 1); } } private void btnElementMoveDown_Click(object sender, EventArgs e) { - if (tvChain.SelectedNode.Index != tvChain.Nodes.Count -1) + TreeNode selectedNode = tvChain.SelectedNode; + if (selectedNode == null) { - TreeNode selectedTreeElement = tvChain.SelectedNode; - ChainElement selectedChainElement = chain.Elements[selectedTreeElement.Index]; + MessageBox.Show("No element selected.\nPlease select an element from the chain."); + return; + } + if (selectedNode.Index != tvChain.Nodes.Count -1) + { + ChainElement selectedChainElement = chain.Elements[selectedNode.Index]; chain.Elements.Remove(selectedChainElement); - chain.Elements.Insert(selectedTreeElement.Index + 1, selectedChainElement); + chain.Elements.Insert(selectedNode.Index + 1, selectedChainElement); - tvChain.BeginUpdate(); - tvChain.Nodes.Remove(selectedTreeElement); - tvChain.Nodes.Insert(selectedTreeElement.Index + 1, selectedTreeElement); - tvChain.SelectedNode = selectedTreeElement; - tvChain.EndUpdate(); + UpdateChainWindow(selectedNode.Index + 1); + } + } + + private void btnElementDuplicate_Click(object sender, EventArgs e) + { + TreeNode selectedNode = tvChain.SelectedNode; + if (selectedNode == null) + { + MessageBox.Show("No element selected.\nPlease select an element from the chain."); + return; + } + ChainElement selectedChainElement = chain.Elements[selectedNode.Index]; + switch (selectedChainElement) + { + case Circle circleElement: + selectedChainElement = circleElement.Clone(); + break; + case Spiral spiralElement: + selectedChainElement = spiralElement.Clone(); + break; + default: + MessageBox.Show("Can't duplicate the selected element."); + return; + } + + if (selectedNode.Index == tvChain.Nodes.Count - 1) + { + chain.Elements.Add(selectedChainElement); + } + else + { + chain.Elements.Insert(selectedNode.Index + 1, selectedChainElement); + } + + UpdateChainWindow(selectedNode.Index); + } + + private void btnElementDelete_Click(object sender, EventArgs e) + { + TreeNode selectedNode = tvChain.SelectedNode; + if (selectedNode == null) + { + MessageBox.Show("No element selected.\nPlease select an element from the chain."); + return; + } + chain.Elements.RemoveAt(selectedNode.Index); + + if(selectedNode.Index == 0) + { + UpdateChainWindow(); + } + else + { + UpdateChainWindow(selectedNode.Index -1); + } + } + + private void btnEditPath_Click(object sender, EventArgs e) + { + FolderBrowserDialog dialog = new FolderBrowserDialog(); + DialogResult result = dialog.ShowDialog(); + if(result == DialogResult.OK) + { + txtPath.Text = dialog.SelectedPath; } } } diff --git a/MovementScriptGenerator/Form1.resx b/MovementScriptGenerator/Form1.resx index 44d9a53..a3e82e4 100644 --- a/MovementScriptGenerator/Form1.resx +++ b/MovementScriptGenerator/Form1.resx @@ -120,6 +120,13 @@ 17, 17 + + The path of the directory in which the Movement Script File will be saved. +Make sure to save the Files to the correct directory, else the camera2 mod will not be able +to get them. +The path should be something like this: +D:\SteamLibrary\steamapps\common\Beat Saber\UserData\Camera2\MovementScripts + 17, 17 diff --git a/MovementScriptGenerator/Icons/0_Circle_Icon.png b/MovementScriptGenerator/Icons/0_Circle_Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ab849b6140003404a4efbc30312bb6c6d2e16d GIT binary patch literal 1807 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|GzJE?Yo0ESAr*{oZy)rNHRNFp zi2C?{{~f)XHa{0K9xu09uI*A$STrZjm8+)ahkFA9BNGdUfP%v)gRDT<$MUbH_T_5D z#(L+{;8Rx3&2xWPM?_~bv9z(W94KI(qHdt6z@YZ^s+xh00z;eh0-HupMn;2`>&+Sy zf%F}Qr<^`q91WheTRC~SE1GNXH!RlG$wZ(C}U*Yu=nsc_XPq1 z46J>MOt*n1f8)C?-{|DPAY#$Rks~g^aN9bko`s8%G2nrO(uUXvocT*$zW?F>!tv{W zk9w`S&kW5Q(h@EUdx!}zoV>fyjOi>B(*nsGUsxuwvN#l#ujzHz+`y2*W@g)%!pJz` zj%>E_1)ytZHTwE1L?#@TF8OZ#iEZ%{;~RU;o-Yey_P6~GiV6%|GR`d9xbHmdy>0#OTd>9M{qFPi z%^PkWUT)PG2n>Z&>n$21f%NP3MDQEWUwoC`b^l?x>^YAWpS&L2{rTdbZDV-0)i+!7 zhU6<;f+vIp7%FWyDlr{rVL4!!)ynaNlcQnJya>U@WG1Eu5?h^EKC!Sk#QCr3IAF-g zSkM!t$W+Pn{+@&Xnjg#Gui>n=c(}xE*@3m^*GoG*TewM!$sK5nV45pO3NW6|?28a> zR0bNuu~~`52pD*2@oTyc2m+01i4pCPI^0hn5hekX;p^l{vI znEx{W@Aqr&yH~9p z@bx<^hk)*?Xx8a>Sl+o{^MnBUhOznf6-^ZPs3*5+sWoR5os=MkBA z92j!mZ}=;y0Zb#1%$L99vuxe3_mURP&FL3-69nQjnJxo^WEb-*VF?idhUOn$!ZU#R z>auLW`~wRb7$lB_&pNQBfnmnGhF>gfz^tmU@6u=iOKC0BsM7eq@ucXjt`qC-0xLQO MPgg&ebxsLQ0IL}f@Bjb+ literal 0 HcmV?d00001 diff --git a/MovementScriptGenerator/Icons/1_Spiral_Icon.png b/MovementScriptGenerator/Icons/1_Spiral_Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b44c9da87cf52da251456382a0c8f2256996158c GIT binary patch literal 1956 zcmeHIYfw{H5I*;EfSY818^G``SJA>~9krtd5zG|>0j337jYf?_PzH*XAyj!th};Mi z+5v)Xr5zGOI#NfmRYZCD;Gv^4YULqF1eJ&&Ac8jizr7D zELCsCt1KZsx=>z7`%ob8qbzukLonU*Vh>d$4YK{MSRK3&W$3b23&+H4ooV6}?(Nf9r-@_OXdvU0+L&d3GAyoNK9%TX(I# zZAu4%1MjdLc_hfuoL`T7Vc1&xPs8;U4Dfj>{f+C)BHojp)J5|y?2YHEItOR?-|7TM z@u99%u|t{@2{z)YJBW&;$&;vmk1e1ps{77^U49rQvm?Jkz+L%Kui$lS`9eU^ynE*I zLw1GPyg~&o$$Q-iE0ObvN97irgL)n)t@*fU9}Qy0il(>{L?iFT)eWi<9H$hyzpEPq zF|2|#{K1NGl3OVL5>J7YL*$oCr z5)WD7@hD1nr^Hz`g}A?Q$%QCeLW20c2clsoCu5Hw$p6-K?%=rAY`EXvHrUZS`(il7 z#YVYt=1pbDkNuA0u;}udok21u1fFv_l;}rl*)+Fb3{$uyxVBc4O^2g|?{o1r2QXip z6hvjB3~E7r&fs&yT&_VqV2sYVvLI)jKD;o#KWo&|AG>12fgj?s`PnXo0&#GR1BMXw zeyLHTqX_@pYM{T&fT5?#sv6X?(Hg)s&*&aSO|YK;CsI0C|rhNdNc7w>vEna6h_v%?U9i3u3A{)4 xlA8x1U3MU!PD0~zz3JYEAO3%Dw?j*2?A#J|eAXuPxQn(g2n`AsUI>&O{|7&KXTJad literal 0 HcmV?d00001 diff --git a/MovementScriptGenerator/Icons/2_JTurn_Icon.png b/MovementScriptGenerator/Icons/2_JTurn_Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..19bb52bc0c94c7bcc787f8e6346212a79427bc97 GIT binary patch literal 1718 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|GzJE?T2B|pkP61PceDGh8t||M zIJ~JpeSpj3>XlEg&)mPaA*0jB}UyK!hwNDZrwGGIV>y(JWrHjQSjjV zgL_-t9&k5aw)`jl-Q)IQX$Psj(!wXi1sHxB2QW68FfvYXdw-1O6Dy0uKb{Z=1z!h- zB^P%aHr4tiZUjQmLk(+mk^9~nBL$u>-P7|Oh zz3t0On6@)9JqWu{#ncOQ^5ch^a}TU-VAvtLWu8NFBVYQQbB)sW3IDy!_aFNFnT=%k zC@^sGyJxa2V%4hQSNJt&hg1K>;+{M9Rd&m7oqexTQg~PT0PDP^EW3ancqbfU-^k6# zSkRcR+4zo$X~A!ntNst192jCAM0zdQ-N5j|&he}84gmoM@rr3eFZ2u^{%0-l`}2SK z1d_Y#$WNkKnv@S|9l%5#oyE&{;vkouRdni0nNGbkL5-E z)&_9emr)cLoP+2crgHq%WeCWUIIcm4{24h$-fcAGZl03*+q z@w@s24Fv|Fk9TJ|Y-?aRF|Xmbu!o2ML+6h?Uxnxc-x(gMKajD%cSAOgtAe?LGhMQg zlZh$ekjPhu2TL0mh!zn2x2*1q<D_T@QD@f;it`XX-~7p!bx$gr|V75)JX@tTDh{7k;U z*Z|G&Us}_5z=4s`pkPIm(uWWS z2Aip$ESZ>rfqh_MR_B3Wpmiaqo^$X3gNeC)l`5?=_-OfwREZ>PKM?QVEO?kXyyq^k PK4S26^>bP0l+XkKLMY$} literal 0 HcmV?d00001 diff --git a/MovementScriptGenerator/Modules/ChainElement.cs b/MovementScriptGenerator/Modules/ChainElement.cs index 61a1d96..fac16e4 100644 --- a/MovementScriptGenerator/Modules/ChainElement.cs +++ b/MovementScriptGenerator/Modules/ChainElement.cs @@ -1,12 +1,24 @@  +using System; + namespace MovementScriptGenerator.Modules { - public class ChainElement + public abstract class ChainElement { public ChainElement(string name) { Name = name; + IconIndex = (int)Enum.Parse(typeof(ChainElementsEnum), GetType().Name); } public string Name { get; set; } + + public int IconIndex { get; } + + public T Clone() + { + var inst = GetType().GetMethod("MemberwiseClone", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + + return (T)inst?.Invoke(this, null); + } } } diff --git a/MovementScriptGenerator/Modules/Move.cs b/MovementScriptGenerator/Modules/Move.cs index 413ef99..1a8b552 100644 --- a/MovementScriptGenerator/Modules/Move.cs +++ b/MovementScriptGenerator/Modules/Move.cs @@ -17,6 +17,5 @@ public Move(string name, int fov, float duration, float height) : base(name) public float Height { get; set; } public abstract List GenerateFrames(); - } } diff --git a/MovementScriptGenerator/Modules/Moves/Spiral.cs b/MovementScriptGenerator/Modules/Moves/Spiral.cs index ef0930a..1bfd2f8 100644 --- a/MovementScriptGenerator/Modules/Moves/Spiral.cs +++ b/MovementScriptGenerator/Modules/Moves/Spiral.cs @@ -10,7 +10,7 @@ public class Spiral : Move public float EndDistance { get; } public float HorizontalRot { get; } public float VerticalRot { get; } - public float SpiralAmmount { get; } + public int SpiralAmmount { get; } public bool SpiralClockwise { get; } public float StartHold { get; } public float EndHold { get; } diff --git a/MovementScriptGenerator/MovementScriptGenerator.csproj b/MovementScriptGenerator/MovementScriptGenerator.csproj index 38132bc..385c30d 100644 --- a/MovementScriptGenerator/MovementScriptGenerator.csproj +++ b/MovementScriptGenerator/MovementScriptGenerator.csproj @@ -53,6 +53,7 @@ + Form From d524237d0e5dec2c0218e6ec6140068676680d1f Mon Sep 17 00:00:00 2001 From: DragonirHD Date: Sun, 18 Dec 2022 01:14:42 +0100 Subject: [PATCH 5/6] - replaced FolderBrowserDialog with more intuitive CommonOpenFileDialog --- MovementScriptGenerator/Form1.cs | 10 ++++++---- MovementScriptGenerator/MovementScriptGenerator.csproj | 9 +++++++++ MovementScriptGenerator/packages.config | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/MovementScriptGenerator/Form1.cs b/MovementScriptGenerator/Form1.cs index 32542b3..575100f 100644 --- a/MovementScriptGenerator/Form1.cs +++ b/MovementScriptGenerator/Form1.cs @@ -5,6 +5,7 @@ using System.Windows.Forms; using MovementScriptGenerator.Modules; using Newtonsoft.Json; +using Microsoft.WindowsAPICodePack.Dialogs; namespace MovementScriptGenerator { @@ -543,11 +544,12 @@ private void btnElementDelete_Click(object sender, EventArgs e) private void btnEditPath_Click(object sender, EventArgs e) { - FolderBrowserDialog dialog = new FolderBrowserDialog(); - DialogResult result = dialog.ShowDialog(); - if(result == DialogResult.OK) + CommonOpenFileDialog dialog = new CommonOpenFileDialog(); + dialog.IsFolderPicker = true; + dialog.InitialDirectory = "C:\\Users"; + if(dialog.ShowDialog() == CommonFileDialogResult.Ok) { - txtPath.Text = dialog.SelectedPath; + txtPath.Text = dialog.FileName; } } } diff --git a/MovementScriptGenerator/MovementScriptGenerator.csproj b/MovementScriptGenerator/MovementScriptGenerator.csproj index 385c30d..b9bea78 100644 --- a/MovementScriptGenerator/MovementScriptGenerator.csproj +++ b/MovementScriptGenerator/MovementScriptGenerator.csproj @@ -37,6 +37,15 @@ + + ..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.2\lib\Microsoft.WindowsAPICodePack.dll + + + ..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll + + + ..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll + ..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/MovementScriptGenerator/packages.config b/MovementScriptGenerator/packages.config index 4de699c..a986436 100644 --- a/MovementScriptGenerator/packages.config +++ b/MovementScriptGenerator/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file From cd84f5be1edddb50ab5edae0b2ae01d4e607f09d Mon Sep 17 00:00:00 2001 From: DragonirHD Date: Sun, 18 Dec 2022 01:23:17 +0100 Subject: [PATCH 6/6] - added functionality for inserting chain elements after selected element --- MovementScriptGenerator/Form1.Designer.cs | 25 ++++++++++++++-- MovementScriptGenerator/Form1.cs | 36 +++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/MovementScriptGenerator/Form1.Designer.cs b/MovementScriptGenerator/Form1.Designer.cs index 9d0329e..f067abd 100644 --- a/MovementScriptGenerator/Form1.Designer.cs +++ b/MovementScriptGenerator/Form1.Designer.cs @@ -90,6 +90,7 @@ private void InitializeComponent() this.ToolTip = new System.Windows.Forms.ToolTip(this.components); this.tableLayoutPanel21 = new System.Windows.Forms.TableLayoutPanel(); this.btnEditPath = new System.Windows.Forms.Button(); + this.btnInsert = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel13.SuspendLayout(); this.tableLayoutPanel14.SuspendLayout(); @@ -605,6 +606,7 @@ private void InitializeComponent() // flowLayoutPanel3 // this.flowLayoutPanel3.Controls.Add(this.btnAddMoveToChain); + this.flowLayoutPanel3.Controls.Add(this.btnInsert); this.flowLayoutPanel3.Controls.Add(this.btnResetMoveSettings); this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel3.Location = new System.Drawing.Point(0, 667); @@ -632,9 +634,8 @@ private void InitializeComponent() // // btnResetMoveSettings // - this.btnResetMoveSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.btnResetMoveSettings.Location = new System.Drawing.Point(88, 3); + this.btnResetMoveSettings.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnResetMoveSettings.Location = new System.Drawing.Point(134, 3); this.btnResetMoveSettings.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); this.btnResetMoveSettings.MinimumSize = new System.Drawing.Size(0, 26); this.btnResetMoveSettings.Name = "btnResetMoveSettings"; @@ -944,6 +945,23 @@ private void InitializeComponent() this.btnEditPath.UseVisualStyleBackColor = true; this.btnEditPath.Click += new System.EventHandler(this.btnEditPath_Click); // + // btnInsert + // + this.btnInsert.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.btnInsert.AutoSize = true; + this.btnInsert.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnInsert.Enabled = false; + this.btnInsert.Location = new System.Drawing.Point(85, 3); + this.btnInsert.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.btnInsert.MinimumSize = new System.Drawing.Size(0, 26); + this.btnInsert.Name = "btnInsert"; + this.btnInsert.Size = new System.Drawing.Size(43, 26); + this.btnInsert.TabIndex = 4; + this.btnInsert.Text = "Insert"; + this.btnInsert.UseVisualStyleBackColor = true; + this.btnInsert.Click += new System.EventHandler(this.btnInsert_Click); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1059,6 +1077,7 @@ private void InitializeComponent() private System.Windows.Forms.Button btnElementDelete; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel21; private System.Windows.Forms.Button btnEditPath; + private System.Windows.Forms.Button btnInsert; } } diff --git a/MovementScriptGenerator/Form1.cs b/MovementScriptGenerator/Form1.cs index 575100f..c0f8738 100644 --- a/MovementScriptGenerator/Form1.cs +++ b/MovementScriptGenerator/Form1.cs @@ -438,6 +438,7 @@ private void EnableElementOptionsMoveType() btnElementApplySettings.Enabled = true; btnElementDuplicate.Enabled = true; btnElementDelete.Enabled = true; + btnInsert.Enabled = true; } private void DisableElementOptionsAll() @@ -448,6 +449,7 @@ private void DisableElementOptionsAll() btnElementApplySettings.Enabled = false; btnElementDuplicate.Enabled = false; btnElementDelete.Enabled = false; + btnInsert.Enabled = false; } private void btnElementMoveUp_Click(object sender, EventArgs e) @@ -552,5 +554,39 @@ private void btnEditPath_Click(object sender, EventArgs e) txtPath.Text = dialog.FileName; } } + + private void btnInsert_Click(object sender, EventArgs e) + { + TreeNode selectedNode = tvChain.SelectedNode; + int insertIndex = selectedNode.Index + 1; + if (selectedNode == null) + { + MessageBox.Show("No element selected.\nPlease select an element from the chain."); + return; + } + + string moveName = txtMoveName.Text; + if (!MoveNameValid(moveName)) + { + moveName = null; + } + + switch (cbType.SelectedIndex) + { + case (int)ChainElementsEnum.Circle: + Circle circle = circleControl.CreateMove(moveName); + chain.Elements.Insert(insertIndex, circle); + break; + case (int)ChainElementsEnum.Spiral: + Spiral spiral = spiralControl.CreateMove(moveName); + chain.Elements.Insert(insertIndex, spiral); + break; + default: + MessageBox.Show("can't add move to chain."); + return; + } + + UpdateChainWindow(insertIndex); + } } }