mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +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
|
||||
{
|
||||
public class U8 : IArchiveFile, IFileFormat, IDirectoryContainer
|
||||
public class U8 : IArchiveFile, IFileFormat
|
||||
{
|
||||
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 IEnumerable<ArchiveFileInfo> Files => files;
|
||||
public IEnumerable<INode> Nodes => nodes;
|
||||
|
||||
public void ClearFiles() { nodes.Clear(); }
|
||||
public void ClearFiles() { files.Clear(); }
|
||||
|
||||
public string Name
|
||||
{
|
||||
|
@ -112,56 +110,51 @@ namespace FirstPlugin
|
|||
}
|
||||
|
||||
//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[0].Name = "Root";
|
||||
|
||||
//Setup our directory entries for loading to the tree
|
||||
DirectoryEntry[] dirs = new DirectoryEntry[TotalNodeCount];
|
||||
for (int i = 0; i < dirs.Length; i++)
|
||||
dirs[i] = new DirectoryEntry();
|
||||
SetFileNames(entries, 1, entries.Count, "");
|
||||
|
||||
DirectoryEntry currentDir = dirs[1];
|
||||
nodes.Add(dirs[0]);
|
||||
|
||||
//Skip root so start index at 1
|
||||
int dirIndex = 1;
|
||||
for (int i = 0; i < TotalNodeCount; i++)
|
||||
for (int i = 0; i < entries.Count - 1; i++)
|
||||
{
|
||||
var node = entries[i];
|
||||
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
|
||||
if (entries[i].nodeType != NodeEntry.NodeType.Directory)
|
||||
{
|
||||
FileEntry entry = new FileEntry();
|
||||
entry.FileName = node.Name;
|
||||
entry.Name = node.Name;
|
||||
entry.nodeEntry = node;
|
||||
currentDir.nodes.Add(entry);
|
||||
|
||||
reader.SeekBegin(entry.nodeEntry.Setting1);
|
||||
entry.FileData = reader.ReadBytes((int)entry.nodeEntry.Setting2);
|
||||
reader.SeekBegin(entries[i].Setting1);
|
||||
entry.FileData = reader.ReadBytes((int)entries[i].Setting2);
|
||||
entry.FileName = entries[i].FullPath;
|
||||
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)
|
||||
{
|
||||
writer.SetByteOrder(IsBigEndian);
|
||||
|
@ -193,6 +186,8 @@ namespace FirstPlugin
|
|||
|
||||
public class NodeEntry : INode
|
||||
{
|
||||
public string FullPath { get; set; }
|
||||
|
||||
public NodeType nodeType
|
||||
{
|
||||
get { return (NodeType)(flags >> 24); }
|
||||
|
|
|
@ -66,6 +66,12 @@
|
|||
this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.showGameWindowToolStripMenuItem = 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.editorModeCB = new Toolbox.Library.Forms.STComboBox();
|
||||
this.chkAutoKey = new Toolbox.Library.Forms.STCheckBox();
|
||||
|
@ -81,6 +87,7 @@
|
|||
this.dockPanel1.Name = "dockPanel1";
|
||||
this.dockPanel1.Size = new System.Drawing.Size(955, 504);
|
||||
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);
|
||||
//
|
||||
// backColorDisplay
|
||||
|
@ -168,7 +175,8 @@
|
|||
this.editToolStripMenuItem,
|
||||
this.viewToolStripMenuItem,
|
||||
this.animationToolStripMenuItem,
|
||||
this.windowToolStripMenuItem});
|
||||
this.windowToolStripMenuItem,
|
||||
this.dockPanelsToolStripMenuItem});
|
||||
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.stMenuStrip1.Name = "stMenuStrip1";
|
||||
this.stMenuStrip1.Size = new System.Drawing.Size(955, 24);
|
||||
|
@ -416,6 +424,58 @@
|
|||
this.showAnimationWindowToolStripMenuItem.Text = "Show Animation Window";
|
||||
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
|
||||
//
|
||||
this.stLabel2.AutoSize = true;
|
||||
|
@ -526,5 +586,11 @@
|
|||
private Toolbox.Library.Forms.STComboBox editorModeCB;
|
||||
private Toolbox.Library.Forms.STCheckBox chkAutoKey;
|
||||
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;
|
||||
displayTextPanesToolStripMenuItem.Checked = Runtime.LayoutEditor.DisplayTextPane;
|
||||
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;
|
||||
ObjectChanged += OnObjectChanged;
|
||||
|
@ -126,32 +132,32 @@ namespace LayoutBXLYT
|
|||
public void LoadBxlyt(BxlytHeader header)
|
||||
{
|
||||
Text = $"Switch Toolbox Layout Editor [{header.FileName}]";
|
||||
/* if (PluginRuntime.BxfntFiles.Count > 0)
|
||||
{
|
||||
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);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
var cacheDir = $"{Runtime.ExecutableDir}/Cached/Font";
|
||||
if (!System.IO.Directory.Exists(cacheDir))
|
||||
System.IO.Directory.CreateDirectory(cacheDir);
|
||||
/* if (PluginRuntime.BxfntFiles.Count > 0)
|
||||
{
|
||||
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);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
var cacheDir = $"{Runtime.ExecutableDir}/Cached/Font";
|
||||
if (!System.IO.Directory.Exists(cacheDir))
|
||||
System.IO.Directory.CreateDirectory(cacheDir);
|
||||
|
||||
foreach (var bffnt in PluginRuntime.BxfntFiles)
|
||||
{
|
||||
if (!System.IO.Directory.Exists($"{cacheDir}/{bffnt.Name}"))
|
||||
System.IO.Directory.CreateDirectory($"{cacheDir}/{bffnt.Name}");
|
||||
foreach (var bffnt in PluginRuntime.BxfntFiles)
|
||||
{
|
||||
if (!System.IO.Directory.Exists($"{cacheDir}/{bffnt.Name}"))
|
||||
System.IO.Directory.CreateDirectory($"{cacheDir}/{bffnt.Name}");
|
||||
|
||||
var fontBitmap = bffnt.GetBitmapFont(true);
|
||||
foreach (var character in fontBitmap.Characters)
|
||||
{
|
||||
var charaMap = character.Value;
|
||||
charaMap.CharBitmap.Save($"{cacheDir}/{bffnt.Name}/cmap_{Convert.ToUInt16(character.Key).ToString("x2")}_{charaMap.CharWidth}_{charaMap.GlyphWidth}_{charaMap.LeftOffset}.png");
|
||||
}
|
||||
var fontBitmap = bffnt.GetBitmapFont(true);
|
||||
foreach (var character in fontBitmap.Characters)
|
||||
{
|
||||
var charaMap = character.Value;
|
||||
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);
|
||||
ActiveLayout = header;
|
||||
|
@ -302,6 +308,7 @@ namespace LayoutBXLYT
|
|||
{
|
||||
if (e is TreeViewEventArgs) {
|
||||
var node = ((TreeViewEventArgs)e).Node;
|
||||
var mutliSelectedNodes = LayoutHierarchy.GetSelectedPanes();
|
||||
|
||||
if (Runtime.LayoutEditor.AnimationEditMode)
|
||||
OnSelectedAnimationMode();
|
||||
|
@ -310,7 +317,7 @@ namespace LayoutBXLYT
|
|||
ActiveViewport?.SelectedPanes.Clear();
|
||||
|
||||
if (node.Tag is BasePane)
|
||||
LoadPaneEditorOnSelect(node.Tag as BasePane);
|
||||
LoadPaneEditorOnSelect(mutliSelectedNodes);
|
||||
else if (node.Tag is BxlytMaterial)
|
||||
{
|
||||
LayoutPaneEditor.Text = $"Properties [{((BxlytMaterial)node.Tag).Name}]";
|
||||
|
@ -340,15 +347,21 @@ namespace LayoutBXLYT
|
|||
{
|
||||
if (AnimationPanel == null) return;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void 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)
|
||||
LayoutPaneEditor.Text = $"Properties [{pane.Name}] | (Picture Pane)";
|
||||
else if (pane is ITextPane)
|
||||
|
@ -366,8 +379,10 @@ namespace LayoutBXLYT
|
|||
|
||||
if (ActiveViewport == null) return;
|
||||
|
||||
if (!ActiveViewport.SelectedPanes.Contains(pane))
|
||||
ActiveViewport.SelectedPanes.Add(pane);
|
||||
foreach (var pn in panes) {
|
||||
if (!ActiveViewport.SelectedPanes.Contains(pn))
|
||||
ActiveViewport.SelectedPanes.Add(pn);
|
||||
}
|
||||
|
||||
if (AnimationWindow != null && !AnimationWindow.Disposing && !AnimationWindow.IsDisposed)
|
||||
AnimationWindow.LoadPane(pane, this);
|
||||
|
@ -455,18 +470,18 @@ namespace LayoutBXLYT
|
|||
|
||||
dock.Show(this);
|
||||
|
||||
/* if (LayoutAnimEditor != null) {
|
||||
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
||||
return;
|
||||
}
|
||||
/* if (LayoutAnimEditor != null) {
|
||||
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
||||
return;
|
||||
}
|
||||
|
||||
LayoutAnimEditor = new LayoutAnimEditor();
|
||||
AnimationPanel.OnNodeSelected = LayoutAnimEditor.OnNodeSelected;
|
||||
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
||||
if (LayoutHierarchy != null)
|
||||
LayoutAnimEditor.Show(LayoutHierarchy.Pane, DockAlignment.Bottom, 0.5);
|
||||
else
|
||||
LayoutAnimEditor.Show(dockPanel1, DockState.DockRight);*/
|
||||
LayoutAnimEditor = new LayoutAnimEditor();
|
||||
AnimationPanel.OnNodeSelected = LayoutAnimEditor.OnNodeSelected;
|
||||
LayoutAnimEditor.LoadFile(bxlan.GetGenericAnimation());
|
||||
if (LayoutHierarchy != null)
|
||||
LayoutAnimEditor.Show(LayoutHierarchy.Pane, DockAlignment.Bottom, 0.5);
|
||||
else
|
||||
LayoutAnimEditor.Show(dockPanel1, DockState.DockRight);*/
|
||||
}
|
||||
|
||||
private void AnimPropertyChanged(object sender, EventArgs e)
|
||||
|
@ -478,11 +493,13 @@ namespace LayoutBXLYT
|
|||
{
|
||||
if (LayoutPaneEditor == null)
|
||||
LayoutPaneEditor = new PaneEditor();
|
||||
else if (LayoutPaneEditor.IsDisposed)
|
||||
LayoutPaneEditor = new PaneEditor();
|
||||
|
||||
LayoutPaneEditor.Text = "Properties";
|
||||
LayoutPaneEditor.PropertyChanged += OnPanePropertyChanged;
|
||||
|
||||
if (LayoutHierarchy != null)
|
||||
if (LayoutHierarchy != null && !LayoutHierarchy.IsDisposed)
|
||||
LayoutPaneEditor.Show(LayoutHierarchy.Pane, DockAlignment.Bottom, 0.5);
|
||||
else
|
||||
LayoutPaneEditor.Show(dockPanel1, DockState.DockRight);
|
||||
|
@ -500,17 +517,17 @@ namespace LayoutBXLYT
|
|||
|
||||
public void ShowPaneEditor(BasePane pane)
|
||||
{
|
||||
/* if (LayoutPaneEditor == null)
|
||||
LayoutPaneEditor = new PaneEditor();
|
||||
/* if (LayoutPaneEditor == null)
|
||||
LayoutPaneEditor = new PaneEditor();
|
||||
|
||||
LayoutPaneEditor.PropertyChanged += OnPanePropertyChanged;
|
||||
LayoutPaneEditor.LoadPane(pane);
|
||||
LayoutPaneEditor.Show();*/
|
||||
LayoutPaneEditor.PropertyChanged += OnPanePropertyChanged;
|
||||
LayoutPaneEditor.LoadPane(pane);
|
||||
LayoutPaneEditor.Show();*/
|
||||
}
|
||||
|
||||
public void ShowAnimationHierarchy()
|
||||
{
|
||||
if (LayoutAnimList != null)
|
||||
if (LayoutAnimList != null && !LayoutAnimList.IsDisposed)
|
||||
return;
|
||||
|
||||
LayoutAnimList = new LayoutAnimList(this, ObjectSelected);
|
||||
|
@ -520,7 +537,7 @@ namespace LayoutBXLYT
|
|||
|
||||
private void ShowPaneHierarchy()
|
||||
{
|
||||
if (LayoutHierarchy != null)
|
||||
if (LayoutHierarchy != null && !LayoutHierarchy.IsDisposed)
|
||||
return;
|
||||
|
||||
LayoutHierarchy = new LayoutHierarchy(this);
|
||||
|
@ -531,7 +548,7 @@ namespace LayoutBXLYT
|
|||
|
||||
private void ShowTextureList()
|
||||
{
|
||||
if (LayoutTextureList != null)
|
||||
if (LayoutTextureList != null && !LayoutTextureList.IsDisposed)
|
||||
return;
|
||||
|
||||
LayoutTextureList = new LayoutTextureList();
|
||||
|
@ -548,7 +565,6 @@ namespace LayoutBXLYT
|
|||
AnimationPanel.AnimationPlaying += OnAnimationPlaying;
|
||||
AnimationPanel.SetViewport(ActiveViewport.GetGLControl());
|
||||
dockContent.Controls.Add(AnimationPanel);
|
||||
LayoutTextureList.Show(dockPanel1, DockState.DockRight);
|
||||
|
||||
if (ActiveViewport != null)
|
||||
dockContent.Show(ActiveViewport.Pane, DockAlignment.Bottom, 0.2);
|
||||
|
@ -736,6 +752,11 @@ namespace LayoutBXLYT
|
|||
fileFormat.IFileInfo.ArchiveParent = archiveFile;
|
||||
layouts.Add(fileFormat);
|
||||
}
|
||||
else if (fileFormat is BRLYT)
|
||||
{
|
||||
fileFormat.IFileInfo.ArchiveParent = archiveFile;
|
||||
layouts.Add(fileFormat);
|
||||
}
|
||||
else if (Utils.GetExtension(file.FileName) == ".bntx")
|
||||
{
|
||||
|
||||
|
@ -930,7 +951,7 @@ namespace LayoutBXLYT
|
|||
else
|
||||
toolstripOrthoBtn.Image = FirstPlugin.Properties.Resources.OrthoView;
|
||||
|
||||
Runtime.LayoutEditor.UseOrthographicView = orthographicViewToolStripMenuItem.Checked;
|
||||
Runtime.LayoutEditor.UseOrthographicView = orthographicViewToolStripMenuItem.Checked;
|
||||
ActiveViewport.ResetCamera();
|
||||
ActiveViewport.UpdateViewport();
|
||||
}
|
||||
|
@ -985,7 +1006,7 @@ namespace LayoutBXLYT
|
|||
{
|
||||
if (GamePreviewWindow == null || GamePreviewWindow.Disposing || GamePreviewWindow.IsDisposed)
|
||||
{
|
||||
GamePreviewWindow = new LayoutViewer(this,ActiveLayout, Textures);
|
||||
GamePreviewWindow = new LayoutViewer(this, ActiveLayout, Textures);
|
||||
GamePreviewWindow.GameWindow = true;
|
||||
GamePreviewWindow.Dock = DockStyle.Fill;
|
||||
STForm form = new STForm();
|
||||
|
@ -1139,7 +1160,7 @@ namespace LayoutBXLYT
|
|||
public void AddNewPastedPane(BasePane pane)
|
||||
{
|
||||
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 (name.Contains($"_{numberedEnd}"))
|
||||
name = name.Replace($"_{numberedEnd}", string.Empty);
|
||||
|
@ -1212,5 +1233,70 @@ namespace LayoutBXLYT
|
|||
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