1
0
mirror of synced 2024-11-13 18:50:50 +01:00

More course muunt stuff

This commit is contained in:
KillzXGaming 2019-04-06 20:16:41 -04:00
parent f4189a9e39
commit 47dee0ea3d
18 changed files with 192 additions and 129 deletions

Binary file not shown.

View File

@ -10,6 +10,8 @@ namespace GL_EditorFramework.EditorDrawables
{
public class RenderablePathPoint : EditableObject
{
public bool IsVisable = true;
public bool CanConnect = true;
public object NodeObject;
@ -57,7 +59,7 @@ namespace GL_EditorFramework.EditorDrawables
public override void Draw(GL_ControlModern control, Pass pass, EditorSceneBase editorScene)
{
if (pass == Pass.TRANSPARENT)
if (pass == Pass.TRANSPARENT || !IsVisable)
return;
bool hovered = editorScene.hovered == this;
@ -100,7 +102,7 @@ namespace GL_EditorFramework.EditorDrawables
public override void Draw(GL_ControlModern control, Pass pass)
{
if (pass == Pass.TRANSPARENT)
if (pass == Pass.TRANSPARENT || !IsVisable)
return;
control.UpdateModelMatrix(Matrix4.CreateScale(0.5f) *
@ -112,7 +114,7 @@ namespace GL_EditorFramework.EditorDrawables
public override void Draw(GL_ControlLegacy control, Pass pass, EditorSceneBase editorScene)
{
if (pass == Pass.TRANSPARENT)
if (pass == Pass.TRANSPARENT || !IsVisable)
return;
bool hovered = editorScene.hovered == this;
@ -142,7 +144,7 @@ namespace GL_EditorFramework.EditorDrawables
public override void Draw(GL_ControlLegacy control, Pass pass)
{
if (pass == Pass.TRANSPARENT)
if (pass == Pass.TRANSPARENT || !IsVisable)
return;
control.UpdateModelMatrix(Matrix4.CreateScale(0.5f) *

View File

@ -6,13 +6,12 @@ using System.Threading.Tasks;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class LapPathGroup : IObject
public class LapPathGroup : PathGroup, IObject
{
public const string N_LapPathGroup = "LapPathGroup";
public const string N_ReturnPointsError = "ReturnPointsError";
public const string N_UnitIdNum = "UnitIdNum";
public List<PathPoint> PathPoints = new List<PathPoint>();
public List<ReturnPoint> ReturnPoints = new List<ReturnPoint>();
public LapPathGroup(dynamic bymlNode)

View File

@ -54,6 +54,9 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{
foreach (var path in group.PathPoints)
{
if (!path.RenderablePoint.IsVisable)
continue;
GL.LineWidth(2f);
foreach (var nextPt in path.NextPoints)
{

View File

@ -28,30 +28,26 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitter1 = new System.Windows.Forms.Splitter();
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPropertyGrid1 = new Switch_Toolbox.Library.Forms.STPropertyGrid();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom();
this.stButton2 = new Switch_Toolbox.Library.Forms.STButton();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
this.objectCB = new Switch_Toolbox.Library.Forms.STComboBox();
this.stTabControl1 = new Switch_Toolbox.Library.Forms.STTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.stMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip();
this.viewIntroCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stPanel4 = new Switch_Toolbox.Library.Forms.STPanel();
this.treeView1 = new System.Windows.Forms.TreeView();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.stPanel2.SuspendLayout();
this.stPanel1.SuspendLayout();
this.stPanel3.SuspendLayout();
this.stTabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.stMenuStrip1.SuspendLayout();
@ -73,16 +69,16 @@
//
this.splitContainer1.Panel2.Controls.Add(this.stTabControl1);
this.splitContainer1.Panel2.Controls.Add(this.stMenuStrip1);
this.splitContainer1.Size = new System.Drawing.Size(780, 492);
this.splitContainer1.SplitterDistance = 170;
this.splitContainer1.Size = new System.Drawing.Size(959, 718);
this.splitContainer1.SplitterDistance = 209;
this.splitContainer1.TabIndex = 1;
//
// splitter1
//
this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter1.Location = new System.Drawing.Point(0, 317);
this.splitter1.Location = new System.Drawing.Point(0, 419);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(170, 3);
this.splitter1.Size = new System.Drawing.Size(209, 3);
this.splitter1.TabIndex = 1;
this.splitter1.TabStop = false;
//
@ -90,9 +86,9 @@
//
this.stPanel2.Controls.Add(this.stPropertyGrid1);
this.stPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel2.Location = new System.Drawing.Point(0, 320);
this.stPanel2.Location = new System.Drawing.Point(0, 422);
this.stPanel2.Name = "stPanel2";
this.stPanel2.Size = new System.Drawing.Size(170, 172);
this.stPanel2.Size = new System.Drawing.Size(209, 296);
this.stPanel2.TabIndex = 2;
//
// stPropertyGrid1
@ -102,37 +98,25 @@
this.stPropertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPropertyGrid1.Location = new System.Drawing.Point(0, 0);
this.stPropertyGrid1.Name = "stPropertyGrid1";
this.stPropertyGrid1.Size = new System.Drawing.Size(170, 172);
this.stPropertyGrid1.Size = new System.Drawing.Size(209, 296);
this.stPropertyGrid1.TabIndex = 0;
//
// stPanel1
//
this.stPanel1.Controls.Add(this.treeViewCustom1);
this.stPanel1.Controls.Add(this.treeView1);
this.stPanel1.Controls.Add(this.stButton2);
this.stPanel1.Controls.Add(this.stButton1);
this.stPanel1.Controls.Add(this.stPanel3);
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.stPanel1.Location = new System.Drawing.Point(0, 0);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(170, 317);
this.stPanel1.Size = new System.Drawing.Size(209, 419);
this.stPanel1.TabIndex = 0;
//
// 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;
//
// stButton2
//
this.stButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton2.Location = new System.Drawing.Point(52, 288);
this.stButton2.Location = new System.Drawing.Point(52, 390);
this.stButton2.Name = "stButton2";
this.stButton2.Size = new System.Drawing.Size(57, 23);
this.stButton2.TabIndex = 2;
@ -141,38 +125,15 @@
//
// stButton1
//
this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(3, 288);
this.stButton1.Location = new System.Drawing.Point(3, 390);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(43, 23);
this.stButton1.TabIndex = 1;
this.stButton1.Text = "Add";
this.stButton1.UseVisualStyleBackColor = false;
//
// stPanel3
//
this.stPanel3.Controls.Add(this.objectCB);
this.stPanel3.Dock = System.Windows.Forms.DockStyle.Top;
this.stPanel3.Location = new System.Drawing.Point(0, 0);
this.stPanel3.Name = "stPanel3";
this.stPanel3.Size = new System.Drawing.Size(170, 32);
this.stPanel3.TabIndex = 0;
//
// objectCB
//
this.objectCB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.objectCB.BorderColor = System.Drawing.Color.Empty;
this.objectCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.objectCB.ButtonColor = System.Drawing.Color.Empty;
this.objectCB.FormattingEnabled = true;
this.objectCB.Location = new System.Drawing.Point(3, 3);
this.objectCB.Name = "objectCB";
this.objectCB.ReadOnly = true;
this.objectCB.Size = new System.Drawing.Size(164, 21);
this.objectCB.TabIndex = 0;
this.objectCB.SelectedIndexChanged += new System.EventHandler(this.objectCB_SelectedIndexChanged);
//
// stTabControl1
//
this.stTabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -184,7 +145,7 @@
this.stTabControl1.myBackColor = System.Drawing.Color.Empty;
this.stTabControl1.Name = "stTabControl1";
this.stTabControl1.SelectedIndex = 0;
this.stTabControl1.Size = new System.Drawing.Size(600, 462);
this.stTabControl1.Size = new System.Drawing.Size(740, 688);
this.stTabControl1.TabIndex = 1;
//
// tabPage1
@ -193,7 +154,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(592, 433);
this.tabPage1.Size = new System.Drawing.Size(732, 659);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "3D View";
this.tabPage1.UseVisualStyleBackColor = true;
@ -214,7 +175,7 @@
this.viewIntroCameraToolStripMenuItem});
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.stMenuStrip1.Name = "stMenuStrip1";
this.stMenuStrip1.Size = new System.Drawing.Size(606, 24);
this.stMenuStrip1.Size = new System.Drawing.Size(746, 24);
this.stMenuStrip1.TabIndex = 0;
this.stMenuStrip1.Text = "stMenuStrip1";
//
@ -230,16 +191,30 @@
this.stPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel4.Location = new System.Drawing.Point(3, 3);
this.stPanel4.Name = "stPanel4";
this.stPanel4.Size = new System.Drawing.Size(586, 427);
this.stPanel4.Size = new System.Drawing.Size(726, 653);
this.stPanel4.TabIndex = 0;
//
// treeView1
//
this.treeView1.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.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.treeView1.CheckBoxes = true;
this.treeView1.Location = new System.Drawing.Point(3, 3);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(203, 381);
this.treeView1.TabIndex = 3;
this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
//
// TurboMunntEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "TurboMunntEditor";
this.Size = new System.Drawing.Size(780, 492);
this.Size = new System.Drawing.Size(959, 718);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
@ -247,7 +222,6 @@
this.splitContainer1.ResumeLayout(false);
this.stPanel2.ResumeLayout(false);
this.stPanel1.ResumeLayout(false);
this.stPanel3.ResumeLayout(false);
this.stTabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.stMenuStrip1.ResumeLayout(false);
@ -263,16 +237,14 @@
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.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;
private Switch_Toolbox.Library.Forms.STTabControl stTabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private Switch_Toolbox.Library.Forms.STPanel stPanel4;
private System.Windows.Forms.TreeView treeView1;
}
}

View File

@ -16,6 +16,7 @@ namespace FirstPlugin.Forms
public partial class TurboMunntEditor : UserControl
{
Viewport viewport;
bool IsLoaded = false;
public TurboMunntEditor()
{
@ -23,6 +24,9 @@ namespace FirstPlugin.Forms
stTabControl1.myBackColor = FormThemes.BaseTheme.FormBackColor;
treeView1.BackColor = FormThemes.BaseTheme.FormBackColor;
treeView1.ForeColor = FormThemes.BaseTheme.FormForeColor;
viewport = new Viewport();
viewport.Dock = DockStyle.Fill;
viewport.scene.SelectionChanged += Scene_SelectionChanged;
@ -66,42 +70,51 @@ namespace FirstPlugin.Forms
viewport.LoadObjects();
objectCB.Items.Add("Scene");
objectCB.SelectedIndex = 0;
treeView1.Nodes.Add("Scene");
if (scene.LapPaths.Count > 0) {
objectCB.Items.Add("Lap Paths");
foreach (var group in scene.LapPaths)
{
foreach (var path in group.PathPoints)
{
path.OnPathMoved = OnPathMoved;
viewport.AddDrawable(path.RenderablePoint);
}
}
if (scene.EnemyPaths.Count > 0) {
AddPathDrawable("Enemy Path", scene.EnemyPaths);
}
if (scene.EnemyPaths.Count > 0) {
AddPathDrawable("Lap Path", scene.LapPaths, false);
}
if (scene.EnemyPaths.Count > 0)
IsLoaded = true;
}
private void AddPathDrawable(string Name, IEnumerable<PathGroup> Groups, bool CanConnect = true)
{
//Create a connectable object to connect each point
var renderablePathConnected = new RenderableConnectedPaths();
if (CanConnect) {
viewport.AddDrawable(renderablePathConnected);
}
//Load a node wrapper to the tree
var pathNode = new PathCollectionNode(Name);
treeView1.Nodes.Add(pathNode);
int groupIndex = 0;
foreach (var group in Groups)
{
objectCB.Items.Add("Enemy Paths");
var renderablePath = new RenderableConnectedPaths();
foreach (var group in scene.EnemyPaths)
renderablePath.AddGroup(group);
if (CanConnect)
renderablePathConnected.AddGroup(group);
viewport.AddDrawable(renderablePath);
var groupNode = new PathGroupNode($"{Name} Group{groupIndex++}");
pathNode.Nodes.Add(groupNode);
foreach (var group in scene.EnemyPaths)
int pointIndex = 0;
foreach (var path in group.PathPoints)
{
foreach (var path in group.PathPoints)
{
path.OnPathMoved = OnPathMoved;
viewport.AddDrawable(path.RenderablePoint);
}
var pontNode = new PathPointNode($"{Name} Point{pointIndex++}");
pontNode.PathPoint = path;
groupNode.Nodes.Add(pontNode);
path.OnPathMoved = OnPathMoved;
viewport.AddDrawable(path.RenderablePoint);
}
}
}
private void OnPathMoved() {
@ -119,39 +132,6 @@ namespace FirstPlugin.Forms
}
}
private void objectCB_SelectedIndexChanged(object sender, EventArgs e)
{
if (objectCB.SelectedIndex >= 0)
{
string Text = objectCB.GetSelectedText();
treeViewCustom1.Nodes.Clear();
if (Text == "Scene")
{
stPropertyGrid1.LoadProperty(scene, OnPropertyChanged);
}
else if (Text == "Lap Paths")
{
stPropertyGrid1.LoadProperty(scene, OnPropertyChanged);
for (int i = 0; i < scene.LapPaths.Count; 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);
}
}
}
private void OnPropertyChanged()
{
@ -161,5 +141,57 @@ namespace FirstPlugin.Forms
{
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
List<EditableObject> newSelection = new List<EditableObject>();
TreeNode node = treeView1.SelectedNode;
if (node == null)
return;
if (node is PathCollectionNode)
{
foreach (var group in ((PathCollectionNode)node).Nodes)
{
foreach (var point in ((PathGroupNode)group).Nodes)
{
newSelection.Add(((PathPointNode)point).PathPoint.RenderablePoint);
}
}
}
if (node is PathGroupNode)
{
foreach (var point in ((PathGroupNode)node).Nodes)
{
newSelection.Add(((PathPointNode)point).PathPoint.RenderablePoint);
}
}
if (node is PathPointNode)
{
newSelection.Add(((PathPointNode)node).PathPoint.RenderablePoint);
}
if (newSelection.Count > 0)
viewport.scene.SelectedObjects = newSelection;
}
private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) {
if (!IsLoaded)
return;
if (e.Node is PathPointNode)
((PathPointNode)e.Node).OnChecked(e.Node.Checked);
CheckChildNodes(e.Node, e.Node.Checked);
}
private void CheckChildNodes(TreeNode node, bool IsChecked)
{
foreach (TreeNode n in node.Nodes)
{
n.Checked = IsChecked;
}
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Switch_Toolbox.Library;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class PathCollectionNode : TreeNodeCustom
{
public PathCollectionNode(string text) { Text = text; Checked = true; }
public List<PathGroup> PathGroups = new List<PathGroup>();
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Switch_Toolbox.Library;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class PathGroupNode : TreeNodeCustom
{
public PathGroupNode(string text) { Text = text; Checked = true; }
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Switch_Toolbox.Library;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class PathPointNode : TreeNodeCustom
{
public PathPointNode(string text) { Text = text; Checked = true; }
public PathPoint PathPoint;
public void OnChecked(bool Checked)
{
if (PathPoint != null)
PathPoint.RenderablePoint.IsVisable = Checked;
}
}
}

View File

@ -343,6 +343,9 @@
<Compile Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.Designer.cs">
<DependentUpon>TurboMunntEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt\Wrappers\PathCollectionNode.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Wrappers\PathGroupNode.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Wrappers\PathPointNode.cs" />
<Compile Include="MarioCostumeEditor.cs" />
<Compile Include="GUI\AAMP\AampV1Editor.cs">
<SubType>UserControl</SubType>

View File

@ -1 +1 @@
b129ff847d9889dfce2afb4b6ab46e829b814157
16568860ef0401f7dec5cb2a9e482b7e36fd023f