diff --git a/File_Format_Library/FileFormats/Layout/CAFE/BFLAN.cs b/File_Format_Library/FileFormats/Layout/CAFE/BFLAN.cs index b87623c3..8ff783ba 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/BFLAN.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/BFLAN.cs @@ -69,7 +69,7 @@ namespace LayoutBXLYT #endregion - Header header; + public Header header; public void Load(System.IO.Stream stream) { diff --git a/File_Format_Library/FileFormats/Layout/Common.cs b/File_Format_Library/FileFormats/Layout/Common.cs index 3005115a..16a50491 100644 --- a/File_Format_Library/FileFormats/Layout/Common.cs +++ b/File_Format_Library/FileFormats/Layout/Common.cs @@ -410,6 +410,38 @@ namespace LayoutBXLYT WhiteColorGreen, WhiteColorBlue, WhiteColorAlpha, + TextureColorBlendRatio, + TexColor0Red, + TexColor0Green, + TexColor0Blue, + TexColor0Alpha, + TexColor1Red, + TexColor1Green, + TexColor1Blue, + TexColor1Alpha, + TexColor2Red, + TexColor2Green, + TexColor2Blue, + TexColor2Alpha, + TevKonstantColor0Red, + TevKonstantColor0Green, + TevKonstantColor0Blue, + TevKonstantColor0Alpha, + TevKonstantColor1Red, + TevKonstantColor1Green, + TevKonstantColor1Blue, + TevKonstantColor1Alpha, + TevKonstantColor2Red, + TevKonstantColor2Green, + TevKonstantColor2Blue, + TevKonstantColor2Alpha, + } + + public enum LIMTarget : byte + { + Rotation, + ScaleU, + ScaleV, } public enum LFSTarget : byte diff --git a/File_Format_Library/GUI/BFLYT/LayoutEditor.Designer.cs b/File_Format_Library/GUI/BFLYT/LayoutEditor.Designer.cs index 1838a259..a252d8c4 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutEditor.Designer.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutEditor.Designer.cs @@ -47,6 +47,7 @@ this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.renderInGamePreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.displayGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.textureListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.textConverterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.orthographicViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -54,7 +55,6 @@ this.displayyBoundryPanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayWindowPanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayPicturePanesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.displayGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.backColorDisplay)).BeginInit(); this.stToolStrip1.SuspendLayout(); this.stMenuStrip1.SuspendLayout(); @@ -172,35 +172,35 @@ // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.openToolStripMenuItem.Text = "Open"; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // // clearWorkspaceToolStripMenuItem // this.clearWorkspaceToolStripMenuItem.Name = "clearWorkspaceToolStripMenuItem"; - this.clearWorkspaceToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.clearWorkspaceToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.clearWorkspaceToolStripMenuItem.Text = "Clear Files"; this.clearWorkspaceToolStripMenuItem.Click += new System.EventHandler(this.clearWorkspaceToolStripMenuItem_Click); // // saveToolStripMenuItem1 // this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1"; - this.saveToolStripMenuItem1.Size = new System.Drawing.Size(157, 22); + this.saveToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.saveToolStripMenuItem1.Text = "Save Layout"; this.saveToolStripMenuItem1.Click += new System.EventHandler(this.saveToolStripMenuItem1_Click); // // saveAnimationToolStripMenuItem // this.saveAnimationToolStripMenuItem.Name = "saveAnimationToolStripMenuItem"; - this.saveAnimationToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.saveAnimationToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.saveAnimationToolStripMenuItem.Text = "Save Animation"; this.saveAnimationToolStripMenuItem.Click += new System.EventHandler(this.saveAnimationToolStripMenuItem_Click); // // saveToolStripMenuItem // this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.saveToolStripMenuItem.Text = "Save As"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); // @@ -234,6 +234,14 @@ this.renderInGamePreviewToolStripMenuItem.Text = "Render In Game Preview"; this.renderInGamePreviewToolStripMenuItem.Click += new System.EventHandler(this.renderInGamePreviewToolStripMenuItem_Click); // + // displayGridToolStripMenuItem + // + this.displayGridToolStripMenuItem.CheckOnClick = true; + this.displayGridToolStripMenuItem.Name = "displayGridToolStripMenuItem"; + this.displayGridToolStripMenuItem.Size = new System.Drawing.Size(202, 22); + this.displayGridToolStripMenuItem.Text = "Display Grid"; + this.displayGridToolStripMenuItem.Click += new System.EventHandler(this.displayGridToolStripMenuItem_Click); + // // textureListToolStripMenuItem // this.textureListToolStripMenuItem.Name = "textureListToolStripMenuItem"; @@ -298,14 +306,6 @@ this.displayPicturePanesToolStripMenuItem.Text = "Display Picture Panes"; this.displayPicturePanesToolStripMenuItem.Click += new System.EventHandler(this.displayPanesToolStripMenuItem_Click); // - // displayGridToolStripMenuItem - // - this.displayGridToolStripMenuItem.CheckOnClick = true; - this.displayGridToolStripMenuItem.Name = "displayGridToolStripMenuItem"; - this.displayGridToolStripMenuItem.Size = new System.Drawing.Size(202, 22); - this.displayGridToolStripMenuItem.Text = "Display Grid"; - this.displayGridToolStripMenuItem.Click += new System.EventHandler(this.displayGridToolStripMenuItem_Click); - // // LayoutEditor // this.AllowDrop = true; diff --git a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs index 69490e08..d1fdb51c 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs @@ -80,6 +80,7 @@ namespace LayoutBXLYT private List Viewports = new List(); private LayoutViewer ActiveViewport; private LayoutHierarchy LayoutHierarchy; + private LayoutHierarchy AnimLayoutHierarchy; private LayoutTextureList LayoutTextureList; private LayoutProperties LayoutProperties; private LayoutTextDocked TextConverter; @@ -102,6 +103,8 @@ namespace LayoutBXLYT if (!isLoaded) InitializeDockPanels(); + AnimLayoutHierarchy?.SearchAnimations(header, ObjectSelected); + isLoaded = true; } @@ -112,12 +115,14 @@ namespace LayoutBXLYT ShowAnimationHierarchy(); ShowPropertiesPanel(); + AnimLayoutHierarchy.LoadAnimation(ActiveAnimation, ObjectSelected); isLoaded = true; } private void InitializeDockPanels(bool isAnimation = false) { + ShowAnimationHierarchy(); ShowTextureList(); ShowPartsEditor(); ShowPaneHierarchy(); @@ -231,6 +236,9 @@ namespace LayoutBXLYT private void ShowPartsEditor() { + if (LayoutPartsEditor != null) + return; + LayoutPartsEditor = new LayoutPartsEditor(); LayoutPartsEditor.Text = "Parts Editor"; LayoutPartsEditor.Show(dockPanel1, DockState.DockLeft); @@ -238,6 +246,9 @@ namespace LayoutBXLYT private void ShowPropertiesPanel() { + if (LayoutProperties != null) + return; + LayoutProperties = new LayoutProperties(); LayoutProperties.Text = "Properties"; if (LayoutHierarchy != null) @@ -248,15 +259,20 @@ namespace LayoutBXLYT public void ShowAnimationHierarchy() { - LayoutHierarchy = new LayoutHierarchy(); - LayoutHierarchy.Text = "Animation Hierarchy"; - LayoutHierarchy.LoadAnimation(ActiveAnimation, ObjectSelected); - LayoutHierarchy.Show(dockPanel1, DockState.DockLeft); + if (AnimLayoutHierarchy != null) + return; + + AnimLayoutHierarchy = new LayoutHierarchy(this); + AnimLayoutHierarchy.Text = "Animation Hierarchy"; + AnimLayoutHierarchy.Show(dockPanel1, DockState.DockLeft); } private void ShowPaneHierarchy() { - LayoutHierarchy = new LayoutHierarchy(); + if (LayoutHierarchy != null) + return; + + LayoutHierarchy = new LayoutHierarchy(this); LayoutHierarchy.Text = "Hierarchy"; LayoutHierarchy.LoadLayout(ActiveLayout, ObjectSelected); LayoutHierarchy.Show(dockPanel1, DockState.DockLeft); @@ -264,6 +280,9 @@ namespace LayoutBXLYT private void ShowTextureList() { + if (LayoutTextureList != null) + return; + LayoutTextureList = new LayoutTextureList(); LayoutTextureList.Text = "Texture List"; LayoutTextureList.LoadTextures(ActiveLayout); diff --git a/File_Format_Library/GUI/BFLYT/LayoutHierarchy.Designer.cs b/File_Format_Library/GUI/BFLYT/LayoutHierarchy.Designer.cs index 8c665fc1..5c54acf2 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutHierarchy.Designer.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutHierarchy.Designer.cs @@ -40,6 +40,7 @@ this.treeView1.Size = new System.Drawing.Size(301, 333); this.treeView1.TabIndex = 0; this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck); + this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeExpand); 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_KeyDown); diff --git a/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs b/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs index 07dd875b..c757d584 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using FirstPlugin; +using Toolbox.Library; using Toolbox.Library.Forms; using LayoutBXLYT.Cafe; @@ -15,10 +15,13 @@ namespace LayoutBXLYT { public partial class LayoutHierarchy : LayoutDocked { + private LayoutEditor ParentEditor; private STContextMenuStrip ContexMenu; - public LayoutHierarchy() + public LayoutHierarchy(LayoutEditor layoutEditor) { + ParentEditor = layoutEditor; + InitializeComponent(); treeView1.BackColor = FormThemes.BaseTheme.FormBackColor; @@ -74,13 +77,42 @@ namespace LayoutBXLYT isLoaded = true; } + public void SearchAnimations(BxlytHeader bxlyt, EventHandler onPropertySelected) + { + OnProperySelected = onPropertySelected; + + isLoaded = false; + + var layoutFile = bxlyt.FileInfo; + var parentArchive = layoutFile.IFileInfo.ArchiveParent; + if (parentArchive == null) return; + + treeView1.BeginUpdate(); + foreach (var file in parentArchive.Files) + { + if (Utils.GetExtension(file.FileName) == ".bflan") { + LoadAnimation(file); + } + } + + treeView1.EndUpdate(); + + isLoaded = true; + } + + public void LoadAnimation(ArchiveFileInfo archiveEntry) + { + var animNode = new TreeNode(System.IO.Path.GetFileName(archiveEntry.FileName)) { Tag = archiveEntry }; + animNode.Nodes.Add(""); + treeView1.Nodes.Add(animNode); + } + public void LoadAnimation(BxlanHeader bxlan, EventHandler onPropertySelected) { isLoaded = false; OnProperySelected = onPropertySelected; treeView1.BeginUpdate(); - treeView1.Nodes.Clear(); LoadAnimations(bxlan,new TreeNode(bxlan.FileName) { Tag = bxlan }); treeView1.EndUpdate(); isLoaded = true; @@ -92,9 +124,11 @@ namespace LayoutBXLYT isLoaded = false; } - private void LoadAnimations(BxlanHeader bxlan, TreeNode root) + private void LoadAnimations(BxlanHeader bxlan, TreeNode root, bool LoadRoot = true) { - treeView1.Nodes.Add(root); + if (LoadRoot) + treeView1.Nodes.Add(root); + if (bxlan is BxlanHeader) { var header = bxlan as BxlanHeader; @@ -379,5 +413,26 @@ namespace LayoutBXLYT } } } + + private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e) + { + //Create and expand a file format, then update the tag + //Allows for faster loading + if (e.Node.Tag is ArchiveFileInfo) + { + e.Node.Nodes.Clear(); + + var archiveNode = e.Node.Tag as ArchiveFileInfo; + var fileFormat = archiveNode.OpenFile(); + + //Update the tag so this doesn't run again + e.Node.Tag = "Expanded"; + + if (fileFormat != null && fileFormat is BFLAN) { + LoadAnimations(((BFLAN)fileFormat).header, e.Node, false); + ParentEditor.AnimationFiles.Add(((BFLAN)fileFormat).header); + } + } + } } } diff --git a/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.Designer.cs b/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.Designer.cs index fc6b8405..c133bfd7 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.Designer.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.Designer.cs @@ -1,4 +1,4 @@ -namespace FirstPlugin.Forms +namespace LayoutBXLYT { partial class LayoutSaveDialog { @@ -28,16 +28,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Animations"); - System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Layouts"); - System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Textures"); - System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("Fonts"); - System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("Shaders"); this.stButton1 = new Toolbox.Library.Forms.STButton(); this.treeView1 = new System.Windows.Forms.TreeView(); - this.radioButton1 = new System.Windows.Forms.RadioButton(); - this.radioButton2 = new System.Windows.Forms.RadioButton(); - this.radioButton3 = new System.Windows.Forms.RadioButton(); + this.saveArchiveRadioBtn = new System.Windows.Forms.RadioButton(); + this.saveNewArchiveRadioBtn = new System.Windows.Forms.RadioButton(); + this.saveFolderRadioBtn = new System.Windows.Forms.RadioButton(); this.radioButton4 = new System.Windows.Forms.RadioButton(); this.radioButton5 = new System.Windows.Forms.RadioButton(); this.radioButton6 = new System.Windows.Forms.RadioButton(); @@ -49,17 +44,17 @@ this.contentContainer.Controls.Add(this.radioButton6); this.contentContainer.Controls.Add(this.radioButton5); this.contentContainer.Controls.Add(this.radioButton4); - this.contentContainer.Controls.Add(this.radioButton3); - this.contentContainer.Controls.Add(this.radioButton2); - this.contentContainer.Controls.Add(this.radioButton1); + this.contentContainer.Controls.Add(this.saveFolderRadioBtn); + this.contentContainer.Controls.Add(this.saveNewArchiveRadioBtn); + this.contentContainer.Controls.Add(this.saveArchiveRadioBtn); this.contentContainer.Controls.Add(this.treeView1); this.contentContainer.Controls.Add(this.stButton1); - this.contentContainer.Size = new System.Drawing.Size(389, 337); + this.contentContainer.Size = new System.Drawing.Size(495, 427); this.contentContainer.Controls.SetChildIndex(this.stButton1, 0); this.contentContainer.Controls.SetChildIndex(this.treeView1, 0); - this.contentContainer.Controls.SetChildIndex(this.radioButton1, 0); - this.contentContainer.Controls.SetChildIndex(this.radioButton2, 0); - this.contentContainer.Controls.SetChildIndex(this.radioButton3, 0); + this.contentContainer.Controls.SetChildIndex(this.saveArchiveRadioBtn, 0); + this.contentContainer.Controls.SetChildIndex(this.saveNewArchiveRadioBtn, 0); + this.contentContainer.Controls.SetChildIndex(this.saveFolderRadioBtn, 0); this.contentContainer.Controls.SetChildIndex(this.radioButton4, 0); this.contentContainer.Controls.SetChildIndex(this.radioButton5, 0); this.contentContainer.Controls.SetChildIndex(this.radioButton6, 0); @@ -68,7 +63,7 @@ // this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.stButton1.Location = new System.Drawing.Point(305, 305); + this.stButton1.Location = new System.Drawing.Point(411, 395); this.stButton1.Name = "stButton1"; this.stButton1.Size = new System.Drawing.Size(75, 23); this.stButton1.TabIndex = 0; @@ -77,86 +72,82 @@ // // treeView1 // + this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.treeView1.CheckBoxes = true; this.treeView1.Location = new System.Drawing.Point(3, 31); this.treeView1.Name = "treeView1"; - treeNode1.Name = "Node5"; - treeNode1.Text = "Animations"; - treeNode2.Name = "Node6"; - treeNode2.Text = "Layouts"; - treeNode3.Name = "Node7"; - treeNode3.Text = "Textures"; - treeNode4.Name = "Node8"; - treeNode4.Text = "Fonts"; - treeNode5.Name = "Node9"; - treeNode5.Text = "Shaders"; - this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode1, - treeNode2, - treeNode3, - treeNode4, - treeNode5}); - this.treeView1.Size = new System.Drawing.Size(248, 271); + this.treeView1.Size = new System.Drawing.Size(354, 361); this.treeView1.TabIndex = 1; // - // radioButton1 + // saveArchiveRadioBtn // - this.radioButton1.AutoSize = true; - this.radioButton1.Location = new System.Drawing.Point(257, 37); - this.radioButton1.Name = "radioButton1"; - this.radioButton1.Size = new System.Drawing.Size(105, 17); - this.radioButton1.TabIndex = 2; - this.radioButton1.TabStop = true; - this.radioButton1.Text = "Save To Archive"; - this.radioButton1.UseVisualStyleBackColor = true; + this.saveArchiveRadioBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.saveArchiveRadioBtn.AutoSize = true; + this.saveArchiveRadioBtn.Checked = true; + this.saveArchiveRadioBtn.Location = new System.Drawing.Point(363, 37); + this.saveArchiveRadioBtn.Name = "saveArchiveRadioBtn"; + this.saveArchiveRadioBtn.Size = new System.Drawing.Size(105, 17); + this.saveArchiveRadioBtn.TabIndex = 2; + this.saveArchiveRadioBtn.TabStop = true; + this.saveArchiveRadioBtn.Text = "Save To Archive"; + this.saveArchiveRadioBtn.UseVisualStyleBackColor = true; // - // radioButton2 + // saveNewArchiveRadioBtn // - this.radioButton2.AutoSize = true; - this.radioButton2.Location = new System.Drawing.Point(257, 60); - this.radioButton2.Name = "radioButton2"; - this.radioButton2.Size = new System.Drawing.Size(129, 17); - this.radioButton2.TabIndex = 3; - this.radioButton2.TabStop = true; - this.radioButton2.Text = "Save As New Archive"; - this.radioButton2.UseVisualStyleBackColor = true; + this.saveNewArchiveRadioBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.saveNewArchiveRadioBtn.AutoSize = true; + this.saveNewArchiveRadioBtn.Location = new System.Drawing.Point(363, 60); + this.saveNewArchiveRadioBtn.Name = "saveNewArchiveRadioBtn"; + this.saveNewArchiveRadioBtn.Size = new System.Drawing.Size(129, 17); + this.saveNewArchiveRadioBtn.TabIndex = 3; + this.saveNewArchiveRadioBtn.Text = "Save As New Archive"; + this.saveNewArchiveRadioBtn.UseVisualStyleBackColor = true; // - // radioButton3 + // saveFolderRadioBtn // - this.radioButton3.AutoSize = true; - this.radioButton3.Location = new System.Drawing.Point(257, 83); - this.radioButton3.Name = "radioButton3"; - this.radioButton3.Size = new System.Drawing.Size(119, 17); - this.radioButton3.TabIndex = 4; - this.radioButton3.TabStop = true; - this.radioButton3.Text = "Save To File/Folder"; - this.radioButton3.UseVisualStyleBackColor = true; + this.saveFolderRadioBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.saveFolderRadioBtn.AutoSize = true; + this.saveFolderRadioBtn.Location = new System.Drawing.Point(363, 83); + this.saveFolderRadioBtn.Name = "saveFolderRadioBtn"; + this.saveFolderRadioBtn.Size = new System.Drawing.Size(119, 17); + this.saveFolderRadioBtn.TabIndex = 4; + this.saveFolderRadioBtn.Text = "Save To File/Folder"; + this.saveFolderRadioBtn.UseVisualStyleBackColor = true; // // radioButton4 // + this.radioButton4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.radioButton4.AutoSize = true; - this.radioButton4.Location = new System.Drawing.Point(257, 203); + this.radioButton4.Enabled = false; + this.radioButton4.Location = new System.Drawing.Point(363, 203); this.radioButton4.Name = "radioButton4"; this.radioButton4.Size = new System.Drawing.Size(90, 17); this.radioButton4.TabIndex = 5; - this.radioButton4.TabStop = true; this.radioButton4.Text = "Save As XML"; this.radioButton4.UseVisualStyleBackColor = true; // // radioButton5 // + this.radioButton5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.radioButton5.AutoSize = true; - this.radioButton5.Location = new System.Drawing.Point(257, 226); + this.radioButton5.Enabled = false; + this.radioButton5.Location = new System.Drawing.Point(363, 226); this.radioButton5.Name = "radioButton5"; this.radioButton5.Size = new System.Drawing.Size(97, 17); this.radioButton5.TabIndex = 6; - this.radioButton5.TabStop = true; this.radioButton5.Text = "Save As YAML"; this.radioButton5.UseVisualStyleBackColor = true; // // radioButton6 // + this.radioButton6.AllowDrop = true; + this.radioButton6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.radioButton6.AutoCheck = false; this.radioButton6.AutoSize = true; - this.radioButton6.Location = new System.Drawing.Point(257, 180); + this.radioButton6.Checked = true; + this.radioButton6.Location = new System.Drawing.Point(363, 180); this.radioButton6.Name = "radioButton6"; this.radioButton6.Size = new System.Drawing.Size(97, 17); this.radioButton6.TabIndex = 11; @@ -168,7 +159,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(395, 342); + this.ClientSize = new System.Drawing.Size(501, 432); this.Name = "LayoutSaveDialog"; this.Text = "Layout Save Dialog"; this.contentContainer.ResumeLayout(false); @@ -181,9 +172,9 @@ private Toolbox.Library.Forms.STButton stButton1; private System.Windows.Forms.TreeView treeView1; - private System.Windows.Forms.RadioButton radioButton1; - private System.Windows.Forms.RadioButton radioButton2; - private System.Windows.Forms.RadioButton radioButton3; + private System.Windows.Forms.RadioButton saveArchiveRadioBtn; + private System.Windows.Forms.RadioButton saveNewArchiveRadioBtn; + private System.Windows.Forms.RadioButton saveFolderRadioBtn; private System.Windows.Forms.RadioButton radioButton4; private System.Windows.Forms.RadioButton radioButton5; private System.Windows.Forms.RadioButton radioButton6; diff --git a/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.cs b/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.cs index bd79e108..883257f1 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutSaveDialog.cs @@ -8,14 +8,90 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Toolbox.Library.Forms; +using Toolbox.Library; -namespace FirstPlugin.Forms +namespace LayoutBXLYT { public partial class LayoutSaveDialog : STForm { + private TreeNode AnimationFolder = new TreeNode("Animations"); + private TreeNode LayoutFolder = new TreeNode("Layouts"); + private TreeNode ShaderFolder = new TreeNode("Shaders"); + private TreeNode TexturesFolder = new TreeNode("Textures"); + public LayoutSaveDialog() { InitializeComponent(); + + treeView1.BackColor = FormThemes.BaseTheme.FormBackColor; + treeView1.ForeColor = FormThemes.BaseTheme.FormForeColor; + } + + public void LoadAnimations(List animationHeaders) + { + + } + + public void LoadArchive(IArchiveFile archiveFile, string fileName) + { + TreeNode currentNode = new TreeNode(); + TreeNode root = new TreeNode(fileName); + treeView1.Nodes.Add(root); + foreach (var file in archiveFile.Files) + { + currentNode = null; + + string nodeString = file.FileName; + + var roots = nodeString.Split(new char[] { '/' }, + StringSplitOptions.RemoveEmptyEntries); + + var parentNode = root; + var sb = new System.Text.StringBuilder(fileName, nodeString.Length + fileName.Length); + for (int rootIndex = 0; rootIndex < roots.Length; rootIndex++) + { + // Build the node name + var parentName = roots[rootIndex]; + sb.Append("/"); + sb.Append(parentName); + var nodeName = sb.ToString(); + + // Search for the node + var index = parentNode.Nodes.IndexOfKey(nodeName); + if (index == -1) + { + var folder = new TreeNode(parentName) + { Name = nodeName,Checked = true, }; + + if (rootIndex == roots.Length - 1) + { + var fileNode = new TreeNode(parentName) + { Name = nodeName, Checked = true, }; + + parentNode.Nodes.Add(fileNode); + parentNode = fileNode; + } + else + { + parentNode.Nodes.Add(folder); + parentNode = folder; + } + } + else + parentNode = parentNode.Nodes[index]; + } + } + + + root.ExpandAll(); + } + + public void LoadLayouts(List layoutHeaders) + { + for (int i = 0; i < layoutHeaders.Count; i++) + { + AnimationFolder.Nodes.Add(new TreeNode(layoutHeaders[i].FileName)); + } } } } diff --git a/File_Format_Library/Main.cs b/File_Format_Library/Main.cs index e04eaa0a..de86ed9e 100644 --- a/File_Format_Library/Main.cs +++ b/File_Format_Library/Main.cs @@ -295,6 +295,7 @@ namespace FirstPlugin { List Formats = new List(); Formats.Add(typeof(BFRES)); + Formats.Add(typeof(TVOL)); Formats.Add(typeof(BTI)); Formats.Add(typeof(TXE)); Formats.Add(typeof(SARC)); @@ -387,7 +388,6 @@ namespace FirstPlugin Formats.Add(typeof(BCLIM)); Formats.Add(typeof(DAT_Bayonetta)); Formats.Add(typeof(XCI)); - Formats.Add(typeof(TVOL)); Formats.Add(typeof(VIBS)); // Formats.Add(typeof(MSBP));