1
0
mirror of synced 2024-11-30 18:24:39 +01:00

Fix UV editor if no textures are present

This commit is contained in:
KillzXGaming 2019-08-20 17:22:01 -04:00
parent 957639f80d
commit 2bed8a49a6
9 changed files with 44 additions and 5 deletions

Binary file not shown.

View File

@ -14,8 +14,8 @@ namespace DKCTF
public FileType FileType { get; set; } = FileType.Layout;
public bool CanSave { get; set; }
public string[] Description { get; set; } = new string[] { "Cafe Layout Animation (GUI)" };
public string[] Extension { get; set; } = new string[] { "*.bflan" };
public string[] Description { get; set; } = new string[] { "DKCTF Archive" };
public string[] Extension { get; set; } = new string[] { "*.pak" };
public string FileName { get; set; }
public string FilePath { get; set; }
public IFileInfo IFileInfo { get; set; }

View File

@ -298,6 +298,11 @@ namespace Toolbox.Library.Forms
ClearNodes();
}
private void GetArchiveMenus(TreeNode node, ArchiveFileInfo info)
{
}
private void treeViewCustom1_MouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Button == MouseButtons.Right)
@ -307,6 +312,14 @@ namespace Toolbox.Library.Forms
bool IsRoot = e.Node.Parent == null;
treeNodeContextMenu.Items.Clear();
if (e.Node.Tag != null && e.Node.Tag is ArchiveFileInfo)
{
//The tag gets set when an archive is replaced by a treenode
//Todo store this in a better place as devs could possiblly replace this
//Create menus when an archive node is replaced
GetArchiveMenus(e.Node, (ArchiveFileInfo)e.Node.Tag);
}
if (IsRoot)
{
foreach (var item in ((IContextMenuNode)e.Node).GetContextMenuItems())

View File

@ -519,6 +519,7 @@ namespace Toolbox.Library.Forms
}
}
if (textureCB.Items.Count > 0)
textureCB.SelectedIndex = 0;
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Toolbox.Library.Forms;
using System.Windows.Forms;
namespace Toolbox.Library
{
public class ArchiveNodeMenuHelper
{
private ArchiveFileInfo FileInfo;
private TreeNode Node;
private void RenameAction(object sender, EventArgs args)
{
RenameDialog dialog = new RenameDialog();
dialog.SetString(Node.Text);
if (dialog.ShowDialog() == DialogResult.OK) { Node.Text = dialog.textBox1.Text; }
}
}
}

View File

@ -36,6 +36,7 @@ namespace Toolbox.Library
bool AddFile(ArchiveFileInfo archiveFileInfo);
bool DeleteFile(ArchiveFileInfo archiveFileInfo);
}
public class ArchiveFileInfo : INode
{
// Opens the file format automatically (may take longer to open the archive file)
@ -909,8 +910,6 @@ namespace Toolbox.Library
}
ArchiveFileInfo.FileFormat = file;
Console.WriteLine("replacedFileFormat ");
}
private void OpenFormDialog(IFileFormat fileFormat)
@ -994,6 +993,7 @@ namespace Toolbox.Library
NewNode.ImageKey = replaceNode.ImageKey;
NewNode.SelectedImageKey = replaceNode.SelectedImageKey;
NewNode.Text = replaceNode.Text;
NewNode.Tag = fileInfo;
rootNode.FileNodes.RemoveAt(index);
rootNode.FileNodes.Insert(index, Tuple.Create(fileInfo, NewNode));

View File

@ -284,6 +284,7 @@
</Compile>
<Compile Include="Generics\Texture\ImageParameters.cs" />
<Compile Include="Generics\Texture\STTextureFolder.cs" />
<Compile Include="Helpers\ArchiveNodeMenuHelper.cs" />
<Compile Include="Helpers\DragHelper.cs" />
<Compile Include="Interfaces\FileFormatting\ILeaveOpenOnLoad.cs" />
<Compile Include="Interfaces\FileFormatting\IPropertyContainer.cs" />