From 00ba993fa1a018399331d2d8c756c3e20e97d87c Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Sat, 5 Oct 2019 18:37:28 -0400 Subject: [PATCH] Add more layout editor features Add pane deleting via right clicking them. Added pane overlap select from right click (displays all panes at position of the mouse). Add option to hide and show all hidden panes from right click menu. --- BrawlboxHelper/BrawlHelper.cs | 6 +- BrawlboxHelper/BrawlboxHelper.dll | Bin 22016 -> 22016 bytes BrawlboxHelper/BrawlboxHelper.pdb | Bin 40448 -> 40448 bytes .../FileFormats/Layout/Common.cs | 29 +++++ File_Format_Library/GUI/BFLYT/LayoutEditor.cs | 5 + .../GUI/BFLYT/LayoutHierarchy.cs | 5 + .../GUI/BFLYT/LayoutUndoManager.cs | 52 ++++++++ .../GUI/BFLYT/LayoutViewer.Designer.cs | 8 ++ File_Format_Library/GUI/BFLYT/LayoutViewer.cs | 118 +++++++++++++++++- .../GUI/BFLYT/LayoutViewer.resx | 3 + 10 files changed, 222 insertions(+), 4 deletions(-) diff --git a/BrawlboxHelper/BrawlHelper.cs b/BrawlboxHelper/BrawlHelper.cs index 3da91c6a..17c8452a 100644 --- a/BrawlboxHelper/BrawlHelper.cs +++ b/BrawlboxHelper/BrawlHelper.cs @@ -36,6 +36,7 @@ namespace BrawlboxHelper { CLR0Node clr0 = NodeFactory.FromFile(null, FileName) as CLR0Node; + ResU.ShaderParamAnim fshu = new ResU.ShaderParamAnim(); fshu.FrameCount = clr0.FrameCount; fshu.Name = clr0.Name; @@ -48,7 +49,10 @@ namespace BrawlboxHelper //Set mat anims and then calculate data after foreach (var entry in clr0.Children) - fshu.ShaderParamMatAnims.Add(Clr0Entry2ShaderMatAnim(clr0, (CLR0MaterialNode)entry)); + { + if (entry is CLR0MaterialNode) + fshu.ShaderParamMatAnims.Add(Clr0Entry2ShaderMatAnim(clr0, (CLR0MaterialNode)entry)); + } fshu.BakedSize = CalculateBakeSize(fshu); fshu.BindIndices = SetIndices(fshu); diff --git a/BrawlboxHelper/BrawlboxH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xEV_k>>nmC_lY*z-}X47Zf;M^H|RA)O?f%$jrx@el0|q zel0?pl3I+dunM_*Y6)`HmByY}jdBN;VgWA4fhZTG2v-mnBfk-tTukXXO)iE@t)ak4 zTNO#F^~8s814?t+gkRuhyoPV!L)?OY;WiBA47Ou9?!HV`F+@`Aj8XB#4?RKh_mhdCOk|mx0r)7-?sBIio8R743FYzJdPJpc6bHf zCBBO%@Hae(e@WXqMZud}bp`|QEXLq_DAT5M*cIPLnRCmId)mq@$-2b&0eP7%eT-A_ zJeJwZ%kcv7i}(rhuCG2tmrRqS;&R(fC>!JzSzRPAZS4|Dw|yCTL9~{i#4E(7@N+zm z+$QU1eQuLAo09GD>ZHCTmRZwvZ0N!J7)Ij_dLc80f^0a!whhXP@^k$+gXP{SCmD+W0WZjgvEW@?tlXlghT^JoF%+kDmAp zdK)UhdhTQe>BeORdAw@4&lV5#HcEB$$ik4)sK-Yrrz9Ua#UQIB71xjS@bi+P+M&~O zoIU|6&R>?*)gMd_43Xj2p)yOxmAp_qsif277fMSQ=pNTd)JAEbmkfChy?0VzuvJot z$%*nw<`qswTU$!gJxjxkH1~6*g$~~XavAt6uBq!xk90qnde2~zkzOWq2BXYLHx}kjB$Qq2l^Y8K>z>% diff --git a/File_Format_Library/FileFormats/Layout/Common.cs b/File_Format_Library/FileFormats/Layout/Common.cs index 4f0f1b38..cd808202 100644 --- a/File_Format_Library/FileFormats/Layout/Common.cs +++ b/File_Format_Library/FileFormats/Layout/Common.cs @@ -1264,6 +1264,35 @@ namespace LayoutBXLYT if (!PaneLookup.ContainsKey(pane.Name)) PaneLookup.Add(pane.Name, pane); } + + + public void AddPane(BasePane pane, BasePane parent) + { + if (parent == null) return; + + if (!PaneLookup.ContainsKey(pane.Name)) + PaneLookup.Add(pane.Name, pane); + + parent.Childern.Add(pane); + parent.NodeWrapper.Nodes.Add(pane.NodeWrapper); + } + + public void RemovePanes(List panes) + { + for (int i = 0; i < panes.Count; i++) + { + if (PaneLookup.ContainsKey(panes[i].Name)) + PaneLookup.Remove(panes[i].Name); + + if (panes[i].Parent == null) + continue; + + var parent = panes[i].Parent; + parent.Childern.Remove(panes[i]); + + parent.NodeWrapper.Nodes.Remove(panes[i].NodeWrapper); + } + } } public class BxlytMaterial diff --git a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs index 3f21f00c..2e0d4bf4 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs @@ -440,6 +440,11 @@ namespace LayoutBXLYT dockContent.Show(dockPanel1, DockState.DockBottom); } + public void UpdateHiearchyTree() + { + LayoutHierarchy?.UpdateTree(); + } + private void OnAnimationPlaying(object sender, EventArgs e) { if (LayoutAnimEditor != null) diff --git a/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs b/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs index 3faf2dc9..0a540fd6 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs @@ -83,6 +83,11 @@ namespace LayoutBXLYT treeView1.Refresh(); } + public void UpdateTree() + { + treeView1.Refresh(); + } + public void Reset() { treeView1.Nodes.Clear(); diff --git a/File_Format_Library/GUI/BFLYT/LayoutUndoManager.cs b/File_Format_Library/GUI/BFLYT/LayoutUndoManager.cs index a76c22db..e0965d8e 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutUndoManager.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutUndoManager.cs @@ -38,6 +38,58 @@ namespace LayoutBXLYT IRevertAction Revert(); } + public class UndoActionPaneHide : IRevertAction + { + private bool hidePane = true; + public List targetPanes = new List(); + public UndoActionPaneHide(List panes, bool hide = true) + { + targetPanes = panes; + hidePane = hide; + + foreach (var pane in targetPanes) + pane.DisplayInEditor = !hidePane; + } + + public IRevertAction Revert() + { + foreach (var pane in targetPanes) + pane.DisplayInEditor = hidePane; + return this; + } + } + + public class UndoActionPaneDelete : IRevertAction + { + public BxlytHeader layoutFile; + public List targetPanes = new List(); + public UndoActionPaneDelete(List panes, BxlytHeader header) + { + layoutFile = header; + for (int i = 0; i < panes.Count; i++) + targetPanes.Add(new PaneInfo(panes[i])); + } + + public IRevertAction Revert() + { + for (int i = 0; i < targetPanes.Count; i++) + layoutFile.AddPane(targetPanes[i].Pane, targetPanes[i].Parent); + return this; + } + + public class PaneInfo + { + public BasePane Parent; + public BasePane Pane; + + public PaneInfo(BasePane pane) + { + Pane = pane; + Parent = pane.Parent; + } + } + } + public class UndoActionTransform : IRevertAction { public Vector3F Translate; diff --git a/File_Format_Library/GUI/BFLYT/LayoutViewer.Designer.cs b/File_Format_Library/GUI/BFLYT/LayoutViewer.Designer.cs index 43819ed5..ce012db0 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutViewer.Designer.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutViewer.Designer.cs @@ -28,7 +28,9 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.glControl1 = new OpenTK.GLControl(); + this.stContextMenuStrip1 = new Toolbox.Library.Forms.STContextMenuStrip(this.components); this.SuspendLayout(); // // glControl1 @@ -48,6 +50,11 @@ this.glControl1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.glControl1_MouseUp); this.glControl1.Resize += new System.EventHandler(this.glControl1_Resize); // + // stContextMenuStrip1 + // + this.stContextMenuStrip1.Name = "stContextMenuStrip1"; + this.stContextMenuStrip1.Size = new System.Drawing.Size(61, 4); + // // LayoutViewer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -62,5 +69,6 @@ #endregion private OpenTK.GLControl glControl1; + private Toolbox.Library.Forms.STContextMenuStrip stContextMenuStrip1; } } diff --git a/File_Format_Library/GUI/BFLYT/LayoutViewer.cs b/File_Format_Library/GUI/BFLYT/LayoutViewer.cs index 7d3820e8..b166ffe6 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutViewer.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutViewer.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using OpenTK.Graphics.OpenGL; using OpenTK; +using Toolbox.Library.Forms; using Toolbox.Library; using Toolbox.Library.Rendering; using Toolbox.Library.IO; @@ -716,19 +717,103 @@ namespace LayoutBXLYT ParentEditor.UpdateHiearchyNodeSelection(hitPane); isPicked = true; - } - else if (!hasEdgeHit) + } //Check edge hit and control key (multi selecting panes) + else if (!hasEdgeHit && Control.ModifierKeys != Keys.Control) SelectedPanes.Clear(); pickOriginMouse = e.Location; RenderScene(); } - + else if (e.Button == MouseButtons.Right) + { + RenderEditor(); + var coords = convertScreenToWorldCoords(e.Location.X, e.Location.Y); + + GL.PopMatrix(); + + //Add a content menu + var selectOverlapping = new STToolStripItem("Select Overlapping"); + var createPanes = new STToolStripItem("Create Pane"); + createPanes.DropDownItems.Add(new STToolStripItem("Null Pane")); + createPanes.DropDownItems.Add(new STToolStripItem("Picture Pane")); + createPanes.DropDownItems.Add(new STToolStripItem("Text Box Pane ")); + createPanes.DropDownItems.Add(new STToolStripItem("Window Pane")); + createPanes.DropDownItems.Add(new STToolStripItem("Boundry Pane")); + + var hitPanes = GetHitPanes(LayoutFile.RootPane, coords.X, coords.Y, new List()); + for (int i = 0; i < hitPanes.Count; i++) + selectOverlapping.DropDownItems.Add( + new STToolStripItem(hitPanes[i].Name, SelectOverlappingAction)); + + stContextMenuStrip1.Items.Clear(); + stContextMenuStrip1.Items.Add(createPanes); + stContextMenuStrip1.Items.Add(selectOverlapping); + + if (SelectedPanes.Count > 0) + { + stContextMenuStrip1.Items.Add(new STToolStripSeparator()); + stContextMenuStrip1.Items.Add(new STToolStripItem("Edit Group")); + stContextMenuStrip1.Items.Add(new STToolStripItem("Delete Selected Panes",DeletePaneAction )); + stContextMenuStrip1.Items.Add(new STToolStripItem("Hide Selected Panes", HidePaneAction)); + stContextMenuStrip1.Items.Add(new STToolStripItem("Show All Hidden Panes", ShowAllPaneAction)); + } + + stContextMenuStrip1.Show(Cursor.Position); + } Console.WriteLine("SelectedPanes " + SelectedPanes.Count); } + private void DeletePaneAction(object sender, EventArgs e) { + DeleteSelectedPanes(); + } + + private void HidePaneAction(object sender, EventArgs e) { + HideSelectedPanes(); + } + + private void ShowAllPaneAction(object sender, EventArgs e) { + ShowHiddenPanes(); + } + + private void HideSelectedPanes() + { + UndoManger.AddToUndo(new LayoutUndoManager.UndoActionPaneHide(SelectedPanes)); + ParentEditor?.UpdateHiearchyTree(); + glControl1.Invalidate(); + } + + private void ShowHiddenPanes() + { + UndoManger.AddToUndo(new LayoutUndoManager.UndoActionPaneHide(LayoutFile.PaneLookup.Values.ToList(), false)); + ParentEditor?.UpdateHiearchyTree(); + glControl1.Invalidate(); + } + + private void DeleteSelectedPanes() + { + UndoManger.AddToUndo(new LayoutUndoManager.UndoActionPaneDelete(SelectedPanes, LayoutFile)); + LayoutFile.RemovePanes(SelectedPanes); + ParentEditor?.UpdateHiearchyTree(); + glControl1.Invalidate(); + } + + private void SelectOverlappingAction(object sender, EventArgs e) + { + var toolMenu = sender as STToolStripItem; + if (toolMenu != null) + { + string name = toolMenu.Text; + SelectedPanes.Clear(); + + if (LayoutFile.PaneLookup.ContainsKey(name)) + SelectedPanes.Add(LayoutFile.PaneLookup[name]); + + glControl1.Invalidate(); + } + } + private void SearchHit(BasePane pane, int X, int Y, ref BasePane SelectedPane) { bool isVisible = pane.Visible; @@ -750,6 +835,29 @@ namespace LayoutBXLYT SearchHit(childPane, X, Y, ref SelectedPane); } + private List GetHitPanes(BasePane pane, int X, int Y, List SelectedPanes) + { + bool isVisible = pane.Visible; + if (!Runtime.LayoutEditor.DisplayPicturePane && pane is IPicturePane) + isVisible = false; + if (!Runtime.LayoutEditor.DisplayWindowPane && pane is IWindowPane) + isVisible = false; + if (!Runtime.LayoutEditor.DisplayBoundryPane && pane is IBoundryPane) + isVisible = false; + if (!Runtime.LayoutEditor.DisplayTextPane && pane is ITextPane) + isVisible = false; + if (!Runtime.LayoutEditor.DisplayNullPane && pane.IsNullPane) + isVisible = false; + + if (isVisible && pane.DisplayInEditor && pane.IsHit(X, Y) && pane.Name != "RootPane") + SelectedPanes.Add(pane); + + foreach (var childPane in pane.Childern) + SelectedPanes = GetHitPanes(childPane, X, Y, SelectedPanes); + + return SelectedPanes; + } + private PickAction SearchEdgePicking(BasePane pane, int X, int Y) { var transformed = pane.CreateRectangle().GetTransformedRectangle(pane.Parent, pane.Translate, pane.Scale); @@ -1023,6 +1131,10 @@ namespace LayoutBXLYT ParentEditor.UpdateUndo(); glControl1.Invalidate(); } + else if (e.KeyCode == Keys.Delete) + { + DeleteSelectedPanes(); + } } } } diff --git a/File_Format_Library/GUI/BFLYT/LayoutViewer.resx b/File_Format_Library/GUI/BFLYT/LayoutViewer.resx index 1af7de15..197ca22e 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutViewer.resx +++ b/File_Format_Library/GUI/BFLYT/LayoutViewer.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file