More additions.

More progress on the basic pane animation editor. It can add and clear entries for frames, groups, etc.
Add the latest muunt editor files. A wip editor which is currently disabled. Planned to edit object placement paths paths supporting both 2D and 3D views.
This commit is contained in:
KillzXGaming 2019-10-20 12:57:48 -04:00
parent 4bea7a22f7
commit 871fc44178
85 changed files with 2697 additions and 139 deletions

View file

@ -10,7 +10,6 @@ using Toolbox.Library.Forms;
using Toolbox.Library.IO;
using ByamlExt.Byaml;
using ByamlExt;
using FirstPlugin.Turbo;
namespace FirstPlugin
{
@ -166,6 +165,13 @@ namespace FirstPlugin
editor.FileFormat = this;
editor.Text = FileName;
editor.Dock = DockStyle.Fill;
/* if (FileName.Contains("_muunt"))
{
var muuntEditor = new MuuntEditor.MuuntEditor();
muuntEditor.LoadByaml(data.RootNode, FileName);
muuntEditor.Show();
}*/
return editor;
}

View file

@ -273,6 +273,12 @@ namespace LayoutBXLYT
Textures = new List<string>();
}
public override BxlanPaiEntry AddEntry(string name, byte target) {
var entry = new PaiEntry(name, target);
Entries.Add(entry);
return entry;
}
public PAI1(FileReader reader, Header header)
{
long startPos = reader.Position - 8;
@ -342,6 +348,18 @@ namespace LayoutBXLYT
public class PaiEntry : BxlanPaiEntry
{
public override BxlanPaiTag AddEntry(string tag) {
var paiTag = new PaiTag(tag);
Tags.Add(paiTag);
return paiTag;
}
public PaiEntry(string name, byte target)
{
Name = name;
Target = (AnimationTarget)target;
}
public PaiEntry(FileReader reader, Header header)
{
long startPos = reader.Position;
@ -383,6 +401,11 @@ namespace LayoutBXLYT
{
private uint Unknown {get;set;}
public PaiTag(string tag)
{
Tag = tag;
}
public PaiTag(FileReader reader, BxlanHeader header, AnimationTarget target)
{
if ((byte)target == 2)

View file

@ -1420,12 +1420,27 @@ namespace LayoutBXLYT
public ushort FrameSize;
public bool Loop;
public List<string> Textures { get; set; }
public bool ContainsEntry(string name)
{
return Entries.Any(x => x.Name == name);
}
public virtual BxlanPaiEntry AddEntry(string name, byte target)
{
return new BxlanPaiEntry();
}
public List<string> Textures { get; set; } = new List<string>();
public List<BxlanPaiEntry> Entries = new List<BxlanPaiEntry>();
}
public class BxlanPaiEntry
{
public virtual BxlanPaiTag AddEntry(string tag)
{
return new BxlanPaiTag();
}
[DisplayName("Name"), CategoryAttribute("Animation")]
public string Name { get; set; }
@ -1447,6 +1462,29 @@ namespace LayoutBXLYT
Tag = tag;
}
public BxlanPaiTagEntry CreateTarget(object TargetType, byte interpolationType)
{
byte target = (byte)TargetType;
string tagType = Tag.Remove(0, 1);
switch (Tag)
{
case "LPA":
return new LPATagEntry(target, interpolationType);
case "LTS":
return new LTSTagEntry(target, interpolationType);
case "LVI":
return new LVITagEntry(target, interpolationType);
case "LVC":
return new LVCTagEntry(target, interpolationType);
case "LMC":
return new LMCTagEntry(target, interpolationType);
case "LTP":
return new LTPTagEntry(target, interpolationType);
default:
return new BxlanPaiTagEntry(target, interpolationType);
}
}
public List<BxlanPaiTagEntry> Entries = new List<BxlanPaiTagEntry>();
public string Tag;
@ -1456,7 +1494,7 @@ namespace LayoutBXLYT
get { return TypeDefine.ContainsKey(Tag) ? TypeDefine[Tag] : Tag; }
}
public Dictionary<string, string> TypeDefine = new Dictionary<string, string>()
public static Dictionary<string, string> TypeDefine = new Dictionary<string, string>()
{
{"FLPA","PaneSRT" },
{"FLVI","Visibility" },
@ -1504,6 +1542,7 @@ namespace LayoutBXLYT
set { AnimationTarget = (byte)value; }
}
public LPATagEntry(byte target, byte curveType) : base(target, curveType) { }
public LPATagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
}
@ -1517,6 +1556,7 @@ namespace LayoutBXLYT
set { AnimationTarget = (byte)value; }
}
public LTSTagEntry(byte target, byte curveType) : base(target, curveType) { }
public LTSTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
}
@ -1530,6 +1570,7 @@ namespace LayoutBXLYT
set { AnimationTarget = (byte)value; }
}
public LVITagEntry(byte target, byte curveType) : base(target, curveType) { }
public LVITagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
}
@ -1543,6 +1584,7 @@ namespace LayoutBXLYT
set { AnimationTarget = (byte)value; }
}
public LVCTagEntry(byte target, byte curveType) : base(target, curveType) { }
public LVCTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
}
@ -1556,6 +1598,7 @@ namespace LayoutBXLYT
set { AnimationTarget = (byte)value; }
}
public LMCTagEntry(byte target, byte curveType) : base(target, curveType) { }
public LMCTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
}
@ -1569,6 +1612,7 @@ namespace LayoutBXLYT
set { AnimationTarget = (byte)value; }
}
public LTPTagEntry(byte target, byte curveType) : base(target, curveType) { }
public LTPTagEntry(FileReader reader, BxlanHeader header) : base(reader, header) { }
}
@ -1590,6 +1634,11 @@ namespace LayoutBXLYT
public List<KeyFrame> KeyFrames = new List<KeyFrame>();
public BxlanPaiTagEntry(byte target, byte curveType)
{
AnimationTarget = target;
CurveType = (CurveType)curveType;
}
public BxlanPaiTagEntry(FileReader reader, BxlanHeader header)
{
@ -1659,6 +1708,13 @@ namespace LayoutBXLYT
[DisplayName("Value"), CategoryAttribute("Key Frame")]
public float Value { get; set; }
public KeyFrame(float frame)
{
Frame = frame;
Value = 0;
Slope = 0;
}
public KeyFrame(FileReader reader, CurveType curveType)
{
switch (curveType)
@ -1718,7 +1774,7 @@ namespace LayoutBXLYT
public virtual Dictionary<string, STGenericTexture> GetTextures { get; }
[Browsable(false)]
public virtual List<string> Textures { get; }
public virtual List<string> Textures { get; }
[Browsable(false)]
public virtual List<string> Fonts { get; }

View file

@ -354,16 +354,34 @@
<Compile Include="GL\LM2_Render.cs" />
<Compile Include="FileFormats\Layout\CAFE\BflytShader.cs" />
<Compile Include="GL\Custom2D\KCLRendering2D.cs" />
<Compile Include="GUI\BFLYT\Animations\Basic\AddAnimGroupDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\BFLYT\Animations\Basic\AddAnimGroupDialog.Designer.cs">
<DependentUpon>AddAnimGroupDialog.cs</DependentUpon>
</Compile>
<Compile Include="GUI\BFLYT\Animations\Basic\AddGroupTypeDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\BFLYT\Animations\Basic\AddGroupTypeDialog.Designer.cs">
<DependentUpon>AddGroupTypeDialog.cs</DependentUpon>
</Compile>
<Compile Include="GUI\BFLYT\Animations\Basic\AddGroupTargetDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\BFLYT\Animations\Basic\AddGroupTargetDialog.Designer.cs">
<DependentUpon>AddGroupTargetDialog.cs</DependentUpon>
</Compile>
<Compile Include="GUI\BFLYT\Animations\LayoutAnimEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\BFLYT\Animations\LayoutAnimEditor.Designer.cs">
<DependentUpon>LayoutAnimEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\BFLYT\Animations\LayoutAnimEditorBasic.cs">
<Compile Include="GUI\BFLYT\Animations\Basic\LayoutAnimEditorBasic.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\BFLYT\Animations\LayoutAnimEditorBasic.Designer.cs">
<Compile Include="GUI\BFLYT\Animations\Basic\LayoutAnimEditorBasic.Designer.cs">
<DependentUpon>LayoutAnimEditorBasic.cs</DependentUpon>
</Compile>
<Compile Include="GUI\BFLYT\Animations\LytAnimEditorKeyGUI.cs">
@ -648,16 +666,40 @@
<Compile Include="GUI\BFRES\SmoothNormalsMultiMeshForm.Designer.cs">
<DependentUpon>SmoothNormalsMultiMeshForm.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\MuuntEditor.cs">
<Compile Include="GUI\Byaml\MuuntEditor\Interfaces\IdrawableContainer.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\Interfaces\IDrawableObject.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\Interfaces\IMuuntLoader.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\Plugins\MK8\PathDrawableContainer.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\PropertyObject.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\MapObject.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\ObjectGroup.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\MuuntEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\MuuntEditor.Designer.cs">
<Compile Include="GUI\Byaml\MuuntEditor\MuuntEditor.Designer.cs">
<DependentUpon>MuuntEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\MuuntEditorDocker.cs">
<Compile Include="GUI\Byaml\MuuntEditor\MuuntEditorDocker.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\TrackEditor2D.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\MuuntEditor2D.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GUI\Byaml\MuuntEditor\MuuntObjectList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\Byaml\MuuntEditor\MuuntObjectList.Designer.cs">
<DependentUpon>MuuntObjectList.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\MuuntEditor\MuuntPropertiesEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\Byaml\MuuntEditor\MuuntPropertiesEditor.Designer.cs">
<DependentUpon>MuuntPropertiesEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\MuuntEditor\Plugins\MK8\TrackMuuntLoader.cs" />
<Compile Include="GUI\Byaml\MuuntEditor\PropertyGridConverters.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\RenderablePath.cs" />
<Compile Include="GUI\Editors\MK8TrackEditor\MapCameraViewer.cs">
<SubType>UserControl</SubType>
</Compile>
@ -853,39 +895,39 @@
<Compile Include="GUI\BFRES\TexturePattern\TexPatternMaterialEditor.Designer.cs">
<DependentUpon>TexPatternMaterialEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt\Base\BaseControlPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\BaseObjPt.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\PointID.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\RenderableConnectedMapPoints.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\CourseMuuntStructs.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\IObject.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\GravityPaths.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\IntroCamera.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\ItemPaths.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\EnemyPaths.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\GliderPaths.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\JugemPath.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\LapPaths.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\RenderablePathPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\ObjPath.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\Paths.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\BasePathGroup.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\PullPath.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\RenderableConnectedPaths.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\ReturnPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\BasePathPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\SteerAssistPath.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.cs">
<Compile Include="GUI\Byaml\TurboCourseMuunt\Base\BaseControlPoint.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Base\BaseObjPt.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Base\PointID.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Base\RenderableConnectedMapPoints.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\CourseMuuntStructs.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\IObject.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\GravityPaths.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\IntroCamera.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\ItemPaths.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\EnemyPaths.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\GliderPaths.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\JugemPath.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\LapPaths.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Base\RenderablePathPoint.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\ObjPath.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\Paths.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Base\BasePathGroup.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\PullPath.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\RenderableConnectedPaths.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\ReturnPoint.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Base\BasePathPoint.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Paths\SteerAssistPath.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\TurboMunntEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.Designer.cs">
<Compile Include="GUI\Byaml\TurboCourseMuunt\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="GUI\Byaml\CourseMuunt\Wrappers\ProbeLightingEntryWrapper.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Wrappers\ProbeLightingWrapper.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Wrappers\PathCollectionNode.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Wrappers\PathGroupNode.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Wrappers\PathPointNode.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Wrappers\ProbeLightingEntryWrapper.cs" />
<Compile Include="GUI\Byaml\TurboCourseMuunt\Wrappers\ProbeLightingWrapper.cs" />
<Compile Include="GUI\Editors\EffectTableEditor.cs">
<SubType>UserControl</SubType>
</Compile>
@ -1339,10 +1381,19 @@
<EmbeddedResource Include="GUI\BFFNT\BffntEditor.resx">
<DependentUpon>BffntEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Animations\Basic\AddAnimGroupDialog.resx">
<DependentUpon>AddAnimGroupDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Animations\Basic\AddGroupTypeDialog.resx">
<DependentUpon>AddGroupTypeDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Animations\Basic\AddGroupTargetDialog.resx">
<DependentUpon>AddGroupTargetDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Animations\LayoutAnimEditor.resx">
<DependentUpon>LayoutAnimEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Animations\LayoutAnimEditorBasic.resx">
<EmbeddedResource Include="GUI\BFLYT\Animations\Basic\LayoutAnimEditorBasic.resx">
<DependentUpon>LayoutAnimEditorBasic.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Animations\LytKeyPaneSRTPanel.resx">
@ -1600,10 +1651,16 @@
<EmbeddedResource Include="GUI\BotwActorEditorControl.resx">
<DependentUpon>BotwActorEditorControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Byaml\CourseMuunt2D\MuuntEditor.resx">
<EmbeddedResource Include="GUI\Byaml\MuuntEditor\MuuntEditor.resx">
<DependentUpon>MuuntEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.resx">
<EmbeddedResource Include="GUI\Byaml\MuuntEditor\MuuntObjectList.resx">
<DependentUpon>MuuntObjectList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Byaml\MuuntEditor\MuuntPropertiesEditor.resx">
<DependentUpon>MuuntPropertiesEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Byaml\TurboCourseMuunt\TurboMunntEditor.resx">
<DependentUpon>TurboMunntEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFRES\ParamAnim\AnimParamEditor.resx">
@ -1801,6 +1858,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="FileFormats\EvemtFlow\" />
<Folder Include="GUI\Byaml\MuuntEditor\Renderables\" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ArrowIcon.png" />

View file

@ -0,0 +1,141 @@
namespace LayoutBXLYT
{
partial class AddAnimGroupDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.typeCB = new Toolbox.Library.Forms.STComboBox();
this.stTextBox1 = new Toolbox.Library.Forms.STTextBox();
this.objectTargetsCB = new Toolbox.Library.Forms.STComboBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
this.stButton1 = new Toolbox.Library.Forms.STButton();
this.contentContainer.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.stButton1);
this.contentContainer.Controls.Add(this.stLabel2);
this.contentContainer.Controls.Add(this.stLabel1);
this.contentContainer.Controls.Add(this.objectTargetsCB);
this.contentContainer.Controls.Add(this.stTextBox1);
this.contentContainer.Controls.Add(this.typeCB);
this.contentContainer.Size = new System.Drawing.Size(375, 155);
this.contentContainer.Controls.SetChildIndex(this.typeCB, 0);
this.contentContainer.Controls.SetChildIndex(this.stTextBox1, 0);
this.contentContainer.Controls.SetChildIndex(this.objectTargetsCB, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel2, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton1, 0);
//
// typeCB
//
this.typeCB.BorderColor = System.Drawing.Color.Empty;
this.typeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.typeCB.ButtonColor = System.Drawing.Color.Empty;
this.typeCB.FormattingEnabled = true;
this.typeCB.IsReadOnly = false;
this.typeCB.Location = new System.Drawing.Point(74, 45);
this.typeCB.Name = "typeCB";
this.typeCB.Size = new System.Drawing.Size(285, 21);
this.typeCB.TabIndex = 11;
this.typeCB.SelectedIndexChanged += new System.EventHandler(this.typeCB_SelectedIndexChanged);
//
// stTextBox1
//
this.stTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.stTextBox1.Location = new System.Drawing.Point(74, 83);
this.stTextBox1.Name = "stTextBox1";
this.stTextBox1.Size = new System.Drawing.Size(145, 20);
this.stTextBox1.TabIndex = 12;
//
// objectTargetsCB
//
this.objectTargetsCB.BorderColor = System.Drawing.Color.Empty;
this.objectTargetsCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.objectTargetsCB.ButtonColor = System.Drawing.Color.Empty;
this.objectTargetsCB.FormattingEnabled = true;
this.objectTargetsCB.IsReadOnly = false;
this.objectTargetsCB.Location = new System.Drawing.Point(225, 82);
this.objectTargetsCB.Name = "objectTargetsCB";
this.objectTargetsCB.Size = new System.Drawing.Size(134, 21);
this.objectTargetsCB.TabIndex = 13;
this.objectTargetsCB.SelectedIndexChanged += new System.EventHandler(this.objectTargetsCB_SelectedIndexChanged);
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(34, 48);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(34, 13);
this.stLabel1.TabIndex = 14;
this.stLabel1.Text = "Type:";
//
// stLabel2
//
this.stLabel2.AutoSize = true;
this.stLabel2.Location = new System.Drawing.Point(34, 85);
this.stLabel2.Name = "stLabel2";
this.stLabel2.Size = new System.Drawing.Size(38, 13);
this.stLabel2.TabIndex = 15;
this.stLabel2.Text = "Name:";
//
// stButton1
//
this.stButton1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(291, 123);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 16;
this.stButton1.Text = "Ok";
this.stButton1.UseVisualStyleBackColor = false;
//
// AddAnimGroupDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(381, 160);
this.Name = "AddAnimGroupDialog";
this.Text = "Add Group";
this.contentContainer.ResumeLayout(false);
this.contentContainer.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Toolbox.Library.Forms.STButton stButton1;
private Toolbox.Library.Forms.STLabel stLabel2;
private Toolbox.Library.Forms.STLabel stLabel1;
private Toolbox.Library.Forms.STComboBox objectTargetsCB;
private Toolbox.Library.Forms.STTextBox stTextBox1;
private Toolbox.Library.Forms.STComboBox typeCB;
}
}

View file

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
namespace LayoutBXLYT
{
public partial class AddAnimGroupDialog : STForm
{
private BxlanPAI1 AnimInfo;
private BxlytHeader ParentLayout;
public AddAnimGroupDialog(BxlanPAI1 bxlanPai, BxlytHeader parentLayout)
{
InitializeComponent();
CanResize = false;
AnimInfo = bxlanPai;
ParentLayout = parentLayout;
typeCB.LoadEnum(typeof(AnimationTarget));
typeCB.SelectedIndex = 0;
}
public BxlanPaiEntry AddEntry()
{
return AnimInfo.AddEntry(stTextBox1.Text, (byte)typeCB.SelectedItem);
}
private void typeCB_SelectedIndexChanged(object sender, EventArgs e)
{
if (ParentLayout != null && typeCB.SelectedItem is AnimationTarget)
{
objectTargetsCB.Items.Clear();
if ((AnimationTarget)typeCB.SelectedItem == AnimationTarget.Pane)
{
foreach (var pane in ParentLayout.PaneLookup.Keys)
if (!AnimInfo.ContainsEntry(pane))
objectTargetsCB.Items.Add(pane);
}
else if ((AnimationTarget)typeCB.SelectedItem == AnimationTarget.Material)
{
foreach (var mat in ParentLayout.GetMaterials())
if (!AnimInfo.ContainsEntry(mat.Name))
objectTargetsCB.Items.Add(mat.Name);
}
if (objectTargetsCB.Items.Count > 0)
objectTargetsCB.SelectedIndex = 0;
}
}
private void objectTargetsCB_SelectedIndexChanged(object sender, EventArgs e)
{
stTextBox1.Text = (string)objectTargetsCB.SelectedItem;
}
}
}

View file

@ -0,0 +1,128 @@
namespace LayoutBXLYT
{
partial class AddGroupTargetDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.targetCB = new Toolbox.Library.Forms.STComboBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.stButton1 = new Toolbox.Library.Forms.STButton();
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
this.curveTypeCB = new Toolbox.Library.Forms.STComboBox();
this.contentContainer.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.stLabel2);
this.contentContainer.Controls.Add(this.curveTypeCB);
this.contentContainer.Controls.Add(this.stButton1);
this.contentContainer.Controls.Add(this.stLabel1);
this.contentContainer.Controls.Add(this.targetCB);
this.contentContainer.Size = new System.Drawing.Size(316, 143);
this.contentContainer.Controls.SetChildIndex(this.targetCB, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton1, 0);
this.contentContainer.Controls.SetChildIndex(this.curveTypeCB, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel2, 0);
//
// targetCB
//
this.targetCB.BorderColor = System.Drawing.Color.Empty;
this.targetCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.targetCB.ButtonColor = System.Drawing.Color.Empty;
this.targetCB.FormattingEnabled = true;
this.targetCB.IsReadOnly = false;
this.targetCB.Location = new System.Drawing.Point(96, 35);
this.targetCB.Name = "targetCB";
this.targetCB.Size = new System.Drawing.Size(208, 21);
this.targetCB.TabIndex = 11;
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(20, 38);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(41, 13);
this.stLabel1.TabIndex = 12;
this.stLabel1.Text = "Target:";
//
// stButton1
//
this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stButton1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(232, 111);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 13;
this.stButton1.Text = "Ok";
this.stButton1.UseVisualStyleBackColor = false;
//
// stLabel2
//
this.stLabel2.AutoSize = true;
this.stLabel2.Location = new System.Drawing.Point(20, 65);
this.stLabel2.Name = "stLabel2";
this.stLabel2.Size = new System.Drawing.Size(68, 13);
this.stLabel2.TabIndex = 15;
this.stLabel2.Text = "Curve Type::";
//
// curveTypeCB
//
this.curveTypeCB.BorderColor = System.Drawing.Color.Empty;
this.curveTypeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.curveTypeCB.ButtonColor = System.Drawing.Color.Empty;
this.curveTypeCB.FormattingEnabled = true;
this.curveTypeCB.IsReadOnly = false;
this.curveTypeCB.Location = new System.Drawing.Point(96, 62);
this.curveTypeCB.Name = "curveTypeCB";
this.curveTypeCB.Size = new System.Drawing.Size(208, 21);
this.curveTypeCB.TabIndex = 14;
//
// AddGroupTargetDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(322, 148);
this.Name = "AddGroupTargetDialog";
this.Text = "Add Target";
this.contentContainer.ResumeLayout(false);
this.contentContainer.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Toolbox.Library.Forms.STLabel stLabel1;
private Toolbox.Library.Forms.STComboBox targetCB;
private Toolbox.Library.Forms.STLabel stLabel2;
private Toolbox.Library.Forms.STComboBox curveTypeCB;
private Toolbox.Library.Forms.STButton stButton1;
}
}

View file

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
namespace LayoutBXLYT
{
public partial class AddGroupTargetDialog : STForm
{
private BxlanPaiTag activeTag;
public AddGroupTargetDialog()
{
InitializeComponent();
CanResize = false;
}
public bool LoadTag(BxlanPaiTag group)
{
activeTag = group;
curveTypeCB.LoadEnum(typeof(CurveType));
curveTypeCB.SelectedItem = CurveType.Hermite;
//Go through each group type
//If either all targets are used, or is not supported we will return false
if (group.Type == "PaneSRT")
return LoadEnum(typeof(LPATarget));
else if (group.Type == "Visibility")
return LoadEnum(typeof(LVITarget));
else if (group.Type == "TextureSRT")
return LoadEnum(typeof(LTSTarget));
else if (group.Type == "VertexColor")
return LoadEnum(typeof(LVCTarget));
else if (group.Type == "TexturePattern")
return LoadEnum(typeof(LTPTarget));
else if (group.Type == "IndTextureSRT")
return LoadEnum(typeof(LIMTarget));
else if (group.Type == "AlphaTest")
{
}
else if (group.Type == "FontShadow")
return LoadEnum(typeof(LCTTarget));
else if (group.Type == "PerCharacterTransformCurve")
{
}
return false;
}
private bool LoadEnum(Type type)
{
targetCB.Items.Clear();
var enums = Enum.GetValues(type);
foreach (var val in Enum.GetValues(type))
{
if (!activeTag.Entries.Any(x => byte.Equals((byte)val, x.AnimationTarget)))
targetCB.Items.Add(val);
}
if (targetCB.Items.Count > 0)
targetCB.SelectedIndex = 0;
//Check if it loaded enums properly
return targetCB.Items.Count > 0;
}
public BxlanPaiTagEntry GetGroupTarget()
{
return activeTag.CreateTarget(targetCB.SelectedItem, (byte)curveTypeCB.SelectedItem);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,98 @@
namespace LayoutBXLYT
{
partial class AddGroupTypeDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.stComboBox1 = new Toolbox.Library.Forms.STComboBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.stButton1 = new Toolbox.Library.Forms.STButton();
this.contentContainer.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.stButton1);
this.contentContainer.Controls.Add(this.stLabel1);
this.contentContainer.Controls.Add(this.stComboBox1);
this.contentContainer.Size = new System.Drawing.Size(278, 112);
this.contentContainer.Controls.SetChildIndex(this.stComboBox1, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton1, 0);
//
// stComboBox1
//
this.stComboBox1.BorderColor = System.Drawing.Color.Empty;
this.stComboBox1.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.stComboBox1.ButtonColor = System.Drawing.Color.Empty;
this.stComboBox1.FormattingEnabled = true;
this.stComboBox1.IsReadOnly = false;
this.stComboBox1.Location = new System.Drawing.Point(74, 45);
this.stComboBox1.Name = "stComboBox1";
this.stComboBox1.Size = new System.Drawing.Size(196, 21);
this.stComboBox1.TabIndex = 11;
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(23, 48);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(34, 13);
this.stLabel1.TabIndex = 12;
this.stLabel1.Text = "Type:";
//
// stButton1
//
this.stButton1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(195, 81);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 13;
this.stButton1.Text = "Ok";
this.stButton1.UseVisualStyleBackColor = false;
//
// AddGroupTypeDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 117);
this.Name = "AddGroupTypeDialog";
this.Text = "Add Group Type";
this.contentContainer.ResumeLayout(false);
this.contentContainer.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Toolbox.Library.Forms.STButton stButton1;
private Toolbox.Library.Forms.STLabel stLabel1;
private Toolbox.Library.Forms.STComboBox stComboBox1;
}
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
namespace LayoutBXLYT
{
public partial class AddGroupTypeDialog : STForm
{
private BxlanPaiEntry ActiveGroup;
public AddGroupTypeDialog(BxlanPaiEntry animGroup)
{
InitializeComponent();
CanResize = false;
ActiveGroup = animGroup;
foreach (var tagDefine in BxlanPaiTag.TypeDefine)
{
if (!animGroup.Tags.Any(x => x.Tag == tagDefine.Key ))
stComboBox1.Items.Add(tagDefine.Value);
}
stComboBox1.SelectedIndex = 0;
}
public BxlanPaiTag AddEntry()
{
var tagValue = BxlanPaiTag.TypeDefine.FirstOrDefault(x => x.Value == (string)stComboBox1.SelectedItem).Key;
return ActiveGroup.AddEntry(tagValue);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -62,6 +62,9 @@
this.treeView1.Size = new System.Drawing.Size(266, 450);
this.treeView1.TabIndex = 0;
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);
this.treeView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeView1_KeyPress);
this.treeView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.treeView1_MouseClick);
//
// stPropertyGrid1
//

View file

@ -14,6 +14,7 @@ namespace LayoutBXLYT
{
public partial class LayoutAnimEditorBasic : LayoutDocked
{
private BxlytHeader ParentLayout;
private BxlanHeader ActiveAnim;
public EventHandler OnPropertyChanged;
@ -26,8 +27,9 @@ namespace LayoutBXLYT
splitContainer1.BackColor = FormThemes.BaseTheme.FormBackColor;
}
public void LoadAnim(BxlanHeader bxlan)
public void LoadAnim(BxlanHeader bxlan, BxlytHeader parentLayout = null)
{
ParentLayout = parentLayout;
LoadAnimations(bxlan, new TreeNode(bxlan.FileName) { Tag = bxlan });
}
@ -42,7 +44,7 @@ namespace LayoutBXLYT
{
var header = bxlan as BxlanHeader;
var pat1 = new TreeNode("Tag Info") { Tag = header.AnimationTag };
var pai1 = new TreeNode("Animation Info") { Tag = header.AnimationInfo };
var pai1 = new AnimInfoWrapper("Animation Info", ParentLayout) { Tag = header.AnimationInfo };
for (int i = 0; i < header.AnimationInfo.Entries.Count; i++)
LoadAnimationEntry(header.AnimationInfo.Entries[i], pai1);
@ -54,12 +56,12 @@ namespace LayoutBXLYT
private void LoadAnimationEntry(BxlanPaiEntry entry, TreeNode root)
{
var nodeEntry = new TreeNode(entry.Name) { Tag = entry };
var nodeEntry = new GroupAnimWrapper(entry.Name) { Tag = entry };
root.Nodes.Add(nodeEntry);
for (int i = 0; i < entry.Tags.Count; i++)
{
var nodeTag = new TreeNode(entry.Tags[i].Type) { Tag = entry.Tags[i] };
var nodeTag = new GroupWrapper(entry.Tags[i].Type) { Tag = entry.Tags[i] };
nodeEntry.Nodes.Add(nodeTag);
for (int j = 0; j < entry.Tags[i].Entries.Count; j++)
LoadTagEntry(entry.Tags[i].Entries[j], nodeTag, j);
@ -68,12 +70,12 @@ namespace LayoutBXLYT
private void LoadTagEntry(BxlanPaiTagEntry entry, TreeNode root, int index)
{
var nodeEntry = new TreeNode(entry.TargetName) { Tag = entry };
var nodeEntry = new GroupTargetWrapper(entry.TargetName) { Tag = entry };
root.Nodes.Add(nodeEntry);
for (int i = 0; i < entry.KeyFrames.Count; i++)
{
var keyNode = new TreeNode($"Key Frame {i}") { Tag = entry.KeyFrames[i] };
var keyNode = new KeyNodeWrapper($"Key Frame {i}") { Tag = entry.KeyFrames[i] };
nodeEntry.Nodes.Add(keyNode);
}
}
@ -94,6 +96,43 @@ namespace LayoutBXLYT
ActiveAnim.FileInfo.CanSave = true;
}
public class AnimInfoWrapper : TreeNode, IContextMenuNode
{
private BxlytHeader ParentLayout;
public BxlanPAI1 bxlanPai => (BxlanPAI1)Tag;
public AnimInfoWrapper(string text, BxlytHeader parentLayout)
{
Text = text;
ParentLayout = parentLayout;
}
public ToolStripItem[] GetContextMenuItems()
{
List<ToolStripItem> Items = new List<ToolStripItem>();
Items.Add(new ToolStripMenuItem("Add Animation Group", null, AddGroup, Keys.Control | Keys.A));
Items.Add(new ToolStripMenuItem("Clear Groups", null, ClearGroups, Keys.Control | Keys.C));
return Items.ToArray();
}
private void AddGroup(object sender, EventArgs e)
{
AddAnimGroupDialog dlg = new AddAnimGroupDialog(bxlanPai, ParentLayout);
if (dlg.ShowDialog() == DialogResult.OK)
{
var entry = dlg.AddEntry();
var nodeEntry = new GroupAnimWrapper(entry.Name) { Tag = entry };
Nodes.Add(nodeEntry);
}
}
private void ClearGroups(object sender, EventArgs e)
{
bxlanPai.Entries.Clear();
Nodes.Clear();
}
}
public class GroupAnimWrapper : TreeNode, IContextMenuNode
{
public BxlanPaiEntry PaiEntry => (BxlanPaiEntry)Tag;
@ -112,7 +151,13 @@ namespace LayoutBXLYT
private void AddGroup(object sender, EventArgs e)
{
AddGroupTypeDialog dlg = new AddGroupTypeDialog(PaiEntry);
if (dlg.ShowDialog() == DialogResult.OK)
{
var tag = dlg.AddEntry();
var nodeEntry = new GroupWrapper(tag.Type) { Tag = tag };
Nodes.Add(nodeEntry);
}
}
private void ClearGroups(object sender, EventArgs e)
@ -124,6 +169,8 @@ namespace LayoutBXLYT
public class GroupWrapper : TreeNode, IContextMenuNode
{
public BxlanPaiEntry ParentPaiEntry => (BxlanPaiEntry)Parent.Tag;
public BxlanPaiTag GroupTag => (BxlanPaiTag)Tag;
public GroupWrapper(string text) {
@ -140,18 +187,31 @@ namespace LayoutBXLYT
private void AddTarget(object sender, EventArgs e)
{
AddGroupTargetDialog dlg = new AddGroupTargetDialog();
bool canLoad = dlg.LoadTag(GroupTag);
if (dlg.ShowDialog() == DialogResult.OK && canLoad)
{
BxlanPaiTagEntry target = dlg.GetGroupTarget();
target.Index = (byte)GroupTag.Entries.Count;
GroupTag.Entries.Add(target);
var nodeEntry = new GroupTargetWrapper(target.TargetName) { Tag = target };
Nodes.Add(nodeEntry);
}
}
private void ClearTargets(object sender, EventArgs e)
{
GroupTag.Entries.Clear();
Nodes.Clear();
}
}
public class GroupTargetWrapper : TreeNode, IContextMenuNode
{
public BxlanPaiTag GroupTag => (BxlanPaiTag)Parent.Tag;
public BxlanPaiTagEntry TypeTag => (BxlanPaiTagEntry)Tag;
public GroupTargetWrapper(string text) {
@ -161,30 +221,55 @@ namespace LayoutBXLYT
public ToolStripItem[] GetContextMenuItems()
{
List<ToolStripItem> Items = new List<ToolStripItem>();
Items.Add(new ToolStripMenuItem("Add Keyframe", null, AddeKey, Keys.Control | Keys.A));
Items.Add(new ToolStripMenuItem("Add Keyframe", null, AddKey, Keys.Control | Keys.A));
Items.Add(new ToolStripMenuItem("Remove Target", null, RemoveTarget, Keys.Delete));
Items.Add(new ToolStripMenuItem("Clear Keys", null, RemoveKeys, Keys.Control | Keys.C));
return Items.ToArray();
}
private void AddeKey(object sender, EventArgs e)
private void AddKey(object sender, EventArgs e)
{
float frame = 0;
if (TypeTag.KeyFrames.Count > 0)
frame = TypeTag.KeyFrames.Max(k => k.Frame) + 1;
var keyFrame = new KeyFrame(frame);
var keyNode = new KeyNodeWrapper($"Key Frame {TypeTag.KeyFrames.Count}")
{ Tag = keyFrame };
TypeTag.KeyFrames.Add(keyFrame);
Nodes.Add(keyNode);
}
private void RemoveKeys(object sender, EventArgs e)
{
TypeTag.KeyFrames.Clear();
Nodes.Clear();
}
private void RemoveTarget(object sender, EventArgs e)
{
GroupTag.Entries.Remove(TypeTag);
Parent.Nodes.Remove(this);
}
public void UpdateKeys(TreeNode removedNode)
{
int index = 0;
foreach (TreeNode node in Nodes)
{
if (node == removedNode)
continue;
node.Text = $"Key Frame {index++}";
}
}
}
public class KeyNodeWrapper : TreeNode, IContextMenuNode
{
public BxlanPaiTagEntry TypeTag => (BxlanPaiTagEntry)Parent.Tag;
public KeyFrame KeyFrame => (KeyFrame)Tag;
public KeyNodeWrapper(string text) {
@ -194,13 +279,53 @@ namespace LayoutBXLYT
public ToolStripItem[] GetContextMenuItems()
{
List<ToolStripItem> Items = new List<ToolStripItem>();
Items.Add(new ToolStripMenuItem("Rename Actor Files (Odyssey)", null, RemoveKey, Keys.Delete));
Items.Add(new ToolStripMenuItem("Remove Key", null, RemoveKey, Keys.Delete));
return Items.ToArray();
}
private void RemoveKey(object sender, EventArgs e)
{
TypeTag.KeyFrames.Remove(KeyFrame);
((GroupTargetWrapper)Parent).UpdateKeys(this);
Parent.Nodes.Remove(this);
}
}
private void treeView1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
}
}
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Button == MouseButtons.Right) {
if (e.Node is IContextMenuNode)
{
STContextMenuStrip contextMenu = new STContextMenuStrip();
contextMenu.Items.AddRange(((IContextMenuNode)e.Node).GetContextMenuItems());
contextMenu.Show(Cursor.Position);
}
}
}
private void treeView1_KeyPress(object sender, KeyEventArgs e)
{
if (treeView1.SelectedNode != null && treeView1.SelectedNode is IContextMenuNode)
{
IContextMenuNode node = (IContextMenuNode)treeView1.SelectedNode;
var Items = node.GetContextMenuItems();
foreach (ToolStripItem toolstrip in Items)
{
if (toolstrip is ToolStripMenuItem)
{
if (((ToolStripMenuItem)toolstrip).ShortcutKeys == e.KeyData)
toolstrip.PerformClick();
}
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -51,7 +51,8 @@ namespace LayoutBXLYT
{
InitializeComponent();
chkAutoKey.Hide();
chkAutoKey.Enabled = false;
chkAutoKey.ForeColor = FormThemes.BaseTheme.FormForeColor;
CustomMapper = new LayoutCustomPaneMapper();
@ -415,7 +416,7 @@ namespace LayoutBXLYT
public void ShowBxlanEditor(BxlanHeader bxlan)
{
LayoutAnimEditorBasic editor = new LayoutAnimEditorBasic();
editor.LoadAnim(bxlan);
editor.LoadAnim(bxlan, ActiveLayout);
editor.OnPropertyChanged += AnimPropertyChanged;
editor.Show(this);
@ -1122,9 +1123,9 @@ namespace LayoutBXLYT
{
Runtime.LayoutEditor.AnimationEditMode = editorModeCB.SelectedIndex == 1;
if (Runtime.LayoutEditor.AnimationEditMode)
chkAutoKey.Show();
chkAutoKey.Enabled = true;
else
chkAutoKey.Hide();
chkAutoKey.Enabled = false;
if (LayoutPaneEditor != null)
LayoutPaneEditor.ReloadEditor();

View file

@ -1,11 +0,0 @@
using System.Collections.Generic;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class BasePathGroup
{
public bool ConnectGroups = true;
public List<BasePathPoint> PathPoints = new List<BasePathPoint>();
}
}

View file

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Toolbox.Library.Forms;
using Toolbox.Library;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace FirstPlugin.Turbo
{
public class MuuntEditor2D
{
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK;
namespace FirstPlugin.MuuntEditor
{
public interface IDrawableObject
{
void Draw(Matrix4 mvp);
}
}

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FirstPlugin.MuuntEditor
{
public interface IMuuntLoader
{
List<ObjectGroup> Groups { get; set; }
bool Identify(dynamic byml, string fileName);
void Load(dynamic byml);
}
}

View file

@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeifenLuo.WinFormsUI.Docking;
namespace FirstPlugin.Forms
namespace FirstPlugin.MuuntEditor
{
public class MuuntEditorDocker : DockContent
public interface IDrawableContainer
{
IDrawableObject Drawable { get; }
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace FirstPlugin.MuuntEditor
{
public class MapObject : PropertyObject
{
public IDrawableObject Drawable { get; set; }
}
}

View file

@ -1,4 +1,4 @@
namespace FirstPlugin.Forms
namespace FirstPlugin.MuuntEditor
{
partial class MuuntEditor
{
@ -31,12 +31,12 @@
this.dockPanel1 = new WeifenLuo.WinFormsUI.Docking.DockPanel();
this.stMenuStrip1 = new Toolbox.Library.Forms.STMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toggle3DViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toggle3DViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stToolStrip1 = new Toolbox.Library.Forms.STToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.stMenuStrip1.SuspendLayout();
@ -48,9 +48,9 @@
this.dockPanel1.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.dockPanel1.Location = new System.Drawing.Point(0, 52);
this.dockPanel1.Location = new System.Drawing.Point(0, 48);
this.dockPanel1.Name = "dockPanel1";
this.dockPanel1.Size = new System.Drawing.Size(471, 363);
this.dockPanel1.Size = new System.Drawing.Size(574, 349);
this.dockPanel1.TabIndex = 0;
//
// stMenuStrip1
@ -62,7 +62,7 @@
this.viewToolStripMenuItem});
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.stMenuStrip1.Name = "stMenuStrip1";
this.stMenuStrip1.Size = new System.Drawing.Size(471, 24);
this.stMenuStrip1.Size = new System.Drawing.Size(574, 24);
this.stMenuStrip1.TabIndex = 2;
this.stMenuStrip1.Text = "stMenuStrip1";
//
@ -76,6 +76,24 @@
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.openToolStripMenuItem.Text = "Open";
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.saveToolStripMenuItem.Text = "Save";
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
this.saveAsToolStripMenuItem.Text = "Save As";
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
@ -93,27 +111,9 @@
// toggle3DViewToolStripMenuItem
//
this.toggle3DViewToolStripMenuItem.Name = "toggle3DViewToolStripMenuItem";
this.toggle3DViewToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.toggle3DViewToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
this.toggle3DViewToolStripMenuItem.Text = "Toggle 3D View";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.openToolStripMenuItem.Text = "Open";
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "Save";
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveAsToolStripMenuItem.Text = "Save As";
//
// stToolStrip1
//
this.stToolStrip1.HighlightSelectedTab = false;
@ -121,7 +121,7 @@
this.toolStripButton1});
this.stToolStrip1.Location = new System.Drawing.Point(0, 24);
this.stToolStrip1.Name = "stToolStrip1";
this.stToolStrip1.Size = new System.Drawing.Size(471, 25);
this.stToolStrip1.Size = new System.Drawing.Size(574, 25);
this.stToolStrip1.TabIndex = 3;
this.stToolStrip1.Text = "stToolStrip1";
//
@ -138,13 +138,14 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(471, 412);
this.ClientSize = new System.Drawing.Size(574, 394);
this.Controls.Add(this.stToolStrip1);
this.Controls.Add(this.dockPanel1);
this.Controls.Add(this.stMenuStrip1);
this.IsMdiContainer = true;
this.MainMenuStrip = this.stMenuStrip1;
this.Name = "MuuntEditor";
this.Text = "MarioKartMuuntEditor";
this.Text = "Map Unit Editor";
this.stMenuStrip1.ResumeLayout(false);
this.stMenuStrip1.PerformLayout();
this.stToolStrip1.ResumeLayout(false);

View file

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
using WeifenLuo.WinFormsUI.Docking;
using FirstPlugin;
namespace FirstPlugin.MuuntEditor
{
public partial class MuuntEditor : Form
{
public List<ObjectGroup> Groups = new List<ObjectGroup>();
public EventHandler ObjectSelected;
private List<IMuuntLoader> Plugins = new List<IMuuntLoader>();
private dynamic ActiveByml;
private MuuntEditor2D Viewport2D;
private MuuntObjectList ObjectList;
private MuuntPropertiesEditor PropertiesEditor;
public MuuntEditor()
{
InitializeComponent();
ThemeBase theme = new VS2015DarkTheme();
if (FormThemes.ActivePreset == FormThemes.Preset.White)
theme = new VS2015LightTheme();
this.dockPanel1.Theme = theme;
this.dockPanel1.BackColor = FormThemes.BaseTheme.FormBackColor;
this.BackColor = FormThemes.BaseTheme.FormBackColor;
Plugins.Add(new TrackMuuntLoader());
ObjectSelected += OnObjectSelected;
}
public void LoadByaml(dynamic byml, string fileName) {
ActiveByml = byml;
LoadPlugins(byml, fileName);
LoadPanels();
}
private void LoadPanels()
{
ShowObjectList();
ShowPropertiesEditor();
}
private void LoadPlugins(dynamic byml, string fileName)
{
for (int i = 0; i < Plugins.Count; i++) {
if (Plugins[i].Identify(byml, fileName)) {
Plugins[i].Load(byml);
Groups = Plugins[i].Groups;
}
}
LoadViewport();
}
private void LoadViewport()
{
DockContent dockContent = new DockContent();
Viewport2D = new MuuntEditor2D(this);
Viewport2D.Dock = DockStyle.Fill;
dockContent.Controls.Add(Viewport2D);
dockContent.Show(dockPanel1, DockState.Document);
dockContent.DockHandler.AllowEndUserDocking = false;
}
private void ShowObjectList()
{
if (ObjectList != null)
return;
ObjectList = new MuuntObjectList(this);
ObjectList.LoadObjects(Groups);
ObjectList.Show(dockPanel1, DockState.DockLeft);
}
private void ShowPropertiesEditor()
{
if (PropertiesEditor != null)
return;
PropertiesEditor = new MuuntPropertiesEditor(this);
if (ObjectList != null)
PropertiesEditor.Show(ObjectList.Pane, DockAlignment.Bottom, 0.5);
PropertiesEditor.Show(dockPanel1, DockState.DockLeft);
}
private void OnObjectSelected(object sender, EventArgs e)
{
}
}
}

View file

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Toolbox.Library.Forms;
using Toolbox.Library;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace FirstPlugin.MuuntEditor
{
public class MuuntEditor2D : Viewport2D
{
private MuuntEditor ParentEditor;
public MuuntEditor2D(MuuntEditor editor)
{
ParentEditor = editor;
}
public override void RenderSceme()
{
foreach (var group in ParentEditor.Groups)
{
if (group is IDrawableContainer)
((IDrawableContainer)group).Drawable?.Draw(Camera.ModelMatrix);
}
}
public override List<IPickable2DObject> GetPickableObjects()
{
List<IPickable2DObject> picks = new List<IPickable2DObject>();
foreach (var group in ParentEditor.Groups)
{
foreach (var obj in group.Objects)
{
if (obj is IPickable2DObject)
picks.Add((IPickable2DObject)obj);
foreach (var subobj in obj.SubObjects)
{
if (subobj is IPickable2DObject)
picks.Add((IPickable2DObject)subobj);
}
}
}
return picks;
}
}
}

View file

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeifenLuo.WinFormsUI.Docking;
using Toolbox.Library.Forms;
namespace FirstPlugin.MuuntEditor
{
public class MuuntEditorDocker : DockContent
{
public MuuntEditorDocker()
{
BackColor = FormThemes.BaseTheme.FormBackColor;
ForeColor = FormThemes.BaseTheme.FormForeColor;
}
}
}

View file

@ -0,0 +1,79 @@
namespace FirstPlugin.MuuntEditor
{
partial class MuuntObjectList
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.stComboBox1 = new Toolbox.Library.Forms.STComboBox();
this.listViewCustom1 = new Toolbox.Library.Forms.ListViewCustom();
this.SuspendLayout();
//
// stComboBox1
//
this.stComboBox1.BorderColor = System.Drawing.Color.Empty;
this.stComboBox1.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.stComboBox1.ButtonColor = System.Drawing.Color.Empty;
this.stComboBox1.FormattingEnabled = true;
this.stComboBox1.IsReadOnly = false;
this.stComboBox1.Location = new System.Drawing.Point(12, 12);
this.stComboBox1.Name = "stComboBox1";
this.stComboBox1.Size = new System.Drawing.Size(257, 21);
this.stComboBox1.TabIndex = 0;
//
// 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.HideSelection = false;
this.listViewCustom1.Location = new System.Drawing.Point(12, 39);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(257, 265);
this.listViewCustom1.TabIndex = 1;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
//
// MuuntObjectList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(281, 316);
this.Controls.Add(this.listViewCustom1);
this.Controls.Add(this.stComboBox1);
this.Name = "MuuntObjectList";
this.Text = "MuuntObjectList";
this.ResumeLayout(false);
}
#endregion
private Toolbox.Library.Forms.STComboBox stComboBox1;
private Toolbox.Library.Forms.ListViewCustom listViewCustom1;
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FirstPlugin.MuuntEditor
{
public partial class MuuntObjectList : MuuntEditorDocker
{
private MuuntEditor ParentEditor;
public MuuntObjectList(MuuntEditor editor)
{
InitializeComponent();
ParentEditor = editor;
}
public void LoadObjects(List<ObjectGroup> groups)
{
for (int i = 0; i < groups.Count; i++)
{
stComboBox1.Items.Add(groups[i].Name);
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,46 @@
namespace FirstPlugin.MuuntEditor
{
partial class MuuntPropertiesEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// MuuntPropertiesEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(395, 314);
this.Name = "MuuntPropertiesEditor";
this.Text = "Properties Editor";
this.ResumeLayout(false);
}
#endregion
}
}

View file

@ -7,16 +7,17 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace FirstPlugin.Forms
namespace FirstPlugin.MuuntEditor
{
public partial class MuuntEditor : Form
public partial class MuuntPropertiesEditor : MuuntEditorDocker
{
public MuuntEditor()
private MuuntEditor ParentEditor;
public MuuntPropertiesEditor(MuuntEditor editor)
{
InitializeComponent();
ParentEditor = editor;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FirstPlugin.MuuntEditor
{
public class ObjectGroup
{
public ObjectGroup() { }
public ObjectGroup(string name) {
Name = name;
}
public ObjectGroup(string name, PropertyObject property) {
Name = name;
Objects.Add(property);
}
/// <summary>
/// Name of the group.
/// </summary>
public string Name { get; set; }
/// <summary>
/// List of properties in the group.
/// </summary>
public virtual List<PropertyObject> Objects { get; } = new List<PropertyObject>();
}
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FirstPlugin.Turbo.CourseMuuntStructs;
namespace FirstPlugin.MuuntEditor
{
public class PathDrawableContainer : ObjectGroup, IDrawableContainer
{
public PathDrawableContainer(string name) {
Name = name;
}
public List<BasePathGroup> PathGroups
{
get
{
var groups = new List<BasePathGroup>();
foreach (var group in Objects)
groups.Add((BasePathGroup)group);
return groups;
}
}
private IDrawableObject drawable;
public IDrawableObject Drawable
{
get
{
if (drawable == null)
drawable = new RenderablePath(PathGroups);
return drawable;
}
}
}
}

View file

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FirstPlugin.Turbo.CourseMuuntStructs;
using FirstPlugin.Turbo;
namespace FirstPlugin.MuuntEditor
{
public class TrackMuuntLoader : IMuuntLoader
{
public List<ObjectGroup> Groups { get; set; }
public bool Identify(dynamic byml, string fileName)
{
return fileName.Contains("_muunt");
}
public void Load(dynamic byml)
{
var courseMuunt = new CourseMuuntScene(byml);
Groups = new List<ObjectGroup>();
Groups.Add(new ObjectGroup("Scene Properties", new PropertyObject()
{
Name = "",
Prop = (Dictionary<string, dynamic>)byml,
}));
PathDrawableContainer lapPaths = new PathDrawableContainer("Lap Paths");
PathDrawableContainer enemyPaths = new PathDrawableContainer("Enemy Paths");
Groups.Add(lapPaths);
Groups.Add(enemyPaths);
for (int i = 0; i < courseMuunt.LapPaths.Count; i++)
{
courseMuunt.LapPaths[i].Name = $"Group [{i}]";
lapPaths.Objects.Add(courseMuunt.LapPaths[i]);
}
for (int i = 0; i < courseMuunt.EnemyPaths.Count; i++)
{
courseMuunt.EnemyPaths[i].Name = $"Group [{i}]";
enemyPaths.Objects.Add(courseMuunt.EnemyPaths[i]);
}
}
}
}

View file

@ -0,0 +1,268 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Collections;
using System.Linq;
namespace FirstPlugin.MuuntEditor
{
public class PropertyGridTypes
{
public static Dictionary<Type, Type> CustomClassConverter = new Dictionary<Type, Type>();
public static class GetTypeConv
{
public static TypeConverter Get(string _key, dynamic _obj)
{
if (_obj == null) return new NullConverter();
else if (CustomClassConverter.ContainsKey(_obj.GetType()))
return Activator.CreateInstance(CustomClassConverter[_obj.GetType()]);
else if (_obj is IDictionary<string, dynamic>)
{
if (_obj.Keys.Count == 3 && _obj.ContainsKey("X") && _obj.ContainsKey("Y") && _obj.ContainsKey("Z")) return new Vector3DDictionaryConverter();
return new DictionaryConverter();
}
else if (_obj is IList<dynamic>) return new ArrayNodeConverter();
else return TypeDescriptor.GetConverter(_obj);
}
}
public class NullConverter : System.ComponentModel.TypeConverter
{
public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType)
{
return false;
}
public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
return (string)value;
}
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
return "<Null>";
}
}
public class Vector3DDictionaryConverter : System.ComponentModel.TypeConverter
{
public override bool GetPropertiesSupported(ITypeDescriptorContext context) => true;
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
ArrayList properties = new ArrayList();
foreach (string e in ((Dictionary<string, dynamic>)value).Keys)
{
properties.Add(new DictionaryConverter.DictionaryPropertyDescriptor((Dictionary<string, dynamic>)value, e));
}
PropertyDescriptor[] props =
(PropertyDescriptor[])properties.ToArray(typeof(PropertyDescriptor));
return new PropertyDescriptorCollection(props);
}
public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType) => sourceType == typeof(string);
public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
string[] tokens = ((string)value).Split(';');
IDictionary<string, dynamic> dict = new Dictionary<string, dynamic>();
dict["X"] = Single.Parse(tokens[0]);
dict["Y"] = Single.Parse(tokens[1]);
dict["Z"] = Single.Parse(tokens[2]);
return dict;
}
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
var v = value as IDictionary<string, dynamic>;
if (v == null) //MultiMergeCollection workaround
{
var values = new float[3];
int count = 0;
foreach (object o in (ICollection)value)
values[count++] = ((KeyValuePair<string, dynamic>)o).Value;
return $"{Math.Round(values[0], 2)}; {Math.Round(values[1], 2)}; {Math.Round(values[2], 2)}";
}
return $"{Math.Round(v["X"], 2)}; {Math.Round(v["Y"], 2)}; {Math.Round(v["Z"], 2)}";
}
}
public class DictionaryConverter : System.ComponentModel.TypeConverter
{
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
return "<Dictionary node>";
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
ArrayList properties = new ArrayList();
foreach (string e in ((Dictionary<string, dynamic>)value).Keys)
{
properties.Add(new DictionaryPropertyDescriptor((Dictionary<string, dynamic>)value, e));
}
PropertyDescriptor[] props =
(PropertyDescriptor[])properties.ToArray(typeof(PropertyDescriptor));
return new PropertyDescriptorCollection(props);
}
public class DictionaryPropertyDescriptor : PropertyDescriptor //TODO Fix JIS encoding
{
IDictionary<string, dynamic> _dictionary;
string _key;
public override TypeConverter Converter
{
get
{
return GetTypeConv.Get(_key, _dictionary[_key]);
}
}
internal DictionaryPropertyDescriptor(IDictionary<string, dynamic> d, string key)
: base(key, null)
{
_dictionary = d;
_key = key;
}
public override Type PropertyType
{
get { return _dictionary[_key] == null ? typeof(string) : _dictionary[_key].GetType(); }
}
public override void SetValue(object component, object value)
{
_dictionary[_key] = value;
}
public override object GetValue(object component)
{
return _dictionary[_key];
}
public override bool IsReadOnly
{
get { return false; }
}
public override Type ComponentType
{
get { return null; }
}
public override bool CanResetValue(object component)
{
return false;
}
public override void ResetValue(object component)
{
}
public override bool ShouldSerializeValue(object component)
{
return false;
}
}
}
public class ArrayNodeConverter : System.ComponentModel.TypeConverter
{
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
return "<Array node>";
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
ArrayList properties = new ArrayList();
for (int i = 0; i < ((List<dynamic>)value).Count; i++)
{
properties.Add(new ArrayPropertyDescriptor(((List<dynamic>)value)[i], "Item " + i.ToString() + " :"));
}
PropertyDescriptor[] props =
(PropertyDescriptor[])properties.ToArray(typeof(PropertyDescriptor));
return new PropertyDescriptorCollection(props);
}
public class ArrayPropertyDescriptor : PropertyDescriptor //TODO Fix JIS encoding
{
dynamic _obj;
string _key;
public override TypeConverter Converter
{
get
{
return GetTypeConv.Get(_key, _obj);
}
}
internal ArrayPropertyDescriptor(dynamic obj, string key)
: base(key, null)
{
_obj = obj;
_key = key;
}
public override Type PropertyType
{
get { return _obj == null ? typeof(string) : _obj.GetType(); }
}
public override void SetValue(object component, object value)
{
_obj = value;
}
public override object GetValue(object component)
{
return _obj;
}
public override bool IsReadOnly
{
get { return false; }
}
public override Type ComponentType
{
get { return null; }
}
public override bool CanResetValue(object component)
{
return false;
}
public override void ResetValue(object component)
{
}
public override bool ShouldSerializeValue(object component)
{
return false;
}
}
}
}
}

View file

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace FirstPlugin.MuuntEditor
{
public class PropertyObject
{
/// <summary>
/// Child properties to be added to the tree.
/// </summary>
public virtual List<PropertyObject> SubObjects { get; } = new List<PropertyObject>();
/// <summary>
/// The name of the property
/// </summary>
public string Name { get; set; }
[TypeConverter(typeof(PropertyGridTypes.DictionaryConverter))]
public Dictionary<string, dynamic> Prop { get; set; }
}
}

View file

@ -0,0 +1,22 @@
using System.Collections.Generic;
using FirstPlugin.MuuntEditor;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class BasePathGroup : PropertyObject
{
public bool ConnectGroups = true;
public List<BasePathPoint> PathPoints = new List<BasePathPoint>();
public override List<PropertyObject> SubObjects
{
get {
var props = new List<PropertyObject>();
foreach (var path in PathPoints)
props.Add(path);
return props;
}
}
}
}

View file

@ -3,10 +3,12 @@ using System.Collections.Generic;
using System.ComponentModel;
using OpenTK;
using GL_EditorFramework.EditorDrawables;
using FirstPlugin.MuuntEditor;
using Toolbox.Library;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class BasePathPoint : IObject
public class BasePathPoint : PropertyObject, IObject, IPickable2DObject
{
public Action OnPathMoved;
@ -20,15 +22,51 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
}
}
public bool IsSelected { get; set; }
public bool IsHovered { get; set; }
public bool IsHit(float X, float Y)
{
return new STRectangle(Translate.X, Translate.Z, 40, 40).IsHit((int)X, (int)Y);
for (int i = 0; i <= 300; i++)
{
double angle = 2 * Math.PI * i / 300;
double x = Math.Cos(angle);
double y = Math.Sin(angle);
if (angle < 90)
{
}
if (angle < 90 && angle < 180)
{
}
if (angle < 270)
{
}
if (angle < 360)
{
}
}
return false;
}
public void PickTranslate(float X, float Y, float Z)
{
Translate = new Vector3(X, Y, Z);
}
public const string N_Translate = "Translate";
public const string N_Rotate = "Rotate";
public const string N_Scale = "Scale";
public const string N_Id = "UnitIdNum";
public const string N_ObjectID = "ObjId";
[Browsable(false)]
public Dictionary<string, dynamic> Prop { get; set; } = new Dictionary<string, dynamic>();
public dynamic this[string name]
{
get

View file

@ -27,9 +27,6 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
}
}
[Browsable(false)]
public Dictionary<string, dynamic> Prop { get; set; } = new Dictionary<string, dynamic>();
public int EnemyPathGroupId
{
get { return this[N_EnemyPathGroup] != null ? this[N_EnemyPathGroup] : -1; }

View file

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using FirstPlugin.Turbo.CourseMuuntStructs;
using Toolbox.Library;
namespace FirstPlugin.MuuntEditor
{
/// <summary>
/// Represets a path with multiple grouped points that connect to each other
/// </summary>
public class RenderablePath : IDrawableObject
{
public Color LineColor = Color.Green;
public List<BasePathGroup> PathGroups = new List<BasePathGroup>();
public RenderablePath(List<BasePathGroup> pathGroups)
{
PathGroups = pathGroups;
}
public void Draw(Matrix4 mvp)
{
for (int i = 0; i < PathGroups.Count; i++)
{
foreach (var path in PathGroups[i].PathPoints)
{
var translate = new Vector3(path.Translate.X, path.Translate.Z, path.Translate.Y);
if (path.IsSelected)
Render2D.DrawFilledCircle(new Vector2(translate.X, translate.Y), Color.Green, 30, 40, true);
else if (path.IsHovered)
Render2D.DrawFilledCircle(new Vector2(translate.X, translate.Y), Color.Yellow, 40, 40, true);
else
Render2D.DrawFilledCircle(new Vector2(translate.X, translate.Y), Color.Red, 30, 40, true);
GL.LineWidth(2f);
foreach (var nextPt in path.NextPoints)
{
var nextTranslate = PathGroups[nextPt.PathID].PathPoints[nextPt.PtID].Translate;
GL.Color3(LineColor);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(translate);
GL.Vertex3(nextTranslate.X, nextTranslate.Z, nextTranslate.Y);
GL.End();
}
foreach (var prevPt in path.PrevPoints)
{
var prevTranslate = PathGroups[prevPt.PathID].PathPoints[prevPt.PtID].Translate;
GL.Color3(LineColor);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(translate);
GL.Vertex3(prevTranslate.X, prevTranslate.Z, prevTranslate.Y);
GL.End();
}
}
}
}
}
}

View file

@ -1752,8 +1752,8 @@ namespace BarSlider
if (TextEditorActive)
return;
if (prevPos.X != 0 && prevPos.Y != 0)
Cursor.Position = prevPos;
// if (prevPos.X != 0 && prevPos.Y != 0)
// Cursor.Position = prevPos;
// Cursor.Show();
base.OnKeyUp(e);

View file

@ -57,6 +57,12 @@ namespace Toolbox.Library.Forms
InitializeComponent();
}
public void LoadEnum(Type type)
{
DataBindings.Clear();
DataSource = Enum.GetValues(type);
}
private bool IsTextReadOnly = true;
public void SetAsReadOnly()

View file

@ -19,6 +19,8 @@ namespace Toolbox.Library.Forms
public void LoadEditor(List<DrawableContainer> Drawables)
{
if (Drawables == null) return;
uvEditor1.Materials.Clear();
uvEditor1.Textures.Clear();
uvEditor1.Objects.Clear();

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toolbox.Library
{
public interface IPickable2DObject
{
bool IsHit(float X, float Y);
bool IsSelected { get; set; }
bool IsHovered { get; set; }
void PickTranslate(float X, float Y, float Z);
}
}

View file

@ -11,7 +11,7 @@ namespace Toolbox.Library
{
public class OpenGLHelper
{
public static Point convertScreenToWorldCoords(int x, int y)
public static Point convertScreenToWorldCoords(int x, int y, bool isTopDown = false)
{
int[] viewport = new int[4];
Matrix4 modelViewMatrix, projectionMatrix;
@ -21,11 +21,13 @@ namespace Toolbox.Library
Vector2 mouse;
mouse.X = x;
mouse.Y = y;
Vector4 vector = UnProject(ref projectionMatrix, modelViewMatrix, new Size(viewport[2], viewport[3]), mouse);
Vector4 vector = UnProject(ref projectionMatrix, modelViewMatrix, new Size(viewport[2], viewport[3]), mouse, isTopDown);
Point coords = new Point((int)vector.X, (int)vector.Y);
return coords;
}
public static Vector4 UnProject(ref Matrix4 projection, Matrix4 view, Size viewport, Vector2 mouse)
public static Vector4 UnProject(ref Matrix4 projection, Matrix4 view, Size viewport, Vector2 mouse, bool isTopDown)
{
Vector4 vec;
@ -34,6 +36,12 @@ namespace Toolbox.Library
vec.Z = 0;
vec.W = 1.0f;
if (isTopDown)
{
vec.Y = 0;
vec.Z = -(2.0f * mouse.Y / (float)viewport.Height - 1);
}
Matrix4 viewInv = Matrix4.Invert(view);
Matrix4 projInv = Matrix4.Invert(projection);

View file

@ -27,11 +27,34 @@ namespace Toolbox.Library
GL.PopMatrix();
}
public static void DrawCircle(Vector2 Position, Color color)
public static void DrawFilledCircle(Vector2 Position, Color color, float radius = 300, byte transparency = 255, bool outline = false)
{
GL.PushMatrix();
GL.Translate(Position.X, Position.Y, 0);
GL.Scale(300,300,1);
GL.Scale(radius, radius, 1);
GL.Color4(color.R, color.G, color.B, transparency);
GL.Begin(PrimitiveType.TriangleFan);
for (int i = 0; i <= 300; i++)
{
double angle = 2 * Math.PI * i / 300;
double x = Math.Cos(angle);
double y = Math.Sin(angle);
GL.Vertex2(x, y);
}
GL.End();
GL.PopMatrix();
if (outline)
DrawCircle(Position, color.Darken(20), radius);
}
public static void DrawCircle(Vector2 Position, Color color, float radius = 300)
{
GL.PushMatrix();
GL.Translate(Position.X, Position.Y, 0);
GL.Scale(radius, radius, 1);
GL.Color4(color);
GL.Begin(PrimitiveType.LineLoop);

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toolbox.Library
{
public class STRectangle
{
public int LeftPoint;
public int RightPoint;
public int TopPoint;
public int BottomPoint;
public STRectangle(float posX, float posY, float width, float height)
{
LeftPoint = (int)(posX - (width / 2));
RightPoint = (int)(posX + (width / 2));
TopPoint = (int)(posY + (height / 2));
BottomPoint = (int)(posY - (height / 2));
}
public STRectangle(int left, int right, int top, int bottom)
{
LeftPoint = left;
RightPoint = right;
TopPoint = top;
BottomPoint = bottom;
}
public bool IsHit(int X, int Y)
{
bool isInBetweenX = (X > LeftPoint) && (X < RightPoint) ||
(X < LeftPoint) && (X > RightPoint);
bool isInBetweenY = (Y > BottomPoint) && (Y < TopPoint) ||
(Y < BottomPoint) && (Y > TopPoint);
if (isInBetweenX && isInBetweenY)
return true;
else
return false;
}
}
}

View file

@ -15,7 +15,7 @@ namespace Toolbox.Library.Forms
{
public class Viewport2D : UserControl
{
public virtual bool UseOrtho { get; set; } = false;
public virtual bool UseOrtho { get; set; } = true;
public virtual bool UseGrid { get; set; } = true;
public Camera2D Camera = new Camera2D();
@ -40,6 +40,8 @@ namespace Toolbox.Library.Forms
private GLControl glControl1;
private Color BackgroundColor = Color.FromArgb(40, 40, 40);
private List<IPickable2DObject> SelectedObjects = new List<IPickable2DObject>();
public Viewport2D()
{
glControl1 = new GLControl();
@ -109,6 +111,22 @@ namespace Toolbox.Library.Forms
}
}
public virtual List<IPickable2DObject> GetPickableObjects()
{
return new List<IPickable2DObject>();
}
private List<IPickable2DObject> SearchHit(float X, float Y)
{
List<IPickable2DObject> picks = new List<IPickable2DObject>();
foreach (var pickObj in GetPickableObjects())
{
if (pickObj.IsHit(X, Y))
picks.Add(pickObj);
}
return picks;
}
private void SetupScene()
{
GL.Enable(EnableCap.Blend);
@ -125,6 +143,17 @@ namespace Toolbox.Library.Forms
RenderSceme();
if (showSelectionBox)
{
GL.Begin(PrimitiveType.LineLoop);
GL.Color4(Color.Red);
GL.Vertex2(SelectionBox.LeftPoint, SelectionBox.BottomPoint);
GL.Vertex2(SelectionBox.RightPoint, SelectionBox.BottomPoint);
GL.Vertex2(SelectionBox.RightPoint, SelectionBox.TopPoint);
GL.Vertex2(SelectionBox.LeftPoint, SelectionBox.TopPoint);
GL.End();
}
if (UseOrtho)
GL.PopMatrix();
@ -132,13 +161,54 @@ namespace Toolbox.Library.Forms
glControl1.SwapBuffers();
}
private STRectangle SelectionBox;
private bool showSelectionBox = false;
private void DrawSelectionBox(Point point1, Point point2)
{
SelectedObjects.Clear();
int left = point1.X;
int right = point2.X;
int top = point1.Y;
int bottom = point2.Y;
//Determine each point direction to see what is left/right/top/bottom
if (bottom > top)
{
top = point2.Y;
bottom = point1.Y;
}
if (left > right)
{
right = point1.X;
left = point2.X;
}
showSelectionBox = true;
SelectionBox = new STRectangle(left, right, top, bottom);
SetupScene();
}
public virtual void RenderSceme()
{
}
private Point pickOriginMouse;
private Point originMouse;
private bool mouseCameraDown;
private bool isPicked;
private bool mouseDown = false;
private Vector2 GetMouseCoords(Point screenMouse)
{
RenderEditor();
var coords = OpenGLHelper.convertScreenToWorldCoords(screenMouse.X, screenMouse.Y);
GL.PopMatrix();
return new Vector2(coords.X, coords.Y);
}
private void glControl1_MouseDown(object sender, MouseEventArgs e)
{
@ -149,6 +219,33 @@ namespace Toolbox.Library.Forms
mouseCameraDown = true;
glControl1.Invalidate();
}
else if (e.Button == MouseButtons.Left)
{
mouseDown = true;
var mouseCoords = GetMouseCoords(e.Location);
var picks = SearchHit(mouseCoords.X, mouseCoords.Y);
if (picks.Count > 0)
{
if (!SelectedObjects.Contains(picks[0]))
{
if (Control.ModifierKeys != Keys.Control)
UnselectAll();
SelectedObjects.Add(picks[0]);
picks[0].IsSelected = true;
}
isPicked = true;
}
else if (Control.ModifierKeys != Keys.Control)
UnselectAll();
pickOriginMouse = e.Location;
glControl1.Invalidate();
}
}
private void glControl1_MouseUp(object sender, MouseEventArgs e)
@ -156,21 +253,64 @@ namespace Toolbox.Library.Forms
if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Middle)
{
mouseCameraDown = false;
mouseDown = false;
isPicked = false;
showSelectionBox = false;
glControl1.Invalidate();
}
}
private void UnselectAll()
{
foreach (var pick in SelectedObjects)
pick.IsSelected = false;
SelectedObjects.Clear();
}
private void glControl1_MouseMove(object sender, MouseEventArgs e)
{
var mouseCoords = GetMouseCoords(e.Location);
var picks = SearchHit(mouseCoords.X, mouseCoords.Y);
if (picks.Count > 0)
{
if (!picks[0].IsSelected)
{
picks[0].IsHovered = true;
glControl1.Invalidate();
}
}
else
{
foreach (var obj in GetPickableObjects())
obj.IsHovered = false;
glControl1.Invalidate();
}
if (mouseCameraDown)
{
var pos = new Vector2(e.Location.X - originMouse.X, e.Location.Y - originMouse.Y);
Camera.Position.X += pos.X;
Camera.Position.Y += pos.Y;
Camera.Position.Y -= pos.Y;
originMouse = e.Location;
glControl1.Invalidate();
}
if (mouseDown && !isPicked)
{
RenderEditor();
var temp = e.Location;
var curPos = OpenGLHelper.convertScreenToWorldCoords(temp.X, temp.Y);
var prevPos = OpenGLHelper.convertScreenToWorldCoords(pickOriginMouse.X, pickOriginMouse.Y);
DrawSelectionBox(prevPos, curPos);
}
}
private void glControl1_Resize(object sender, EventArgs e)

View file

@ -393,7 +393,9 @@
<Compile Include="IO\Colors\STColor8.cs" />
<Compile Include="IO\SubStream.cs" />
<Compile Include="OpenGL\GLShaderGeneric.cs" />
<Compile Include="OpenGL\IPickableObject.cs" />
<Compile Include="OpenGL\Render2D.cs" />
<Compile Include="OpenGL\STRectangle.cs" />
<Compile Include="OpenGL\Viewport2D.cs">
<SubType>UserControl</SubType>
</Compile>

Binary file not shown.

Binary file not shown.