mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-29 16:00:32 +00:00
Add menus to toggle docks for layout editor
This commit is contained in:
parent
d8676959ec
commit
24e7eba5d1
3 changed files with 240 additions and 93 deletions
|
@ -10,7 +10,7 @@ using Toolbox.Library.IO;
|
||||||
|
|
||||||
namespace FirstPlugin
|
namespace FirstPlugin
|
||||||
{
|
{
|
||||||
public class U8 : IArchiveFile, IFileFormat, IDirectoryContainer
|
public class U8 : IArchiveFile, IFileFormat
|
||||||
{
|
{
|
||||||
public FileType FileType { get; set; } = FileType.Archive;
|
public FileType FileType { get; set; } = FileType.Archive;
|
||||||
|
|
||||||
|
@ -50,13 +50,11 @@ namespace FirstPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<INode> nodes = new List<INode>();
|
|
||||||
public List<FileEntry> files = new List<FileEntry>();
|
public List<FileEntry> files = new List<FileEntry>();
|
||||||
|
|
||||||
public IEnumerable<ArchiveFileInfo> Files => files;
|
public IEnumerable<ArchiveFileInfo> Files => files;
|
||||||
public IEnumerable<INode> Nodes => nodes;
|
|
||||||
|
|
||||||
public void ClearFiles() { nodes.Clear(); }
|
public void ClearFiles() { files.Clear(); }
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
|
@ -112,56 +110,51 @@ namespace FirstPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set the strings
|
//Set the strings
|
||||||
for (int i = 0; i < TotalNodeCount; i++)
|
for (int i = 0; i < TotalNodeCount; i++) {
|
||||||
{
|
|
||||||
entries[i].Name = StringTable[entries[i].StringPoolOffset];
|
entries[i].Name = StringTable[entries[i].StringPoolOffset];
|
||||||
}
|
}
|
||||||
|
|
||||||
entries[0].Name = "Root";
|
entries[0].Name = "Root";
|
||||||
|
|
||||||
//Setup our directory entries for loading to the tree
|
SetFileNames(entries, 1, entries.Count, "");
|
||||||
DirectoryEntry[] dirs = new DirectoryEntry[TotalNodeCount];
|
|
||||||
for (int i = 0; i < dirs.Length; i++)
|
|
||||||
dirs[i] = new DirectoryEntry();
|
|
||||||
|
|
||||||
DirectoryEntry currentDir = dirs[1];
|
for (int i = 0; i < entries.Count - 1; i++)
|
||||||
nodes.Add(dirs[0]);
|
|
||||||
|
|
||||||
//Skip root so start index at 1
|
|
||||||
int dirIndex = 1;
|
|
||||||
for (int i = 0; i < TotalNodeCount; i++)
|
|
||||||
{
|
{
|
||||||
var node = entries[i];
|
if (entries[i].nodeType != NodeEntry.NodeType.Directory)
|
||||||
if (node.Name == string.Empty)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Console.WriteLine($"{ node.Name} {i} {node.nodeType} {node.Setting1}");
|
|
||||||
|
|
||||||
if (node.nodeType == NodeEntry.NodeType.Directory)
|
|
||||||
{
|
|
||||||
dirs[i].Name = node.Name;
|
|
||||||
dirs[i].nodeEntry = node;
|
|
||||||
currentDir = dirs[i];
|
|
||||||
|
|
||||||
if (i != 0)
|
|
||||||
dirs[node.Setting1].AddNode(currentDir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
FileEntry entry = new FileEntry();
|
FileEntry entry = new FileEntry();
|
||||||
entry.FileName = node.Name;
|
reader.SeekBegin(entries[i].Setting1);
|
||||||
entry.Name = node.Name;
|
entry.FileData = reader.ReadBytes((int)entries[i].Setting2);
|
||||||
entry.nodeEntry = node;
|
entry.FileName = entries[i].FullPath;
|
||||||
currentDir.nodes.Add(entry);
|
|
||||||
|
|
||||||
reader.SeekBegin(entry.nodeEntry.Setting1);
|
|
||||||
entry.FileData = reader.ReadBytes((int)entry.nodeEntry.Setting2);
|
|
||||||
files.Add(entry);
|
files.Add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int SetFileNames(List<NodeEntry> fileEntries, int firstIndex, int lastIndex, string directory)
|
||||||
|
{
|
||||||
|
int currentIndex = firstIndex;
|
||||||
|
while (currentIndex < lastIndex)
|
||||||
|
{
|
||||||
|
NodeEntry entry = fileEntries[currentIndex];
|
||||||
|
string filename = entry.Name;
|
||||||
|
entry.FullPath = directory + filename;
|
||||||
|
|
||||||
|
if (entry.nodeType == NodeEntry.NodeType.Directory)
|
||||||
|
{
|
||||||
|
entry.FullPath += "/";
|
||||||
|
currentIndex = SetFileNames(fileEntries, currentIndex + 1, (int)entry.Setting2, entry.FullPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++currentIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentIndex;
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveFile(FileWriter writer)
|
public void SaveFile(FileWriter writer)
|
||||||
{
|
{
|
||||||
writer.SetByteOrder(IsBigEndian);
|
writer.SetByteOrder(IsBigEndian);
|
||||||
|
@ -193,6 +186,8 @@ namespace FirstPlugin
|
||||||
|
|
||||||
public class NodeEntry : INode
|
public class NodeEntry : INode
|
||||||
{
|
{
|
||||||
|
public string FullPath { get; set; }
|
||||||
|
|
||||||
public NodeType nodeType
|
public NodeType nodeType
|
||||||
{
|
{
|
||||||
get { return (NodeType)(flags >> 24); }
|
get { return (NodeType)(flags >> 24); }
|
||||||
|
|
|
@ -66,6 +66,12 @@
|
||||||
this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.showGameWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.showGameWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.showAnimationWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.showAnimationWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.dockPanelsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.showTimelineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.showPropertiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.showPanelHiearchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.showTextureListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.showAnimationListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
|
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
|
||||||
this.editorModeCB = new Toolbox.Library.Forms.STComboBox();
|
this.editorModeCB = new Toolbox.Library.Forms.STComboBox();
|
||||||
this.chkAutoKey = new Toolbox.Library.Forms.STCheckBox();
|
this.chkAutoKey = new Toolbox.Library.Forms.STCheckBox();
|
||||||
|
@ -81,6 +87,7 @@
|
||||||
this.dockPanel1.Name = "dockPanel1";
|
this.dockPanel1.Name = "dockPanel1";
|
||||||
this.dockPanel1.Size = new System.Drawing.Size(955, 504);
|
this.dockPanel1.Size = new System.Drawing.Size(955, 504);
|
||||||
this.dockPanel1.TabIndex = 6;
|
this.dockPanel1.TabIndex = 6;
|
||||||
|
this.dockPanel1.ContentRemoved += new System.EventHandler<WeifenLuo.WinFormsUI.Docking.DockContentEventArgs>(this.dockPanel1_ContentRemoved);
|
||||||
this.dockPanel1.ActiveDocumentChanged += new System.EventHandler(this.dockPanel1_ActiveDocumentChanged);
|
this.dockPanel1.ActiveDocumentChanged += new System.EventHandler(this.dockPanel1_ActiveDocumentChanged);
|
||||||
//
|
//
|
||||||
// backColorDisplay
|
// backColorDisplay
|
||||||
|
@ -168,7 +175,8 @@
|
||||||
this.editToolStripMenuItem,
|
this.editToolStripMenuItem,
|
||||||
this.viewToolStripMenuItem,
|
this.viewToolStripMenuItem,
|
||||||
this.animationToolStripMenuItem,
|
this.animationToolStripMenuItem,
|
||||||
this.windowToolStripMenuItem});
|
this.windowToolStripMenuItem,
|
||||||
|
this.dockPanelsToolStripMenuItem});
|
||||||
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.stMenuStrip1.Name = "stMenuStrip1";
|
this.stMenuStrip1.Name = "stMenuStrip1";
|
||||||
this.stMenuStrip1.Size = new System.Drawing.Size(955, 24);
|
this.stMenuStrip1.Size = new System.Drawing.Size(955, 24);
|
||||||
|
@ -416,6 +424,58 @@
|
||||||
this.showAnimationWindowToolStripMenuItem.Text = "Show Animation Window";
|
this.showAnimationWindowToolStripMenuItem.Text = "Show Animation Window";
|
||||||
this.showAnimationWindowToolStripMenuItem.Click += new System.EventHandler(this.showAnimationWindowToolStripMenuItem_Click);
|
this.showAnimationWindowToolStripMenuItem.Click += new System.EventHandler(this.showAnimationWindowToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// dockPanelsToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.dockPanelsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.showTimelineToolStripMenuItem,
|
||||||
|
this.showPropertiesToolStripMenuItem,
|
||||||
|
this.showPanelHiearchyToolStripMenuItem,
|
||||||
|
this.showTextureListToolStripMenuItem,
|
||||||
|
this.showAnimationListToolStripMenuItem});
|
||||||
|
this.dockPanelsToolStripMenuItem.Name = "dockPanelsToolStripMenuItem";
|
||||||
|
this.dockPanelsToolStripMenuItem.Size = new System.Drawing.Size(83, 20);
|
||||||
|
this.dockPanelsToolStripMenuItem.Text = "Dock Panels";
|
||||||
|
//
|
||||||
|
// showTimelineToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.showTimelineToolStripMenuItem.CheckOnClick = true;
|
||||||
|
this.showTimelineToolStripMenuItem.Name = "showTimelineToolStripMenuItem";
|
||||||
|
this.showTimelineToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
||||||
|
this.showTimelineToolStripMenuItem.Text = "Show Timeline";
|
||||||
|
this.showTimelineToolStripMenuItem.Click += new System.EventHandler(this.showDockedPanel_Click);
|
||||||
|
//
|
||||||
|
// showPropertiesToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.showPropertiesToolStripMenuItem.CheckOnClick = true;
|
||||||
|
this.showPropertiesToolStripMenuItem.Name = "showPropertiesToolStripMenuItem";
|
||||||
|
this.showPropertiesToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
||||||
|
this.showPropertiesToolStripMenuItem.Text = "Show Properties";
|
||||||
|
this.showPropertiesToolStripMenuItem.Click += new System.EventHandler(this.showDockedPanel_Click);
|
||||||
|
//
|
||||||
|
// showPanelHiearchyToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.showPanelHiearchyToolStripMenuItem.CheckOnClick = true;
|
||||||
|
this.showPanelHiearchyToolStripMenuItem.Name = "showPanelHiearchyToolStripMenuItem";
|
||||||
|
this.showPanelHiearchyToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
||||||
|
this.showPanelHiearchyToolStripMenuItem.Text = "Show Panel Hiearchy";
|
||||||
|
this.showPanelHiearchyToolStripMenuItem.Click += new System.EventHandler(this.showDockedPanel_Click);
|
||||||
|
//
|
||||||
|
// showTextureListToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.showTextureListToolStripMenuItem.CheckOnClick = true;
|
||||||
|
this.showTextureListToolStripMenuItem.Name = "showTextureListToolStripMenuItem";
|
||||||
|
this.showTextureListToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
||||||
|
this.showTextureListToolStripMenuItem.Text = "Show Texture List";
|
||||||
|
this.showTextureListToolStripMenuItem.Click += new System.EventHandler(this.showDockedPanel_Click);
|
||||||
|
//
|
||||||
|
// showAnimationListToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.showAnimationListToolStripMenuItem.CheckOnClick = true;
|
||||||
|
this.showAnimationListToolStripMenuItem.Name = "showAnimationListToolStripMenuItem";
|
||||||
|
this.showAnimationListToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
||||||
|
this.showAnimationListToolStripMenuItem.Text = "Show Animation List";
|
||||||
|
this.showAnimationListToolStripMenuItem.Click += new System.EventHandler(this.showDockedPanel_Click);
|
||||||
|
//
|
||||||
// stLabel2
|
// stLabel2
|
||||||
//
|
//
|
||||||
this.stLabel2.AutoSize = true;
|
this.stLabel2.AutoSize = true;
|
||||||
|
@ -526,5 +586,11 @@
|
||||||
private Toolbox.Library.Forms.STComboBox editorModeCB;
|
private Toolbox.Library.Forms.STComboBox editorModeCB;
|
||||||
private Toolbox.Library.Forms.STCheckBox chkAutoKey;
|
private Toolbox.Library.Forms.STCheckBox chkAutoKey;
|
||||||
private System.Windows.Forms.ToolStripMenuItem showAnimationWindowToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem showAnimationWindowToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem dockPanelsToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem showTimelineToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem showPropertiesToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem showTextureListToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem showAnimationListToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem showPanelHiearchyToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,13 @@ namespace LayoutBXLYT
|
||||||
displayGridToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayGrid;
|
displayGridToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayGrid;
|
||||||
displayTextPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayTextPane;
|
displayTextPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayTextPane;
|
||||||
transformChildrenToolStripMenuItem.Checked = Runtime.LayoutEditor.TransformChidlren;
|
transformChildrenToolStripMenuItem.Checked = Runtime.LayoutEditor.TransformChidlren;
|
||||||
viewPartsAsNullPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.PartsAsNullPanes;
|
viewPartsAsNullPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.PartsAsNullPanes;
|
||||||
|
|
||||||
|
showAnimationListToolStripMenuItem.Checked = true;
|
||||||
|
showPropertiesToolStripMenuItem.Checked = true;
|
||||||
|
showAnimationListToolStripMenuItem.Checked = true;
|
||||||
|
showPanelHiearchyToolStripMenuItem.Checked = true;
|
||||||
|
showTextureListToolStripMenuItem.Checked = true;
|
||||||
|
|
||||||
ObjectSelected += OnObjectSelected;
|
ObjectSelected += OnObjectSelected;
|
||||||
ObjectChanged += OnObjectChanged;
|
ObjectChanged += OnObjectChanged;
|
||||||
|
@ -126,32 +132,32 @@ namespace LayoutBXLYT
|
||||||
public void LoadBxlyt(BxlytHeader header)
|
public void LoadBxlyt(BxlytHeader header)
|
||||||
{
|
{
|
||||||
Text = $"Switch Toolbox Layout Editor [{header.FileName}]";
|
Text = $"Switch Toolbox Layout Editor [{header.FileName}]";
|
||||||
/* if (PluginRuntime.BxfntFiles.Count > 0)
|
/* if (PluginRuntime.BxfntFiles.Count > 0)
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show("Found font files opened. Would you like to save character images to disk? " +
|
var result = MessageBox.Show("Found font files opened. Would you like to save character images to disk? " +
|
||||||
"(Allows for faster loading and won't need to be reopened)", "Layout Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
"(Allows for faster loading and won't need to be reopened)", "Layout Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
var cacheDir = $"{Runtime.ExecutableDir}/Cached/Font";
|
var cacheDir = $"{Runtime.ExecutableDir}/Cached/Font";
|
||||||
if (!System.IO.Directory.Exists(cacheDir))
|
if (!System.IO.Directory.Exists(cacheDir))
|
||||||
System.IO.Directory.CreateDirectory(cacheDir);
|
System.IO.Directory.CreateDirectory(cacheDir);
|
||||||
|
|
||||||
foreach (var bffnt in PluginRuntime.BxfntFiles)
|
foreach (var bffnt in PluginRuntime.BxfntFiles)
|
||||||
{
|
{
|
||||||
if (!System.IO.Directory.Exists($"{cacheDir}/{bffnt.Name}"))
|
if (!System.IO.Directory.Exists($"{cacheDir}/{bffnt.Name}"))
|
||||||
System.IO.Directory.CreateDirectory($"{cacheDir}/{bffnt.Name}");
|
System.IO.Directory.CreateDirectory($"{cacheDir}/{bffnt.Name}");
|
||||||
|
|
||||||
var fontBitmap = bffnt.GetBitmapFont(true);
|
var fontBitmap = bffnt.GetBitmapFont(true);
|
||||||
foreach (var character in fontBitmap.Characters)
|
foreach (var character in fontBitmap.Characters)
|
||||||
{
|
{
|
||||||
var charaMap = character.Value;
|
var charaMap = character.Value;
|
||||||
charaMap.CharBitmap.Save($"{cacheDir}/{bffnt.Name}/cmap_{Convert.ToUInt16(character.Key).ToString("x2")}_{charaMap.CharWidth}_{charaMap.GlyphWidth}_{charaMap.LeftOffset}.png");
|
charaMap.CharBitmap.Save($"{cacheDir}/{bffnt.Name}/cmap_{Convert.ToUInt16(character.Key).ToString("x2")}_{charaMap.CharWidth}_{charaMap.GlyphWidth}_{charaMap.LeftOffset}.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
fontBitmap.Dispose();
|
fontBitmap.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
LayoutFiles.Add(header);
|
LayoutFiles.Add(header);
|
||||||
ActiveLayout = header;
|
ActiveLayout = header;
|
||||||
|
@ -302,6 +308,7 @@ namespace LayoutBXLYT
|
||||||
{
|
{
|
||||||
if (e is TreeViewEventArgs) {
|
if (e is TreeViewEventArgs) {
|
||||||
var node = ((TreeViewEventArgs)e).Node;
|
var node = ((TreeViewEventArgs)e).Node;
|
||||||
|
var mutliSelectedNodes = LayoutHierarchy.GetSelectedPanes();
|
||||||
|
|
||||||
if (Runtime.LayoutEditor.AnimationEditMode)
|
if (Runtime.LayoutEditor.AnimationEditMode)
|
||||||
OnSelectedAnimationMode();
|
OnSelectedAnimationMode();
|
||||||
|
@ -310,7 +317,7 @@ namespace LayoutBXLYT
|
||||||
ActiveViewport?.SelectedPanes.Clear();
|
ActiveViewport?.SelectedPanes.Clear();
|
||||||
|
|
||||||
if (node.Tag is BasePane)
|
if (node.Tag is BasePane)
|
||||||
LoadPaneEditorOnSelect(node.Tag as BasePane);
|
LoadPaneEditorOnSelect(mutliSelectedNodes);
|
||||||
else if (node.Tag is BxlytMaterial)
|
else if (node.Tag is BxlytMaterial)
|
||||||
{
|
{
|
||||||
LayoutPaneEditor.Text = $"Properties [{((BxlytMaterial)node.Tag).Name}]";
|
LayoutPaneEditor.Text = $"Properties [{((BxlytMaterial)node.Tag).Name}]";
|
||||||
|
@ -340,15 +347,21 @@ namespace LayoutBXLYT
|
||||||
{
|
{
|
||||||
if (AnimationPanel == null) return;
|
if (AnimationPanel == null) return;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateViewport() {
|
public void UpdateViewport() {
|
||||||
ActiveViewport?.UpdateViewport();
|
ActiveViewport?.UpdateViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadPaneEditorOnSelect(BasePane pane)
|
public void LoadPaneEditorOnSelect(BasePane pane) {
|
||||||
|
LoadPaneEditorOnSelect(new List<BasePane>() { pane });
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadPaneEditorOnSelect(List<BasePane> panes)
|
||||||
{
|
{
|
||||||
|
var pane = panes.FirstOrDefault();
|
||||||
|
|
||||||
if (pane is IPicturePane)
|
if (pane is IPicturePane)
|
||||||
LayoutPaneEditor.Text = $"Properties [{pane.Name}] | (Picture Pane)";
|
LayoutPaneEditor.Text = $"Properties [{pane.Name}] | (Picture Pane)";
|
||||||
else if (pane is ITextPane)
|
else if (pane is ITextPane)
|
||||||
|
@ -366,8 +379,10 @@ namespace LayoutBXLYT
|
||||||
|
|
||||||
if (ActiveViewport == null) return;
|
if (ActiveViewport == null) return;
|
||||||
|
|
||||||
if (!ActiveViewport.SelectedPanes.Contains(pane))
|
foreach (var pn in panes) {
|
||||||
ActiveViewport.SelectedPanes.Add(pane);
|
if (!ActiveViewport.SelectedPanes.Contains(pn))
|
||||||
|
ActiveViewport.SelectedPanes.Add(pn);
|
||||||
|
}
|
||||||
|
|
||||||
if (AnimationWindow != null && !AnimationWindow.Disposing && !AnimationWindow.IsDisposed)
|
if (AnimationWindow != null && !AnimationWindow.Disposing && !AnimationWindow.IsDisposed)
|
||||||
AnimationWindow.LoadPane(pane, this);
|
AnimationWindow.LoadPane(pane, this);
|
||||||
|
@ -455,18 +470,18 @@ namespace LayoutBXLYT
|
||||||
|
|
||||||
dock.Show(this);
|
dock.Show(this);
|
||||||
|
|
||||||
/* if (LayoutAnimEditor != null) {
|
/* if (LayoutAnimEditor != null) {
|
||||||
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutAnimEditor = new LayoutAnimEditor();
|
LayoutAnimEditor = new LayoutAnimEditor();
|
||||||
AnimationPanel.OnNodeSelected = LayoutAnimEditor.OnNodeSelected;
|
AnimationPanel.OnNodeSelected = LayoutAnimEditor.OnNodeSelected;
|
||||||
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
||||||
if (LayoutHierarchy != null)
|
if (LayoutHierarchy != null)
|
||||||
LayoutAnimEditor.Show(LayoutHierarchy.Pane, DockAlignment.Bottom, 0.5);
|
LayoutAnimEditor.Show(LayoutHierarchy.Pane, DockAlignment.Bottom, 0.5);
|
||||||
else
|
else
|
||||||
LayoutAnimEditor.Show(dockPanel1, DockState.DockRight);*/
|
LayoutAnimEditor.Show(dockPanel1, DockState.DockRight);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AnimPropertyChanged(object sender, EventArgs e)
|
private void AnimPropertyChanged(object sender, EventArgs e)
|
||||||
|
@ -478,11 +493,13 @@ namespace LayoutBXLYT
|
||||||
{
|
{
|
||||||
if (LayoutPaneEditor == null)
|
if (LayoutPaneEditor == null)
|
||||||
LayoutPaneEditor = new PaneEditor();
|
LayoutPaneEditor = new PaneEditor();
|
||||||
|
else if (LayoutPaneEditor.IsDisposed)
|
||||||
|
LayoutPaneEditor = new PaneEditor();
|
||||||
|
|
||||||
LayoutPaneEditor.Text = "Properties";
|
LayoutPaneEditor.Text = "Properties";
|
||||||
LayoutPaneEditor.PropertyChanged += OnPanePropertyChanged;
|
LayoutPaneEditor.PropertyChanged += OnPanePropertyChanged;
|
||||||
|
|
||||||
if (LayoutHierarchy != null)
|
if (LayoutHierarchy != null && !LayoutHierarchy.IsDisposed)
|
||||||
LayoutPaneEditor.Show(LayoutHierarchy.Pane, DockAlignment.Bottom, 0.5);
|
LayoutPaneEditor.Show(LayoutHierarchy.Pane, DockAlignment.Bottom, 0.5);
|
||||||
else
|
else
|
||||||
LayoutPaneEditor.Show(dockPanel1, DockState.DockRight);
|
LayoutPaneEditor.Show(dockPanel1, DockState.DockRight);
|
||||||
|
@ -500,17 +517,17 @@ namespace LayoutBXLYT
|
||||||
|
|
||||||
public void ShowPaneEditor(BasePane pane)
|
public void ShowPaneEditor(BasePane pane)
|
||||||
{
|
{
|
||||||
/* if (LayoutPaneEditor == null)
|
/* if (LayoutPaneEditor == null)
|
||||||
LayoutPaneEditor = new PaneEditor();
|
LayoutPaneEditor = new PaneEditor();
|
||||||
|
|
||||||
LayoutPaneEditor.PropertyChanged += OnPanePropertyChanged;
|
LayoutPaneEditor.PropertyChanged += OnPanePropertyChanged;
|
||||||
LayoutPaneEditor.LoadPane(pane);
|
LayoutPaneEditor.LoadPane(pane);
|
||||||
LayoutPaneEditor.Show();*/
|
LayoutPaneEditor.Show();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowAnimationHierarchy()
|
public void ShowAnimationHierarchy()
|
||||||
{
|
{
|
||||||
if (LayoutAnimList != null)
|
if (LayoutAnimList != null && !LayoutAnimList.IsDisposed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LayoutAnimList = new LayoutAnimList(this, ObjectSelected);
|
LayoutAnimList = new LayoutAnimList(this, ObjectSelected);
|
||||||
|
@ -520,7 +537,7 @@ namespace LayoutBXLYT
|
||||||
|
|
||||||
private void ShowPaneHierarchy()
|
private void ShowPaneHierarchy()
|
||||||
{
|
{
|
||||||
if (LayoutHierarchy != null)
|
if (LayoutHierarchy != null && !LayoutHierarchy.IsDisposed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LayoutHierarchy = new LayoutHierarchy(this);
|
LayoutHierarchy = new LayoutHierarchy(this);
|
||||||
|
@ -531,7 +548,7 @@ namespace LayoutBXLYT
|
||||||
|
|
||||||
private void ShowTextureList()
|
private void ShowTextureList()
|
||||||
{
|
{
|
||||||
if (LayoutTextureList != null)
|
if (LayoutTextureList != null && !LayoutTextureList.IsDisposed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LayoutTextureList = new LayoutTextureList();
|
LayoutTextureList = new LayoutTextureList();
|
||||||
|
@ -548,7 +565,6 @@ namespace LayoutBXLYT
|
||||||
AnimationPanel.AnimationPlaying += OnAnimationPlaying;
|
AnimationPanel.AnimationPlaying += OnAnimationPlaying;
|
||||||
AnimationPanel.SetViewport(ActiveViewport.GetGLControl());
|
AnimationPanel.SetViewport(ActiveViewport.GetGLControl());
|
||||||
dockContent.Controls.Add(AnimationPanel);
|
dockContent.Controls.Add(AnimationPanel);
|
||||||
LayoutTextureList.Show(dockPanel1, DockState.DockRight);
|
|
||||||
|
|
||||||
if (ActiveViewport != null)
|
if (ActiveViewport != null)
|
||||||
dockContent.Show(ActiveViewport.Pane, DockAlignment.Bottom, 0.2);
|
dockContent.Show(ActiveViewport.Pane, DockAlignment.Bottom, 0.2);
|
||||||
|
@ -736,6 +752,11 @@ namespace LayoutBXLYT
|
||||||
fileFormat.IFileInfo.ArchiveParent = archiveFile;
|
fileFormat.IFileInfo.ArchiveParent = archiveFile;
|
||||||
layouts.Add(fileFormat);
|
layouts.Add(fileFormat);
|
||||||
}
|
}
|
||||||
|
else if (fileFormat is BRLYT)
|
||||||
|
{
|
||||||
|
fileFormat.IFileInfo.ArchiveParent = archiveFile;
|
||||||
|
layouts.Add(fileFormat);
|
||||||
|
}
|
||||||
else if (Utils.GetExtension(file.FileName) == ".bntx")
|
else if (Utils.GetExtension(file.FileName) == ".bntx")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -930,7 +951,7 @@ namespace LayoutBXLYT
|
||||||
else
|
else
|
||||||
toolstripOrthoBtn.Image = FirstPlugin.Properties.Resources.OrthoView;
|
toolstripOrthoBtn.Image = FirstPlugin.Properties.Resources.OrthoView;
|
||||||
|
|
||||||
Runtime.LayoutEditor.UseOrthographicView = orthographicViewToolStripMenuItem.Checked;
|
Runtime.LayoutEditor.UseOrthographicView = orthographicViewToolStripMenuItem.Checked;
|
||||||
ActiveViewport.ResetCamera();
|
ActiveViewport.ResetCamera();
|
||||||
ActiveViewport.UpdateViewport();
|
ActiveViewport.UpdateViewport();
|
||||||
}
|
}
|
||||||
|
@ -985,7 +1006,7 @@ namespace LayoutBXLYT
|
||||||
{
|
{
|
||||||
if (GamePreviewWindow == null || GamePreviewWindow.Disposing || GamePreviewWindow.IsDisposed)
|
if (GamePreviewWindow == null || GamePreviewWindow.Disposing || GamePreviewWindow.IsDisposed)
|
||||||
{
|
{
|
||||||
GamePreviewWindow = new LayoutViewer(this,ActiveLayout, Textures);
|
GamePreviewWindow = new LayoutViewer(this, ActiveLayout, Textures);
|
||||||
GamePreviewWindow.GameWindow = true;
|
GamePreviewWindow.GameWindow = true;
|
||||||
GamePreviewWindow.Dock = DockStyle.Fill;
|
GamePreviewWindow.Dock = DockStyle.Fill;
|
||||||
STForm form = new STForm();
|
STForm form = new STForm();
|
||||||
|
@ -1139,7 +1160,7 @@ namespace LayoutBXLYT
|
||||||
public void AddNewPastedPane(BasePane pane)
|
public void AddNewPastedPane(BasePane pane)
|
||||||
{
|
{
|
||||||
string name = pane.Name;
|
string name = pane.Name;
|
||||||
string numberedEnd = pane.Name.Split('_').LastOrDefault().Replace("_", string.Empty);
|
string numberedEnd = pane.Name.Split('_').LastOrDefault().Replace("_", string.Empty);
|
||||||
if (numberedEnd.All(char.IsDigit)) {
|
if (numberedEnd.All(char.IsDigit)) {
|
||||||
if (name.Contains($"_{numberedEnd}"))
|
if (name.Contains($"_{numberedEnd}"))
|
||||||
name = name.Replace($"_{numberedEnd}", string.Empty);
|
name = name.Replace($"_{numberedEnd}", string.Empty);
|
||||||
|
@ -1212,5 +1233,70 @@ namespace LayoutBXLYT
|
||||||
AnimationWindow.Show(this);
|
AnimationWindow.Show(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showDockedPanel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (ActiveViewport == null || ActiveLayout == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var menu = sender as ToolStripMenuItem;
|
||||||
|
if (menu == null) return;
|
||||||
|
|
||||||
|
Console.WriteLine($"menu {menu.Checked}");
|
||||||
|
|
||||||
|
if (menu.Checked)
|
||||||
|
{
|
||||||
|
if (menu == showTimelineToolStripMenuItem) {
|
||||||
|
ShowAnimationPanel();
|
||||||
|
LayoutAnimList.LoadAnimation(ActiveAnimation);
|
||||||
|
}
|
||||||
|
if (menu == showPropertiesToolStripMenuItem)
|
||||||
|
ShowPropertiesPanel();
|
||||||
|
if (menu == showPanelHiearchyToolStripMenuItem)
|
||||||
|
ShowPaneHierarchy();
|
||||||
|
if (menu == showTextureListToolStripMenuItem)
|
||||||
|
ShowTextureList();
|
||||||
|
if (menu == showAnimationListToolStripMenuItem)
|
||||||
|
ShowAnimationHierarchy();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (menu == showTimelineToolStripMenuItem)
|
||||||
|
CloseAnimationPanel();
|
||||||
|
if (menu == showPropertiesToolStripMenuItem)
|
||||||
|
LayoutProperties?.Close();
|
||||||
|
if (menu == showPanelHiearchyToolStripMenuItem)
|
||||||
|
LayoutHierarchy?.Close();
|
||||||
|
if (menu == showTextureListToolStripMenuItem)
|
||||||
|
LayoutTextureList?.Close();
|
||||||
|
if (menu == showAnimationListToolStripMenuItem)
|
||||||
|
LayoutAnimList?.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateMenuBar() {
|
||||||
|
showTimelineToolStripMenuItem.Checked = ControlIsActive(AnimationPanel);
|
||||||
|
showPropertiesToolStripMenuItem.Checked = ControlIsActive(LayoutProperties);
|
||||||
|
showPanelHiearchyToolStripMenuItem.Checked = ControlIsActive(LayoutHierarchy);
|
||||||
|
showTextureListToolStripMenuItem.Checked = ControlIsActive(LayoutTextureList);
|
||||||
|
showAnimationListToolStripMenuItem.Checked = ControlIsActive(LayoutAnimList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ControlIsActive(Control control) {
|
||||||
|
if (control == null) return false;
|
||||||
|
return !control.IsDisposed && !control.Disposing;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseAnimationPanel()
|
||||||
|
{
|
||||||
|
if (AnimationPanel == null) return;
|
||||||
|
|
||||||
|
var dock = AnimationPanel.Parent as DockContent;
|
||||||
|
dock.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dockPanel1_ContentRemoved(object sender, DockContentEventArgs e) {
|
||||||
|
UpdateMenuBar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue