mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-27 22:00:23 -04:00
add OpenFolderDialog
This commit is contained in:
parent
96b8732d91
commit
2a7d40616d
237
Unity Studio/OpenFolderDialog.cs
Normal file
237
Unity Studio/OpenFolderDialog.cs
Normal file
@ -0,0 +1,237 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Unity_Studio
|
||||
{
|
||||
class OpenFolderDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets/sets folder in which dialog will be open.
|
||||
/// </summary>
|
||||
public string InitialFolder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets directory in which dialog will be open if there is no recent directory available.
|
||||
/// </summary>
|
||||
public string DefaultFolder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets selected folder.
|
||||
/// </summary>
|
||||
public string Folder { get; private set; }
|
||||
|
||||
|
||||
internal DialogResult ShowDialog(IWin32Window owner)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major >= 6)
|
||||
{
|
||||
return ShowVistaDialog(owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ShowLegacyDialog(owner);
|
||||
}
|
||||
}
|
||||
|
||||
private DialogResult ShowVistaDialog(IWin32Window owner)
|
||||
{
|
||||
var frm = (NativeMethods.IFileDialog)(new NativeMethods.FileOpenDialogRCW());
|
||||
uint options;
|
||||
frm.GetOptions(out options);
|
||||
options |= NativeMethods.FOS_PICKFOLDERS | NativeMethods.FOS_FORCEFILESYSTEM | NativeMethods.FOS_NOVALIDATE | NativeMethods.FOS_NOTESTFILECREATE | NativeMethods.FOS_DONTADDTORECENT;
|
||||
frm.SetOptions(options);
|
||||
if (this.InitialFolder != null)
|
||||
{
|
||||
NativeMethods.IShellItem directoryShellItem;
|
||||
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
|
||||
if (NativeMethods.SHCreateItemFromParsingName(this.InitialFolder, IntPtr.Zero, ref riid, out directoryShellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
frm.SetFolder(directoryShellItem);
|
||||
}
|
||||
}
|
||||
if (this.DefaultFolder != null)
|
||||
{
|
||||
NativeMethods.IShellItem directoryShellItem;
|
||||
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
|
||||
if (NativeMethods.SHCreateItemFromParsingName(this.DefaultFolder, IntPtr.Zero, ref riid, out directoryShellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
frm.SetDefaultFolder(directoryShellItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (frm.Show(owner.Handle) == NativeMethods.S_OK)
|
||||
{
|
||||
NativeMethods.IShellItem shellItem;
|
||||
if (frm.GetResult(out shellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
IntPtr pszString;
|
||||
if (shellItem.GetDisplayName(NativeMethods.SIGDN_FILESYSPATH, out pszString) == NativeMethods.S_OK)
|
||||
{
|
||||
if (pszString != IntPtr.Zero)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Folder = Marshal.PtrToStringAuto(pszString);
|
||||
return DialogResult.OK;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeCoTaskMem(pszString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private DialogResult ShowLegacyDialog(IWin32Window owner)
|
||||
{
|
||||
using (var frm = new FolderBrowserDialog())
|
||||
{
|
||||
if (this.InitialFolder != null) { frm.SelectedPath = this.InitialFolder; }
|
||||
if (frm.ShowDialog(owner) == DialogResult.OK)
|
||||
{
|
||||
this.Folder = Path.GetDirectoryName(frm.SelectedPath);
|
||||
return DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static class NativeMethods
|
||||
{
|
||||
|
||||
#region Constants
|
||||
|
||||
public const uint FOS_PICKFOLDERS = 0x00000020;
|
||||
public const uint FOS_FORCEFILESYSTEM = 0x00000040;
|
||||
public const uint FOS_NOVALIDATE = 0x00000100;
|
||||
public const uint FOS_NOTESTFILECREATE = 0x00010000;
|
||||
public const uint FOS_DONTADDTORECENT = 0x02000000;
|
||||
|
||||
public const uint S_OK = 0x0000;
|
||||
|
||||
public const uint SIGDN_FILESYSPATH = 0x80058000;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region COM
|
||||
|
||||
[ComImport, ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate), Guid("DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7")]
|
||||
internal class FileOpenDialogRCW { }
|
||||
|
||||
|
||||
[ComImport(), Guid("42F85136-DB7E-439C-85F1-E4075D135FC8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IFileDialog
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[PreserveSig()]
|
||||
uint Show([In, Optional] IntPtr hwndOwner); //IModalWindow
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr rgFilterSpec);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileTypeIndex([In] uint iFileType);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetFileTypeIndex(out uint piFileType);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Advise([In, MarshalAs(UnmanagedType.Interface)] IntPtr pfde, out uint pdwCookie);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Unadvise([In] uint dwCookie);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetOptions([In] uint fos);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetOptions(out uint fos);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, uint fdap);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Close([MarshalAs(UnmanagedType.Error)] uint hr);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetClientGuid([In] ref Guid guid);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint ClearClientData();
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
|
||||
}
|
||||
|
||||
|
||||
[ComImport, Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IShellItem
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint BindToHandler([In] IntPtr pbc, [In] ref Guid rbhid, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IntPtr ppvOut);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetDisplayName([In] uint sigdnName, out IntPtr ppszName);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
uint Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, [In] uint hint, out int piOrder);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
internal static extern int SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IntPtr pbc, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
|
||||
}
|
||||
}
|
@ -130,6 +130,7 @@
|
||||
<Compile Include="7zip\SevenZipHelper.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OpenFolderDialog.cs" />
|
||||
<Compile Include="Resource1.Designer.cs">
|
||||
<DependentUpon>Resource1.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
|
@ -130,6 +130,7 @@
|
||||
<Compile Include="7zip\SevenZipHelper.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OpenFolderDialog.cs" />
|
||||
<Compile Include="Resource1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
23
Unity Studio/UnityStudioForm.Designer.cs
generated
23
Unity Studio/UnityStudioForm.Designer.cs
generated
@ -99,9 +99,7 @@
|
||||
this.timer = new System.Windows.Forms.Timer(this.components);
|
||||
this.timerOpenTK = new System.Windows.Forms.Timer(this.components);
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.openFolderDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.treeTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -818,28 +816,11 @@
|
||||
this.openFileDialog1.Multiselect = true;
|
||||
this.openFileDialog1.RestoreDirectory = true;
|
||||
//
|
||||
// openFolderDialog1
|
||||
//
|
||||
this.openFolderDialog1.AddExtension = false;
|
||||
this.openFolderDialog1.CheckFileExists = false;
|
||||
this.openFolderDialog1.FileName = "Select folder";
|
||||
this.openFolderDialog1.Filter = "Folders|*.";
|
||||
this.openFolderDialog1.RestoreDirectory = true;
|
||||
this.openFolderDialog1.Title = "Browse for folder";
|
||||
//
|
||||
// saveFileDialog1
|
||||
//
|
||||
this.saveFileDialog1.Filter = "FBX file|*.fbx|Collada|*.dae";
|
||||
this.saveFileDialog1.Filter = "FBX file|*.fbx";
|
||||
this.saveFileDialog1.RestoreDirectory = true;
|
||||
//
|
||||
// saveFolderDialog1
|
||||
//
|
||||
this.saveFolderDialog1.AddExtension = false;
|
||||
this.saveFolderDialog1.FileName = "Select folder or write folder name to create";
|
||||
this.saveFolderDialog1.Filter = "Folders|*.";
|
||||
this.saveFolderDialog1.RestoreDirectory = true;
|
||||
this.saveFolderDialog1.Title = "Browse for folder";
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
@ -953,9 +934,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem exportAll3DMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportSelected3DMenuItem;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
private System.Windows.Forms.OpenFileDialog openFolderDialog1;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
||||
private System.Windows.Forms.SaveFileDialog saveFolderDialog1;
|
||||
private System.Windows.Forms.ToolStripComboBox assetGroupOptions;
|
||||
private System.Windows.Forms.ToolStripMenuItem openAfterExport;
|
||||
private System.Windows.Forms.ToolStripMenuItem showExpOpt;
|
||||
|
@ -127,84 +127,70 @@ namespace Unity_Studio
|
||||
|
||||
private void loadFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
/*FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
|
||||
|
||||
folderBrowserDialog1.Description = "Load all Unity assets from folder and subfolders";
|
||||
folderBrowserDialog1.ShowNewFolderButton = false;
|
||||
//folderBrowserDialog1.SelectedPath = "E:\\Assets\\Unity";
|
||||
folderBrowserDialog1.SelectedPath = "E:\\Assets\\Unity\\WebPlayer\\Porsche\\92AAF1\\defaultGeometry";*/
|
||||
|
||||
if (openFolderDialog1.ShowDialog() == DialogResult.OK)
|
||||
var openFolderDialog1 = new OpenFolderDialog();
|
||||
if (openFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
//mainPath = folderBrowserDialog1.SelectedPath;
|
||||
mainPath = openFolderDialog1.FileName;
|
||||
if (Path.GetFileName(mainPath) == "Select folder")
|
||||
{ mainPath = Path.GetDirectoryName(mainPath); }
|
||||
mainPath = openFolderDialog1.Folder;
|
||||
resetForm();
|
||||
|
||||
if (Directory.Exists(mainPath))
|
||||
//TODO find a way to read data directly instead of merging files
|
||||
MergeSplitAssets(mainPath);
|
||||
|
||||
for (int t = 0; t < fileTypes.Length; t++)
|
||||
{
|
||||
resetForm();
|
||||
|
||||
//TODO find a way to read data directly instead of merging files
|
||||
MergeSplitAssets(mainPath);
|
||||
|
||||
for (int t = 0; t < fileTypes.Length; t++)
|
||||
string[] fileNames = Directory.GetFiles(mainPath, fileTypes[t], SearchOption.AllDirectories);
|
||||
#region sort specific types alphanumerically
|
||||
if (fileNames.Length > 0 && (t == 1 || t == 2))
|
||||
{
|
||||
string[] fileNames = Directory.GetFiles(mainPath, fileTypes[t], SearchOption.AllDirectories);
|
||||
#region sort specific types alphanumerically
|
||||
if (fileNames.Length > 0 && (t == 1 || t == 2))
|
||||
var sortedList = fileNames.ToList();
|
||||
sortedList.Sort((s1, s2) =>
|
||||
{
|
||||
var sortedList = fileNames.ToList();
|
||||
sortedList.Sort((s1, s2) =>
|
||||
{
|
||||
string pattern = "([A-Za-z\\s]*)([0-9]*)";
|
||||
string h1 = Regex.Match(Path.GetFileNameWithoutExtension(s1), pattern).Groups[1].Value;
|
||||
string h2 = Regex.Match(Path.GetFileNameWithoutExtension(s2), pattern).Groups[1].Value;
|
||||
if (h1 != h2)
|
||||
return h1.CompareTo(h2);
|
||||
string t1 = Regex.Match(Path.GetFileNameWithoutExtension(s1), pattern).Groups[2].Value;
|
||||
string t2 = Regex.Match(Path.GetFileNameWithoutExtension(s2), pattern).Groups[2].Value;
|
||||
if (t1 != "" && t2 != "")
|
||||
return int.Parse(t1).CompareTo(int.Parse(t2));
|
||||
return 0;
|
||||
});
|
||||
foreach (var i in sortedList)
|
||||
{
|
||||
unityFiles.Add(i);
|
||||
unityFilesHash.Add(Path.GetFileName(i));
|
||||
}
|
||||
|
||||
string pattern = "([A-Za-z\\s]*)([0-9]*)";
|
||||
string h1 = Regex.Match(Path.GetFileNameWithoutExtension(s1), pattern).Groups[1].Value;
|
||||
string h2 = Regex.Match(Path.GetFileNameWithoutExtension(s2), pattern).Groups[1].Value;
|
||||
if (h1 != h2)
|
||||
return h1.CompareTo(h2);
|
||||
string t1 = Regex.Match(Path.GetFileNameWithoutExtension(s1), pattern).Groups[2].Value;
|
||||
string t2 = Regex.Match(Path.GetFileNameWithoutExtension(s2), pattern).Groups[2].Value;
|
||||
if (t1 != "" && t2 != "")
|
||||
return int.Parse(t1).CompareTo(int.Parse(t2));
|
||||
return 0;
|
||||
});
|
||||
foreach (var i in sortedList)
|
||||
{
|
||||
unityFiles.Add(i);
|
||||
unityFilesHash.Add(Path.GetFileName(i));
|
||||
}
|
||||
#endregion
|
||||
else
|
||||
|
||||
}
|
||||
#endregion
|
||||
else
|
||||
{
|
||||
foreach (var i in fileNames)
|
||||
{
|
||||
foreach (var i in fileNames)
|
||||
{
|
||||
unityFiles.Add(i);
|
||||
unityFilesHash.Add(Path.GetFileName(i));
|
||||
}
|
||||
unityFiles.Add(i);
|
||||
unityFilesHash.Add(Path.GetFileName(i));
|
||||
}
|
||||
}
|
||||
|
||||
unityFiles = unityFiles.Distinct().ToList();
|
||||
progressBar1.Value = 0;
|
||||
progressBar1.Maximum = unityFiles.Count;
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
//use a for loop because list size can change
|
||||
for (int f = 0; f < unityFiles.Count; f++)
|
||||
{
|
||||
var fileName = unityFiles[f];
|
||||
StatusStripUpdate("Loading " + Path.GetFileName(fileName));
|
||||
LoadAssetsFile(fileName);
|
||||
ProgressBarPerformStep();
|
||||
}
|
||||
unityFilesHash.Clear();
|
||||
assetsfileListHash.Clear();
|
||||
BuildAssetStrucutres();
|
||||
});
|
||||
}
|
||||
else { StatusStripUpdate("Selected path deos not exist."); }
|
||||
|
||||
unityFiles = unityFiles.Distinct().ToList();
|
||||
progressBar1.Value = 0;
|
||||
progressBar1.Maximum = unityFiles.Count;
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
//use a for loop because list size can change
|
||||
for (int f = 0; f < unityFiles.Count; f++)
|
||||
{
|
||||
var fileName = unityFiles[f];
|
||||
StatusStripUpdate("Loading " + Path.GetFileName(fileName));
|
||||
LoadAssetsFile(fileName);
|
||||
ProgressBarPerformStep();
|
||||
}
|
||||
unityFilesHash.Clear();
|
||||
assetsfileListHash.Clear();
|
||||
BuildAssetStrucutres();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,16 +224,10 @@ namespace Unity_Studio
|
||||
int extractedCount = 0;
|
||||
List<string> bundleFiles = new List<string>();
|
||||
|
||||
/*FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
|
||||
folderBrowserDialog1.Description = "Extract all Unity bundles from folder and subfolders";
|
||||
folderBrowserDialog1.ShowNewFolderButton = false;*/
|
||||
|
||||
if (openFolderDialog1.ShowDialog() == DialogResult.OK)
|
||||
var openFolderDialog1 = new OpenFolderDialog();
|
||||
if (openFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
string startPath = openFolderDialog1.FileName;
|
||||
if (Path.GetFileName(startPath) == "Select folder")
|
||||
{ startPath = Path.GetDirectoryName(startPath); }
|
||||
|
||||
string startPath = openFolderDialog1.Folder;
|
||||
string[] fileTypes = new string[6] { "*.unity3d", "*.unity3d.lz4", "*.assetbundle", "*.assetbundle-*", "*.bundle", "*.bytes" };
|
||||
foreach (var fileType in fileTypes)
|
||||
{
|
||||
@ -317,7 +297,6 @@ namespace Unity_Studio
|
||||
}
|
||||
StatusStripUpdate("Finished loading " + assetsfileList.Count + " files with " + (assetListView.Items.Count + sceneTreeView.Nodes.Count) + " exportable assets.");
|
||||
treeSearch.Select();
|
||||
saveFolderDialog1.InitialDirectory = mainPath;
|
||||
}));
|
||||
}
|
||||
|
||||
@ -445,15 +424,13 @@ namespace Unity_Studio
|
||||
{
|
||||
if (AllClassStructures.Count > 0)
|
||||
{
|
||||
if (saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
||||
var saveFolderDialog1 = new OpenFolderDialog();
|
||||
if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
progressBar1.Value = 0;
|
||||
progressBar1.Maximum = AllClassStructures.Count;
|
||||
|
||||
var savePath = saveFolderDialog1.FileName;
|
||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
||||
|
||||
var savePath = saveFolderDialog1.Folder;
|
||||
foreach (var version in AllClassStructures)
|
||||
{
|
||||
if (version.Value.Count > 0)
|
||||
@ -1067,12 +1044,12 @@ namespace Unity_Studio
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
normal2Data[indiceData[i + j]] += normal;
|
||||
normalCalculatedCount[indiceData[i + j]] ++;
|
||||
normalCalculatedCount[indiceData[i + j]]++;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_Mesh.m_VertexCount; i++)
|
||||
{
|
||||
if(normalCalculatedCount[i] == 0)
|
||||
if (normalCalculatedCount[i] == 0)
|
||||
normal2Data[i] = new Vector3(0, 1, 0);
|
||||
else
|
||||
normal2Data[i] /= normalCalculatedCount[i];
|
||||
@ -1444,11 +1421,10 @@ namespace Unity_Studio
|
||||
{
|
||||
if (sceneTreeView.Nodes.Count > 0)
|
||||
{
|
||||
if (saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
||||
var saveFolderDialog1 = new OpenFolderDialog();
|
||||
if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
var savePath = saveFolderDialog1.FileName;
|
||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
||||
var savePath = saveFolderDialog1.Folder;
|
||||
savePath = savePath + "\\";
|
||||
switch ((bool)Properties.Settings.Default["showExpOpt"])
|
||||
{
|
||||
@ -1547,7 +1523,8 @@ namespace Unity_Studio
|
||||
|
||||
private void ExportAssets_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (exportableAssets.Count > 0 && saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
||||
var saveFolderDialog1 = new OpenFolderDialog();
|
||||
if (exportableAssets.Count > 0 && saveFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
timer.Stop();
|
||||
List<AssetPreloadData> toExportAssets = null;
|
||||
@ -1572,9 +1549,7 @@ namespace Unity_Studio
|
||||
ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
|
||||
var savePath = saveFolderDialog1.FileName;
|
||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
||||
var savePath = saveFolderDialog1.Folder;
|
||||
|
||||
int toExport = toExportAssets.Count;
|
||||
int exportedCount = 0;
|
||||
@ -1789,7 +1764,7 @@ namespace Unity_Studio
|
||||
loadShader("vs", ShaderType.VertexShader, pgmBlackID, out vsID);
|
||||
loadShader("fsBlack", ShaderType.FragmentShader, pgmBlackID, out fsID);
|
||||
GL.LinkProgram(pgmBlackID);
|
||||
|
||||
|
||||
attributeVertexPosition = GL.GetAttribLocation(pgmID, "vertexPosition");
|
||||
attributeNormalDirection = GL.GetAttribLocation(pgmID, "normalDirection");
|
||||
attributeVertexColor = GL.GetAttribLocation(pgmColorID, "vertexColor");
|
||||
|
@ -117,10 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>325, 17</value>
|
||||
</data>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>312, 17</value>
|
||||
</metadata>
|
||||
<data name="fontPreviewBox.Text" xml:space="preserve">
|
||||
<value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ
|
||||
1234567890.:,;'\"(!?)+-*/=
|
||||
@ -139,32 +138,31 @@ The quick brown fox jumps over the lazy dog. 1234567890
|
||||
|
||||
The quick brown fox jumps over the lazy dog. 1234567890</value>
|
||||
</data>
|
||||
<data name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>440, 17</value>
|
||||
</data>
|
||||
<data name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>556, 17</value>
|
||||
</data>
|
||||
<data name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>432, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>553, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timerOpenTK.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>636, 17</value>
|
||||
</data>
|
||||
</metadata>
|
||||
<data name="openFileDialog1.Filter" xml:space="preserve">
|
||||
<value>Unity asset files|*.*|Unity bundle files|*.*|Unity asset files|level*; globalgamemanagers; mainData; CustomAssetBundle-*; CAB-*; BuildPlayer-*; *.assets; *.sharedAssets|Unity bundle files|*.unity3d; *.unity3d.lz4; *.assetbundle; *.bundle; *.bytes</value>
|
||||
</data>
|
||||
<data name="openFolderDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>169, 17</value>
|
||||
</data>
|
||||
<data name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>776, 17</value>
|
||||
</data>
|
||||
<data name="saveFolderDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>17, 17</value>
|
||||
</data>
|
||||
<data name="treeTip.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||
<value>912, 17</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib">
|
||||
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>784, 17</value>
|
||||
</metadata>
|
||||
<metadata name="treeTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>928, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>147, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>67</value>
|
||||
</data>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user