Switch-Toolbox/File_Format_Library/GUI/BFLYT/LayoutHierarchy.cs

443 lines
16 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
2019-09-23 22:16:50 +00:00
using Toolbox.Library;
using Toolbox.Library.Forms;
using LayoutBXLYT.Cafe;
namespace LayoutBXLYT
{
2019-08-29 23:01:47 +00:00
public partial class LayoutHierarchy : LayoutDocked
{
2019-09-23 22:16:50 +00:00
private LayoutEditor ParentEditor;
2019-09-05 20:24:03 +00:00
private STContextMenuStrip ContexMenu;
2019-09-23 22:16:50 +00:00
public LayoutHierarchy(LayoutEditor layoutEditor)
{
2019-09-23 22:16:50 +00:00
ParentEditor = layoutEditor;
InitializeComponent();
treeView1.BackColor = FormThemes.BaseTheme.FormBackColor;
treeView1.ForeColor = FormThemes.BaseTheme.FormForeColor;
var imgList = new ImageList();
2019-09-05 20:24:03 +00:00
imgList.ColorDepth = ColorDepth.Depth32Bit;
imgList.Images.Add("folder", Toolbox.Library.Properties.Resources.Folder);
imgList.Images.Add("AlignmentPane", FirstPlugin.Properties.Resources.AlignmentPane);
imgList.Images.Add("WindowPane", FirstPlugin.Properties.Resources.WindowPane);
imgList.Images.Add("ScissorPane", FirstPlugin.Properties.Resources.ScissorPane);
imgList.Images.Add("BoundryPane", FirstPlugin.Properties.Resources.BoundryPane);
imgList.Images.Add("NullPane", FirstPlugin.Properties.Resources.NullPane);
imgList.Images.Add("PicturePane", FirstPlugin.Properties.Resources.PicturePane);
imgList.Images.Add("QuickAcess", FirstPlugin.Properties.Resources.QuickAccess);
imgList.Images.Add("TextPane", FirstPlugin.Properties.Resources.TextPane);
2019-09-05 20:24:03 +00:00
imgList.Images.Add("material", Toolbox.Library.Properties.Resources.materialSphere);
imgList.Images.Add("texture", Toolbox.Library.Properties.Resources.Texture);
imgList.Images.Add("font", Toolbox.Library.Properties.Resources.Font);
imgList.ImageSize = new Size(22,22);
treeView1.ImageList = imgList;
2019-09-05 20:24:03 +00:00
BackColor = FormThemes.BaseTheme.FormBackColor;
ForeColor = FormThemes.BaseTheme.FormForeColor;
ContexMenu = new STContextMenuStrip();
}
private bool isLoaded = false;
private EventHandler OnProperySelected;
private BxlytHeader ActiveLayout;
public void LoadLayout(BxlytHeader bxlyt, EventHandler onPropertySelected)
{
isLoaded = false;
OnProperySelected = onPropertySelected;
ActiveLayout = bxlyt;
treeView1.BeginUpdate();
treeView1.Nodes.Clear();
CreateQuickAccess(bxlyt);
2019-09-05 20:24:03 +00:00
treeView1.Nodes.Add(new TreeNode("File Settings") {Tag = bxlyt });
LoadTextures(bxlyt.Textures);
LoadFonts(bxlyt.Fonts);
LoadMaterials(bxlyt.GetMaterials());
LoadPane(bxlyt.RootGroup);
LoadPane(bxlyt.RootPane);
treeView1.EndUpdate();
isLoaded = true;
}
public void SelectNode(TreeNode node)
2019-09-23 22:16:50 +00:00
{
treeView1.SelectedNode = node;
treeView1.Refresh();
}
public void UpdateTree()
{
treeView1.Refresh();
}
2019-08-29 23:01:47 +00:00
public void Reset()
{
treeView1.Nodes.Clear();
isLoaded = false;
}
2019-09-05 20:24:03 +00:00
private void LoadTextures(List<string> textures)
{
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
ActiveLayout.TextureFolder = new TreeNode("Textures");
treeView1.Nodes.Add(ActiveLayout.TextureFolder);
2019-09-05 20:24:03 +00:00
for (int i = 0; i < textures.Count; i++)
{
TreeNode matNode = new TreeNode(textures[i]);
matNode.Tag = i;
matNode.ContextMenuStrip = new ContextMenuStrip();
var menu = new STToolStipMenuItem("Rename");
menu.Click += RenameTextureAction;
matNode.ContextMenuStrip.Items.Add(menu);
2019-09-05 20:24:03 +00:00
matNode.ImageKey = "texture";
matNode.SelectedImageKey = "texture";
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
ActiveLayout.TextureFolder.Nodes.Add(matNode);
2019-09-05 20:24:03 +00:00
}
}
private void RenameTextureAction(object sender, EventArgs e)
{
var selectedNode = treeView1.SelectedNode;
if (selectedNode == null) return;
int index = (int)selectedNode.Tag;
string activeTex = ActiveLayout.Textures[index];
RenameDialog dlg = new RenameDialog();
dlg.SetString(activeTex);
if (dlg.ShowDialog() == DialogResult.OK)
{
ActiveLayout.Textures[index] = dlg.textBox1.Text;
selectedNode.Text = dlg.textBox1.Text;
}
}
2019-09-05 20:24:03 +00:00
private void LoadFonts(List<string> fonts)
{
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
ActiveLayout.FontFolder = new TreeNode("Fonts");
treeView1.Nodes.Add(ActiveLayout.FontFolder);
2019-09-05 20:24:03 +00:00
for (int i = 0; i < fonts.Count; i++)
{
TreeNode matNode = new TreeNode(fonts[i]);
matNode.ImageKey = "font";
matNode.SelectedImageKey = "font";
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
ActiveLayout.FontFolder.Nodes.Add(matNode);
2019-09-05 20:24:03 +00:00
}
}
private void LoadMaterials(List<BxlytMaterial> materials)
{
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
ActiveLayout.MaterialFolder = new TreeNode("Materials");
treeView1.Nodes.Add(ActiveLayout.MaterialFolder);
2019-09-05 20:24:03 +00:00
for (int i = 0; i < materials.Count; i++)
{
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
MatWrapper matNode = new MatWrapper(materials[i].Name);
materials[i].NodeWrapper = matNode;
2019-09-05 20:24:03 +00:00
matNode.Tag = materials[i];
matNode.ImageKey = "material";
matNode.SelectedImageKey = "material";
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
ActiveLayout.MaterialFolder.Nodes.Add(matNode);
2019-09-05 20:24:03 +00:00
}
}
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
private void CreateQuickAccess(BxlytHeader bxlyt)
{
var panes = new List<BasePane>();
var groupPanes = new List<BasePane>();
GetPanes(bxlyt.RootPane,ref panes);
GetGroupPanes(bxlyt.RootGroup,ref groupPanes);
TreeNode node = new TreeNode("Quick Access");
node.ImageKey = "QuickAcess";
node.SelectedImageKey = "QuickAcess";
treeView1.Nodes.Add(node);
TreeNode nullFolder = new TreeNode("Null Panes");
TreeNode textFolder = new TreeNode("Text Boxes");
TreeNode windowFolder = new TreeNode("Window Panes");
TreeNode pictureFolder = new TreeNode("Picture Panes");
TreeNode boundryFolder = new TreeNode("Boundry Panes");
TreeNode partsFolder = new TreeNode("Part Panes");
TreeNode groupFolder = new TreeNode("Groups");
node.Nodes.Add(nullFolder);
node.Nodes.Add(textFolder);
node.Nodes.Add(windowFolder);
node.Nodes.Add(pictureFolder);
node.Nodes.Add(boundryFolder);
node.Nodes.Add(partsFolder);
node.Nodes.Add(groupFolder);
for (int i = 0; i < panes.Count; i++)
{
var paneNode = CreatePaneWrapper(panes[i]);
if (panes[i] is BFLYT.WND1) windowFolder.Nodes.Add(paneNode);
else if (panes[i] is BCLYT.WND1) windowFolder.Nodes.Add(paneNode);
else if (panes[i] is BRLYT.WND1) windowFolder.Nodes.Add(paneNode);
else if (panes[i] is BFLYT.PIC1) pictureFolder.Nodes.Add(paneNode);
else if (panes[i] is BCLYT.PIC1) pictureFolder.Nodes.Add(paneNode);
else if (panes[i] is BRLYT.PIC1) pictureFolder.Nodes.Add(paneNode);
else if (panes[i] is BFLYT.BND1) boundryFolder.Nodes.Add(paneNode);
else if (panes[i] is BCLYT.BND1) boundryFolder.Nodes.Add(paneNode);
else if (panes[i] is BRLYT.BND1) boundryFolder.Nodes.Add(paneNode);
else if (panes[i] is BCLYT.PRT1) partsFolder.Nodes.Add(paneNode);
else if (panes[i] is BFLYT.PRT1) partsFolder.Nodes.Add(paneNode);
else if (panes[i] is BRLYT.PRT1) partsFolder.Nodes.Add(paneNode);
else if (panes[i] is BRLYT.TXT1) textFolder.Nodes.Add(paneNode);
else if (panes[i] is BCLYT.TXT1) textFolder.Nodes.Add(paneNode);
else if (panes[i] is BFLYT.TXT1) textFolder.Nodes.Add(paneNode);
else nullFolder.Nodes.Add(paneNode);
}
for (int i = 0; i < groupPanes.Count; i++)
{
var paneNode = CreatePaneWrapper(groupPanes[i]);
groupFolder.Nodes.Add(paneNode);
}
}
private void GetPanes(BasePane pane, ref List<BasePane> panes)
{
panes.Add(pane);
foreach (var childPane in pane.Childern)
GetPanes(childPane,ref panes);
}
private void GetGroupPanes(BasePane pane, ref List<BasePane> panes)
{
panes.Add(pane);
foreach (var childPane in pane.Childern)
GetPanes(childPane,ref panes);
}
public static PaneTreeWrapper CreatePaneWrapper(BasePane pane)
{
PaneTreeWrapper paneNode = new PaneTreeWrapper();
paneNode.Text = pane.Name;
paneNode.Tag = pane;
2019-09-05 20:24:03 +00:00
paneNode.Checked = true;
string imageKey = "";
if (pane is BFLYT.WND1) imageKey = "WindowPane";
else if (pane is BCLYT.WND1) imageKey = "WindowPane";
else if (pane is BRLYT.WND1) imageKey = "WindowPane";
else if (pane is BFLYT.PIC1) imageKey = "PicturePane";
else if (pane is BCLYT.PIC1) imageKey = "PicturePane";
else if (pane is BRLYT.PIC1) imageKey = "PicturePane";
else if (pane is BFLYT.BND1) imageKey = "BoundryPane";
else if (pane is BCLYT.BND1) imageKey = "BoundryPane";
else if (pane is BRLYT.BND1) imageKey = "BoundryPane";
else if (pane is BFLYT.TXT1) imageKey = "TextPane";
else if (pane is BCLYT.TXT1) imageKey = "TextPane";
else if (pane is BRLYT.TXT1) imageKey = "TextPane";
else imageKey = "NullPane";
paneNode.ImageKey = imageKey;
paneNode.SelectedImageKey = imageKey;
return paneNode;
}
private void LoadPane(BasePane pane, TreeNode parent = null)
{
var paneNode = CreatePaneWrapper(pane);
pane.NodeWrapper = paneNode;
if (parent == null)
treeView1.Nodes.Add(paneNode);
else
parent.Nodes.Add(paneNode);
foreach (var childPane in pane.Childern)
LoadPane(childPane, paneNode);
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (isLoaded)
OnProperySelected.Invoke("Select", e);
}
private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
{
if (isLoaded)
2019-09-05 20:24:03 +00:00
{
if (!e.Node.Checked)
e.Node.ForeColor = FormThemes.BaseTheme.DisabledItemColor;
else
e.Node.ForeColor = treeView1.ForeColor;
OnProperySelected.Invoke("Checked", e);
2019-09-05 20:24:03 +00:00
}
}
private void treeView1_MouseClick(object sender, MouseEventArgs e)
{
}
private void TogglePane(object sender, EventArgs e)
{
TogglePane(treeView1.SelectedNode);
}
private void TogglePane(TreeNode node)
{
if (node == null)
return;
if (node.Checked)
node.Checked = false;
else
node.Checked = true;
}
private void treeView1_KeyDown(object sender, KeyEventArgs e)
{
var node = treeView1.SelectedNode;
if (node == null || node.Tag == null)
return;
if (e.KeyCode == Keys.H && e.Control)
{
if (node.Tag is BasePane)
TogglePane(node);
}
}
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Node.Tag == null)
return;
if (e.Button == MouseButtons.Right)
{
treeView1.SelectedNode = e.Node;
if (e.Node.Tag is BasePane)
{
ContexMenu.Items.Clear();
ContexMenu.Items.Add(new STToolStipMenuItem("Display Panes", null, TogglePane, Keys.Control | Keys.H));
// ContexMenu.Items.Add(new STToolStipMenuItem("Display Children Panes", null, TogglePane, Keys.Control | Keys.H));
ContexMenu.Show(Cursor.Position);
}
}
}
2019-09-23 22:16:50 +00:00
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)
{
}
}
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Node.Tag == null)
return;
Tons more layout editor improvements. - The UI has been completely redone. It's far much more clean and intuitive to edit with. - All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with. - Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions. - Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once). - Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor. - Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine. - Fixed many flags for properties which didn't get set correctly if edited. - Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes. - Text panes now auto calculate the text length and allow restricted lengths to be edited. - Properties can now be scrolled down, and kept at that state when refocused. - Add a selection box for selecting multiple panes at once - Textures can be added, removed and edited in editor. Make sure these are in the same archive!!! Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes. - Fixed window pane rendering with 1 frame and flipping textures. - Materials can add textures, and have new custom blend and alpha modes. when i finish the new layout export dialog. - Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-14 01:02:39 +00:00
if (e.Button == MouseButtons.Left) {
if (e.Node.Tag is BasePane)
ParentEditor.ShowPaneEditor(e.Node.Tag as BasePane);
}
}
private void treeView1_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(PaneTreeWrapper)))
{
Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y));
TreeNode targetNode = treeView1.GetNodeAt(targetPoint);
TreeNode draggedNode = (PaneTreeWrapper)e.Data.GetData(typeof(PaneTreeWrapper));
Console.WriteLine("draggedPane " + draggedNode.Text);
Console.WriteLine("draggedPane is pane? " + (draggedNode.Tag is BasePane));
var draggedPane = draggedNode.Tag as BasePane;
if (draggedPane == null || draggedPane.IsRoot)
return;
TreeNode parentNode = targetNode;
if (targetNode != null && targetNode.Parent != null)
{
bool canDrop = true;
while (canDrop && (parentNode != null))
{
canDrop = !Object.ReferenceEquals(draggedNode, parentNode);
parentNode = parentNode.Parent;
}
if (!canDrop) return;
bool isTargetParent = targetNode.Equals(draggedNode.Parent);
//Remove it's previous parent
draggedPane.Parent.Childern.Remove(draggedPane);
draggedNode.Remove();
//Adjust the parent to the parent's parent
Console.WriteLine("isTargetParent " + isTargetParent);
if (isTargetParent)
{
var parentPane = targetNode.Tag as BasePane;
if (parentPane.IsRoot) return;
var upperParentNode = targetNode.Parent;
var upperParentPane = upperParentNode.Tag as BasePane;
draggedPane.Parent = upperParentPane;
upperParentPane.Childern.Add(draggedPane);
upperParentNode.Nodes.Add(draggedNode);
upperParentNode.Expand();
}
else //Set the target node as the parent
{
var parentPane = targetNode.Tag as BasePane;
draggedPane.Parent = parentPane;
parentPane.Childern.Add(draggedPane);
targetNode.Nodes.Add(draggedNode);
targetNode.Expand();
}
}
}
}
private void treeView1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}
private void treeView1_ItemDrag(object sender, ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
}
}