Skip to content

Commit 10ef02c

Browse files
authored
Merge pull request #6 from DragonirHD/Version2.0.0
Version2.0.0
2 parents 089083e + 3aee109 commit 10ef02c

File tree

14 files changed

+746
-425
lines changed

14 files changed

+746
-425
lines changed

MovementScriptGenerator/CircleControl.Designer.cs

Lines changed: 377 additions & 258 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MovementScriptGenerator/CircleControl.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ public bool Populate(Circle original)
3838
numDuration.Value = (decimal)original.Duration;
3939
numHeight.Value = (decimal)original.Height;
4040
numRotX.Value = (decimal)original.RotX;
41+
numRotY.Value = (decimal)original.RotY;
4142
numRotZ.Value = (decimal)original.RotZ;
43+
numRotHorizontal.Value = (decimal)original.RotHorizontal;
44+
numRotVertical.Value = (decimal)original.RotVertical;
4245
numDistance.Value = (decimal)original.Distance;
43-
numStartingPoint.Value = (decimal)original.StartingPointDegree;
4446
numSector.Value = (decimal)original.SectorDegrees;
4547
numIterations.Value = original.Iterations;
4648
cbRotation.SelectedIndex = original.RotateClockwise ? 0 : 1;
@@ -61,9 +63,11 @@ public Circle CreateMove(string moveName)
6163
(float)numDuration.Value,
6264
(float)numHeight.Value,
6365
(float)numRotX.Value,
66+
(float)numRotY.Value,
6467
(float)numRotZ.Value,
68+
(float)numRotHorizontal.Value,
69+
(float)numRotVertical.Value,
6570
(float)numDistance.Value,
66-
(float)numStartingPoint.Value,
6771
(float)numSector.Value,
6872
(int)numIterations.Value,
6973
cbRotation.SelectedIndex == 0

MovementScriptGenerator/CircleControl.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
<metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123+
<data name="lblFOV.ToolTip" xml:space="preserve">
124+
<value>overwrites the FOV (Field Of View) of the camera.
125+
If this is left at 0, the FOV of the last move that overwrites the FOV will be used.
126+
If no previous move has overwritten the cameras FOV, the original FOV will be used.
127+
</value>
128+
</data>
123129
<data name="lblIterations.ToolTip" xml:space="preserve">
124130
<value>Defines how many points the circle should consist of.
125131
The more points the more detailed the circle.

MovementScriptGenerator/MainForm.Designer.cs

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MovementScriptGenerator/MainForm.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public partial class Main : Form
5656
public Main()
5757
{
5858
//TODO Create own form/implementation of MessageBox so that it can always be displayed in the middle of the parent window
59+
//TODO Find better name for "other Elements"
60+
//TODO Find name for Elements that change the behaviour of an existing move: MODIFIER / MODIFYING ELEMENTS
5961
InitializeComponent();
6062
InitializeComponentView();
6163
PopulateComponentsWithSavedSettings();
@@ -222,11 +224,11 @@ private void UpdateChainWindow()
222224
DisableElementOptionsAll();
223225
}
224226
tvChain.EndUpdate();
227+
tvChain.SelectedNode.EnsureVisible();
225228
}
226229

227230
private void UpdateChainWindow(int indexOfNodeToBeSelected)
228231
{
229-
//TODO Dont scroll to top on update
230232
tvChain.BeginUpdate();
231233
tvChain.Nodes.Clear();
232234
for(int i = 0; i < chain.Elements.Count; i++)
@@ -250,6 +252,7 @@ private void UpdateChainWindow(int indexOfNodeToBeSelected)
250252
DisableElementOptionsAll();
251253
}
252254
tvChain.EndUpdate();
255+
tvChain.SelectedNode.EnsureVisible();
253256
}
254257

255258
private bool GenerateMovementScriptFile(MovementScript script, string filePath)
@@ -401,6 +404,7 @@ private void btnGenerateScript_Click(object sender, EventArgs e)
401404
/// <returns>A List of Frames. If the script fails, it will return null</returns>
402405
public List<Frame> AddFramesToScript(Chain chainOfElements)
403406
{
407+
//TODO perfect place to implement other Elements that can be applied to moves, for example changing fov. Get the generated frames of the corresponding move, then apply the logic of the new other element.
404408
List<Frame> frames = new List<Frame>();
405409
foreach(ChainElement chainEl in chainOfElements.Elements)
406410
{

MovementScriptGenerator/MainForm.resx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123+
<metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124+
<value>17, 17</value>
125+
</metadata>
123126
<data name="btnEditScriptPath.ToolTip" xml:space="preserve">
124127
<value>Select the directory in which the movement script file will be generated in.
125128
Make sure that this is the correct directory, else camera2 will not be able to use the script!
@@ -141,6 +144,14 @@ Will overwrite the "Sync To Song" and "Loop" options of the existing file!
141144
Off -&gt; A new movement script file will be created for the moves.
142145
If a file with the same name exists, that file will be overwritten!</value>
143146
</data>
147+
<data name="btnElementGetSettings.ToolTip" xml:space="preserve">
148+
<value>displays the settings of the selected element in the element settings tab.
149+
Useful for tweaking specific settings and then applying them again to the selected element.
150+
Can also be done by doubleclicking the element.</value>
151+
</data>
152+
<metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
153+
<value>17, 17</value>
154+
</metadata>
144155
<data name="lblType.ToolTip" xml:space="preserve">
145156
<value>Element types are divided into two subtypes:
146157
move

MovementScriptGenerator/Modules/Move.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,23 @@ public Move(string name, int fov, float duration, float height) : base(name)
1212
Height = height;
1313
}
1414

15+
//general settings
1516
public int Fov { get; set; }
1617
public float Duration { get; set; }
1718
public float Height { get; set; }
1819

20+
//rotation of the camera itself (euler angles)
21+
//pitch
22+
public float RotX { get; set; }
23+
//yaw
24+
public float RotY { get; set; }
25+
//roll
26+
public float RotZ { get; set; }
27+
28+
//rotation of the camera around the object (Orbiting)
29+
public float RotHorizontal { get; set; }
30+
public float RotVertical { get; set; }
31+
1932
public abstract List<Frame> GenerateFrames();
2033
}
2134
}

MovementScriptGenerator/Modules/Moves/Circle.cs

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ namespace MovementScriptGenerator
66
{
77
public class Circle : Move
88
{
9-
public float RotX { get; }
10-
public float RotZ { get; }
119
public float Distance { get; }
12-
public float StartingPointDegree { get; }
1310
public float SectorDegrees { get; }
1411
public int Iterations { get; }
1512
public bool RotateClockwise { get; }
@@ -19,9 +16,11 @@ public Circle(
1916
float duration,
2017
float height,
2118
float rotX,
19+
float rotY,
2220
float rotZ,
21+
float rotHorizontal,
22+
float rotVertical,
2323
float distance,
24-
float startingPointDegree,
2524
float sectorDegrees,
2625
int iterations,
2726
bool rotateClockwise) : base(name, fov, duration, height)
@@ -31,9 +30,11 @@ public Circle(
3130
Duration = duration;
3231
Height = height;
3332
RotX = rotX;
33+
RotY = rotY;
3434
RotZ = rotZ;
35+
RotHorizontal = rotHorizontal;
36+
RotVertical = rotVertical;
3537
Distance = distance;
36-
StartingPointDegree = startingPointDegree;
3738
SectorDegrees = sectorDegrees;
3839
Iterations = iterations;
3940
RotateClockwise = rotateClockwise;
@@ -43,42 +44,40 @@ public override List<Frame> GenerateFrames()
4344
{
4445
List<Frame> frames = new List<Frame>();
4546

47+
double verticalRadiant = RotVertical * Math.PI / 180;
48+
49+
float yVertical = (float)Math.Sin(verticalRadiant);
50+
float zVertical = (float)Math.Cos(verticalRadiant);
51+
4652
float initialDegree = 0;
4753
float maxDegrees = SectorDegrees - 1;
48-
float initialDegreeAddend = 1;
54+
float initialDegreeAdded = 1;
4955

5056
if (!RotateClockwise) {
5157
initialDegree *= -1;
5258
maxDegrees *= -1;
53-
initialDegreeAddend *= -1;
59+
initialDegreeAdded *= -1;
5460
}
5561

56-
for (float i = initialDegree; (RotateClockwise && i <= maxDegrees) || (!RotateClockwise && i >= maxDegrees); i += (float)initialDegreeAddend / Iterations)
62+
for (float i = initialDegree; (RotateClockwise && i <= maxDegrees) || (!RotateClockwise && i >= maxDegrees); i += (float)initialDegreeAdded / Iterations)
5763
{
58-
float usedDegree = i + StartingPointDegree;
59-
double radiant = usedDegree * Math.PI / 180;
64+
float currentHorizontalDegree = i + RotHorizontal;
65+
double currentHorizontalRadiant = currentHorizontalDegree * Math.PI / 180;
66+
67+
float xHorizontal = (float)Math.Sin(currentHorizontalRadiant);
68+
float zHorizontal = (float)Math.Cos(currentHorizontalRadiant);
6069

6170
Frame frame = new Frame();
6271
frame.Position = new Position();
6372
frame.Rotation = new Rotation();
6473

65-
frame.Position.X = (float)Math.Sin(radiant) * Distance;
66-
frame.Position.Y = Height;
67-
frame.Position.Z = (float)Math.Cos(radiant) * Distance;
68-
69-
frame.Rotation.Z = RotZ;
70-
frame.Rotation.X = RotX;
71-
frame.Rotation.Y = usedDegree -180;
72-
73-
if (usedDegree == 0 || usedDegree == 180 || usedDegree == 360)
74-
{
75-
frame.Position.X = 0;
76-
}
77-
if (usedDegree == 90 || usedDegree == 270)
78-
{
79-
frame.Position.Z = 0;
80-
}
74+
frame.Position.x = xHorizontal * zVertical * Distance;
75+
frame.Position.y = yVertical * Distance + Height;
76+
frame.Position.z = zHorizontal * zVertical * Distance;
8177

78+
frame.Rotation.x = RotVertical + RotX;
79+
frame.Rotation.y = currentHorizontalDegree + RotY -180;
80+
frame.Rotation.z = RotZ;
8281

8382
frame.Duration = Duration / Math.Abs(maxDegrees) / Iterations;
8483

0 commit comments

Comments
 (0)