1
0
mirror of synced 2024-11-12 10:10:50 +01:00

Apply path moving to node data so it saves back

This commit is contained in:
KillzXGaming 2019-04-06 13:46:35 -04:00
parent c7851c8d16
commit 9c28afdfe2
10 changed files with 48 additions and 26 deletions

Binary file not shown.

View File

@ -4,6 +4,7 @@ using GL_EditorFramework.Interfaces;
using OpenTK;
using Switch_Toolbox.Library.IO;
using static GL_EditorFramework.EditorDrawables.EditorSceneBase;
using FirstPlugin.Turbo.CourseMuuntStructs;
namespace GL_EditorFramework.EditorDrawables
{
@ -162,6 +163,7 @@ namespace GL_EditorFramework.EditorDrawables
public virtual void Translate(Vector3 lastPos, Vector3 translate, int subObj)
{
position = lastPos + translate;
UpdateNodePosition();
}
public virtual void UpdatePosition(int subObj)
@ -172,12 +174,12 @@ namespace GL_EditorFramework.EditorDrawables
public override bool CanStartDragging() => true;
public override BoundingBox GetSelectionBox() => new BoundingBox(
position.X - 0.5f,
position.X + 0.5f,
position.Y - 0.5f,
position.Y + 0.5f,
position.Z - 0.5f,
position.Z + 0.5f
position.X - scale.X,
position.X + scale.X,
position.Y - scale.Y,
position.Y + scale.Y,
position.Z - scale.Z,
position.Z + scale.Z
);
public override uint SelectAll(GL_ControlBase control)
@ -213,6 +215,17 @@ namespace GL_EditorFramework.EditorDrawables
public override void ApplyTransformActionToSelection(AbstractTransformAction transformAction)
{
position = transformAction.newPos(position);
UpdateNodePosition();
}
private void UpdateNodePosition()
{
if (NodeObject is PathPoint)
{
((PathPoint)NodeObject).Translate = position;
((PathPoint)NodeObject).Scale = scale;
((PathPoint)NodeObject).Rotate = rotate;
}
}
public override Vector3 Position

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPropertyGrid1 = new Switch_Toolbox.Library.Forms.STPropertyGrid();
@ -35,11 +36,11 @@
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.stButton2 = new Switch_Toolbox.Library.Forms.STButton();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.listViewCustom1 = new Switch_Toolbox.Library.Forms.ListViewCustom();
this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
this.objectCB = new Switch_Toolbox.Library.Forms.STComboBox();
this.stMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip();
this.viewIntroCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -99,9 +100,9 @@
//
// stPanel1
//
this.stPanel1.Controls.Add(this.treeViewCustom1);
this.stPanel1.Controls.Add(this.stButton2);
this.stPanel1.Controls.Add(this.stButton1);
this.stPanel1.Controls.Add(this.listViewCustom1);
this.stPanel1.Controls.Add(this.stPanel3);
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.stPanel1.Location = new System.Drawing.Point(0, 0);
@ -129,19 +130,6 @@
this.stButton1.Text = "Add";
this.stButton1.UseVisualStyleBackColor = false;
//
// listViewCustom1
//
this.listViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listViewCustom1.Location = new System.Drawing.Point(3, 30);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(167, 250);
this.listViewCustom1.TabIndex = 1;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
//
// stPanel3
//
this.stPanel3.Controls.Add(this.objectCB);
@ -183,6 +171,18 @@
this.viewIntroCameraToolStripMenuItem.Text = "View Intro Camera";
this.viewIntroCameraToolStripMenuItem.Click += new System.EventHandler(this.viewIntroCameraToolStripMenuItem_Click);
//
// treeViewCustom1
//
this.treeViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.treeViewCustom1.ImageIndex = 0;
this.treeViewCustom1.Location = new System.Drawing.Point(3, 30);
this.treeViewCustom1.Name = "treeViewCustom1";
this.treeViewCustom1.SelectedImageIndex = 0;
this.treeViewCustom1.Size = new System.Drawing.Size(167, 252);
this.treeViewCustom1.TabIndex = 3;
//
// TurboMunntEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -211,12 +211,12 @@
private Switch_Toolbox.Library.Forms.STPropertyGrid stPropertyGrid1;
private System.Windows.Forms.Splitter splitter1;
private Switch_Toolbox.Library.Forms.STPanel stPanel1;
private Switch_Toolbox.Library.Forms.ListViewCustom listViewCustom1;
private Switch_Toolbox.Library.Forms.STPanel stPanel3;
private Switch_Toolbox.Library.Forms.STComboBox objectCB;
private Switch_Toolbox.Library.Forms.STButton stButton2;
private Switch_Toolbox.Library.Forms.STButton stButton1;
private Switch_Toolbox.Library.Forms.STMenuStrip stMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem viewIntroCameraToolStripMenuItem;
private Switch_Toolbox.Library.TreeViewCustom treeViewCustom1;
}
}

View File

@ -92,24 +92,33 @@ namespace FirstPlugin.Forms
private void objectCB_SelectedIndexChanged(object sender, EventArgs e)
{
if (objectCB.SelectedIndex <= 0)
if (objectCB.SelectedIndex >= 0)
{
string Text = objectCB.GetSelectedText();
treeViewCustom1.Nodes.Clear();
if (Text == "Scene")
{
stPropertyGrid1.LoadProperty(scene, OnPropertyChanged);
}
if (Text == "Lap Paths")
else if (Text == "Lap Paths")
{
stPropertyGrid1.LoadProperty(scene, OnPropertyChanged);
listViewCustom1.Items.Clear();
for (int i = 0; i < scene.LapPaths.Count; i++)
{
listViewCustom1.Items.Add("Lap Path Group " + i);
TreeNode group = new TreeNode("Lap Path Group " + i);
treeViewCustom1.Nodes.Add(group);
for (int p = 0; p < scene.LapPaths[i].PathPoints.Count; p++)
{
group.Nodes.Add("Lap Path Point " + p);
}
}
}
else
{
stPropertyGrid1.LoadProperty(null, OnPropertyChanged);
}
}
}