Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3055c85
feat: handling timeline deletion
JeremyMeissner May 6, 2022
7c3170f
chore: doing animation section
JeremyMeissner May 6, 2022
02d75b1
docs: add brand identity
JeremyMeissner May 7, 2022
7adcd6f
feat: shape animation list ui
JeremyMeissner May 9, 2022
3732d3c
Merge branch '5-timeline-implementation' of https://github.com/Jeremy…
JeremyMeissner May 9, 2022
6055621
chore: interpolation implementation
JeremyMeissner May 10, 2022
687c8b4
feat: timeline loop
JeremyMeissner May 11, 2022
25f76b3
refactor: global structure
JeremyMeissner May 11, 2022
1e79797
chore: add camera
JeremyMeissner May 12, 2022
548a88d
chore: change timeline logic
JeremyMeissner May 13, 2022
d5a1681
chore: remove loop/reverse
JeremyMeissner May 14, 2022
672470b
feat: angle supported
JeremyMeissner May 14, 2022
80ad23d
refactor: selector
JeremyMeissner May 15, 2022
029cb93
feat: color importation
JeremyMeissner May 16, 2022
1963b2b
refactor: timeline
JeremyMeissner May 16, 2022
432cd5f
refactor: timeline
JeremyMeissner May 17, 2022
053ccc0
refactor: remove unused code
JeremyMeissner May 18, 2022
a7cea3a
feat: add triangle
JeremyMeissner May 20, 2022
a0814c1
refactor: window class
JeremyMeissner May 23, 2022
6dba92e
chore: change d attr regex
JeremyMeissner May 25, 2022
172e538
chore: update shader
JeremyMeissner May 31, 2022
f520c1d
refactor: Renderer
JeremyMeissner Jun 1, 2022
cc7863c
fix: path drawing problem
JeremyMeissner Jun 2, 2022
e774ed9
chore: serialization
JeremyMeissner Jun 2, 2022
d153021
feat: serialization
JeremyMeissner Jun 2, 2022
860a7d2
fix: import form render
JeremyMeissner Jun 3, 2022
8a6c0b2
refactor: path structure
JeremyMeissner Jun 7, 2022
780e5b3
refactor: whole structure
JeremyMeissner Jun 8, 2022
b37ec4f
fix: picker filter reset
JeremyMeissner Jun 8, 2022
c9d0296
refactor: add comments
JeremyMeissner Jun 8, 2022
b585b8c
chore: remove useless close button
JeremyMeissner Jun 9, 2022
0808cba
refactor: whole structure
JeremyMeissner Jun 9, 2022
3666559
refactor: remove useless using
JeremyMeissner Jun 9, 2022
78bdd4c
Merge branch 'master' into 5-timeline-implementation
JeremyMeissner Jun 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: whole structure
  • Loading branch information
JeremyMeissner committed Jun 9, 2022
commit 0808cbae3ee166e7edff7ac6270d0d43581d2d60
8 changes: 2 additions & 6 deletions FreeFrame/Components/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ static private (List<Shape>, SortedDictionary<int, List<Shape>>, bool) ImportFro

using (XmlReader reader = XmlReader.Create(pStream))
{


try
{
while (reader.Read())
{
if (reader.HasAttributes)
{
//Console.WriteLine("Attributes of <" + reader.Name + ">");
switch (reader.Name)
{
case "xml":
Expand Down Expand Up @@ -61,9 +60,6 @@ static private (List<Shape>, SortedDictionary<int, List<Shape>>, bool) ImportFro
}

}
// TODO: Fix trycatch
try
{
}
catch (Exception)
{
Expand Down
73 changes: 0 additions & 73 deletions FreeFrame/Components/Shapes/Path/DrawAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,77 +839,4 @@ public override void UpdateLast()
}
}
}

/// <summary>
/// EllipticalArc, Elliptical Arc Curve, A or a.
/// Use to draw an ellipse.
/// More info: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve
/// </summary>
public class EllipticalArc : DrawAttribute
{
int _rx;
int _ry;
int _angle;
bool _largeArcFlag;
bool _sweepFlag;

public EllipticalArc() { }

/// <summary>
/// Use to draw an ellipse.
/// </summary>
/// <param name="rx">radius x of the ellipse</param>
/// <param name="ry">radius y of the ellipse</param>
/// <param name="angle">rotation (in degrees) relative to the x-axis</param>
/// <param name="largeArcFlag">either 0 (large arc) or 1 (small arc)</param>
/// <param name="sweepFlag">either 0 (clockwise arc) or 1 (counterclockwise arc)</param>
/// <param name="x">new current point x</param>
/// <param name="y">new current point y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>
public EllipticalArc(Group rx, Group ry, Group angle, Group largeArcFlag, Group sweepFlag, Group x, Group y, bool isRelative = false) : this(Convert.ToInt32(rx.Value), Convert.ToInt32(ry.Value), Convert.ToInt32(angle.Value), Convert.ToInt32(largeArcFlag.Value) == 0 ? false : true, Convert.ToInt32(sweepFlag.Value) == 0 ? false : true, Convert.ToInt32(x.Value), Convert.ToInt32(y.Value), isRelative) { }

/// <summary>
/// Use to draw an ellipse.
/// </summary>
/// <param name="rx">radius x of the ellipse</param>
/// <param name="ry">radius y of the ellipse</param>
/// <param name="angle">rotation (in degrees) relative to the x-axis</param>
/// <param name="largeArcFlag">either 0 (large arc) or 1 (small arc)</param>
/// <param name="sweepFlag">either 0 (clockwise arc) or 1 (counterclockwise arc)</param>
/// <param name="x">new current point x</param>
/// <param name="y">new current point y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>
public EllipticalArc(int rx, int ry, int angle, bool largeArcFlag, bool sweepFlag, int x, int y, bool isRelative = false)
{
_rx = rx;
_ry = ry;
_angle = angle;
_largeArcFlag = largeArcFlag;
_sweepFlag = sweepFlag;
X = x;
Y = y;
IsRelative = isRelative;
}

public override List<Vector2i> GetSelectablePoints()
{
throw new NotImplementedException();
}

public override float[] GetVertices()
{
throw new NotImplementedException();
}
public override uint[] GetVerticesIndexes()
{
throw new NotImplementedException();
}

public override string ToString() => String.Format("{0} {1} {2} {3} {4} {5} {6},{7}", IsRelative ? 'a' : 'A', _rx, _ry, _angle, Convert.ToInt32(_largeArcFlag), Convert.ToInt32(_sweepFlag), X, Y);

public override void UpdateLast()
{
throw new NotImplementedException();
}
}
}
7 changes: 1 addition & 6 deletions FreeFrame/Components/Shapes/SVGPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ public SVGPath(XmlReader reader)
case 't':
DrawAttributes.Add(new SmoothQuadraticBezierCurveTo(match.Groups[1], match.Groups[2], c == 't')); // 't' is relative and 'T' absolute
break;
case 'a':
DrawAttributes.Add(new EllipticalArc(match.Groups[1], match.Groups[2], match.Groups[3], match.Groups[4], match.Groups[5], match.Groups[6], match.Groups[7], c == 'a')); // 'a' is relative and 'A' absolute
break;
case 'z':
DrawAttributes.Add(new LineTo(_x0, _y0));
break;
Expand Down Expand Up @@ -158,7 +155,6 @@ public override void Move(Vector2i position)
Type attrType = attr.GetType();
if (attr.IsRelative == false) // Update position of each absolute attr
{
//Console.WriteLine("{0} is relative? =>{1}", attr.GetType().Name, attr.IsRelative);
if (deltaX == null || deltaY == null)
{
// Get delta X and Y only one time
Expand All @@ -185,8 +181,7 @@ public override void Move(Vector2i position)
if (attrType == typeof(CurveTo) ||
attrType == typeof(SmoothCurveTo) ||
attrType == typeof(QuadraticBezierCurveTo) ||
attrType == typeof(SmoothQuadraticBezierCurveTo) ||
attrType == typeof(EllipticalArc)) // Only thoses are LineStrip type
attrType == typeof(SmoothQuadraticBezierCurveTo)) // Only thoses are LineStrip type
{
Renderers.Add(new Renderer(attr.GetVertices(), attr.GetVerticesIndexes(), PrimitiveType.LineStrip, this));
}
Expand Down
4 changes: 0 additions & 4 deletions FreeFrame/Lib/ImGuiTools/ImGuiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ private void RenderImDrawData(ImDrawDataPtr draw_data)
int newSize = (int)Math.Max(_vertexBufferSize * 1.5f, vertexSize);
GL.NamedBufferData(_vertexBuffer, newSize, IntPtr.Zero, BufferUsageHint.DynamicDraw);
_vertexBufferSize = newSize;

Console.WriteLine($"Resized dear imgui vertex buffer to new size {_vertexBufferSize}");
}

int indexSize = cmd_list.IdxBuffer.Size * sizeof(ushort);
Expand All @@ -294,8 +292,6 @@ private void RenderImDrawData(ImDrawDataPtr draw_data)
int newSize = (int)Math.Max(_indexBufferSize * 1.5f, indexSize);
GL.NamedBufferData(_indexBuffer, newSize, IntPtr.Zero, BufferUsageHint.DynamicDraw);
_indexBufferSize = newSize;

Console.WriteLine($"Resized dear imgui index buffer to new size {_indexBufferSize}");
}
}

Expand Down
3 changes: 1 addition & 2 deletions FreeFrame/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,13 @@ public void ImplementObjects(float[] vertices, uint[] indexes)
_indexCount = indexes.Length;
}
/// <summary>
/// Delete all the buffer objects and shader
/// Delete all the buffer objects
/// </summary>
public void DeleteObjects()
{
GL.DeleteBuffer(VertexBufferObjectID);
GL.DeleteBuffer(IndexBufferObjectID);
GL.DeleteVertexArray(VertexArrayObjectID);
_shader.Delete();
}
}
}
7 changes: 0 additions & 7 deletions FreeFrame/Shader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,5 @@ int CompileShader(string uri, ShaderType type)
/// Use the current shaders
/// </summary>
public void Use() => GL.UseProgram(_program);

/// <summary>
/// Delete the program/shaders
/// </summary>
public void Delete() { } //GL.DeleteProgram(_program);
~Shader() => Delete();
//TODO: Make deletion program correctly
}
}
45 changes: 19 additions & 26 deletions FreeFrame/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ private void ShowUI()
_selectedShape = Shapes[i];
_selector.Select(Shapes[i]);
_userMode = UserMode.Edit;
Console.WriteLine("New shape selected through tree view");
}
if (i - 1 >= 0)
{
Expand Down Expand Up @@ -945,7 +944,6 @@ private void ShowUI()
{
if (shape.Id == _selectedShape.Id)
{
Console.WriteLine("Already exist");
_timeline.SortedTimeline[_timeline.TimelineIndex].Remove(shape);
break;
}
Expand Down Expand Up @@ -1094,36 +1092,31 @@ private void ShowUI()
if (picker.Draw())
{
ResetSelection();
//bool compatibilityFlag = false;

switch (_importMode)
{
case ImportMode.Workspace:
ImportFreeFrameWorkspace(picker.SelectedFile);
break;
case ImportMode.Add:
(List<Shape> newShapes, SortedDictionary<int, List<Shape>> newTimeline, _dialogCompatibility) = Importer.ImportFromFile(picker.SelectedFile);
Shapes.AddRange(newShapes);
break;
case ImportMode.Override:
(Shapes, _timeline.SortedTimeline, _dialogCompatibility) = Importer.ImportFromFile(picker.SelectedFile);
_timeline.ResetTimeline();
break;
default:
break;
}
// TODO: Fix trycatch
try
{
switch (_importMode)
{
case ImportMode.Workspace:
ImportFreeFrameWorkspace(picker.SelectedFile);
break;
case ImportMode.Add:
(List<Shape> newShapes, SortedDictionary<int, List<Shape>> newTimeline, _dialogCompatibility) = Importer.ImportFromFile(picker.SelectedFile);
Shapes.AddRange(newShapes);
break;
case ImportMode.Override:
(Shapes, _timeline.SortedTimeline, _dialogCompatibility) = Importer.ImportFromFile(picker.SelectedFile);
_timeline.ResetTimeline();
break;
default:
break;
}

}
catch (Exception)
{
_dialogError = true;
}

//if (compatibilityFlag)
// _dialogCompatibility = true;

FilePicker.Clear();
}
_dialogFilePicker = false;
Expand All @@ -1134,7 +1127,7 @@ private void ShowUI()
if (_dialogCompatibility)
ImGui.OpenPopup("Compatibility Problem");

if (ImGui.BeginPopupModal("Compatibility Problem")) // ImGuiWindowFlags.AlwaysAutoResize
if (ImGui.BeginPopupModal("Compatibility Problem"))
{
ImGui.Text("Some SVG elements are not compatible. Go to the list of compatible SVG elements");
ImGui.Separator();
Expand All @@ -1149,7 +1142,7 @@ private void ShowUI()
// Error alert
if (_dialogError)
ImGui.OpenPopup("Error Problem");
if (ImGui.BeginPopupModal("Error Problem")) // ImGuiWindowFlags.AlwaysAutoResize
if (ImGui.BeginPopupModal("Error Problem"))
{
ImGui.Text("There was an error while importing the file, please check the syntax");
ImGui.Separator();
Expand Down