1
0
mirror of synced 2024-09-25 03:58:22 +02:00

Load lap path properties on select

This commit is contained in:
KillzXGaming 2019-04-06 13:29:42 -04:00
parent 37a34b8ef5
commit c7851c8d16
10 changed files with 75 additions and 12 deletions

Binary file not shown.

View File

@ -287,7 +287,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
else throw new Exception("Not a dictionary");
foreach (var point in this["PathPt"]) {
PathPoints.Add(new PathPoint(point));
PathPoints.Add(new LapPatPoint(point));
}
foreach (var point in this["ReturnPoints"]) {
@ -331,6 +331,56 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
}
}
public class LapPatPoint: PathPoint
{
[Category("Properties")]
public int CheckPoint
{
get { return this["CheckPoint"]; }
set { this["CheckPoint"] = value;}
}
[Category("Properties")]
public int ClipIdx
{
get { return this["ClipIdx"]; }
set { this["ClipIdx"] = value; }
}
[Category("Properties")]
public bool HeadLightSW
{
get { return this["HeadLightSW"]; }
set { this["HeadLightSW"] = value; }
}
[Category("Properties")]
public int LapCheck
{
get { return this["LapCheck"]; }
set { this["LapCheck"] = value; }
}
[Category("Properties")]
public int MapCameraFovy
{
get { return this["MapCameraFovy"]; }
set { this["MapCameraFovy"] = value; }
}
[Category("Properties")]
public int MapCameraY
{
get { return this["MapCameraY"]; }
set { this["MapCameraY"] = value; }
}
public LapPatPoint(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
}
}
public class PointID : IObject
{

View File

@ -8,11 +8,13 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class PathPoint : IObject
{
[Browsable(false)]
public RenderablePathPoint RenderablePoint
{
get
{
return new RenderablePathPoint(Translate, Rotate, Scale);
var point = new RenderablePathPoint(Translate, Rotate, Scale, this);
return point;
}
}
@ -22,12 +24,6 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
public const string N_Id = "UnitIdNum";
public const string N_ObjectID = "ObjId";
public PathPoint(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
}
[Browsable(false)]
public Dictionary<string, dynamic> Prop { get; set; } = new Dictionary<string, dynamic>();
@ -52,7 +48,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
public List<ControlPoint> ControlPoints = new List<ControlPoint>();
[Category("Rotate")]
[Category("Transform")]
public Vector3 Rotate
{
get { return new Vector3(this[N_Rotate]["X"], this[N_Rotate]["Y"], this[N_Rotate]["Z"]); ; }
@ -64,7 +60,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
}
}
[Category("Scale")]
[Category("Transform")]
public Vector3 Scale
{
get { return new Vector3(this[N_Scale]["X"], this[N_Scale]["Y"], this[N_Scale]["Z"]); ; }
@ -76,7 +72,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
}
}
[Category("Translate")]
[Category("Transform")]
public Vector3 Translate
{
get { return new Vector3(this[N_Translate]["X"], this[N_Translate]["Y"], this[N_Translate]["Z"]); ; }

View File

@ -9,6 +9,8 @@ namespace GL_EditorFramework.EditorDrawables
{
public class RenderablePathPoint : EditableObject
{
public object NodeObject;
public bool IsNormalTanTransform = false;
protected Vector3 position = new Vector3(0, 0, 0);
@ -26,7 +28,8 @@ namespace GL_EditorFramework.EditorDrawables
protected static Vector4 Color = new Vector4(0f, 0.25f, 1f, 1f);
public RenderablePathPoint(Vector3 pos, Vector3 rot, Vector3 sca) {
public RenderablePathPoint(Vector3 pos, Vector3 rot, Vector3 sca, object nodeObject) {
NodeObject = nodeObject;
UpdateTransform(pos, rot, sca);
}

View File

@ -7,6 +7,7 @@ using Switch_Toolbox.Library.Forms;
using Switch_Toolbox.Library;
using System.Windows.Forms;
using FirstPlugin.Turbo.CourseMuuntStructs;
using GL_EditorFramework.EditorDrawables;
namespace FirstPlugin.Forms
{
@ -20,6 +21,7 @@ namespace FirstPlugin.Forms
viewport = new Viewport();
viewport.Dock = DockStyle.Fill;
viewport.scene.SelectionChanged += Scene_SelectionChanged;
splitContainer1.Panel2.Controls.Add(viewport);
}
@ -76,6 +78,18 @@ namespace FirstPlugin.Forms
}
}
private void Scene_SelectionChanged(object sender, EventArgs e)
{
foreach (EditableObject o in viewport.scene.objects)
{
if (o.IsSelected() && o is RenderablePathPoint)
{
stPropertyGrid1.LoadProperty(((RenderablePathPoint)o).NodeObject, OnPropertyChanged);
}
}
}
private void objectCB_SelectedIndexChanged(object sender, EventArgs e)
{
if (objectCB.SelectedIndex <= 0)