mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
parent
db92daedf0
commit
647ce56f81
@ -39,24 +39,21 @@ namespace Unity_Studio
|
||||
private DialogResult ShowVistaDialog(IWin32Window owner)
|
||||
{
|
||||
var frm = (NativeMethods.IFileDialog)(new NativeMethods.FileOpenDialogRCW());
|
||||
uint options;
|
||||
frm.GetOptions(out options);
|
||||
frm.GetOptions(out var 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)
|
||||
if (NativeMethods.SHCreateItemFromParsingName(this.InitialFolder, IntPtr.Zero, ref riid, out var 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)
|
||||
if (NativeMethods.SHCreateItemFromParsingName(this.DefaultFolder, IntPtr.Zero, ref riid, out var directoryShellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
frm.SetDefaultFolder(directoryShellItem);
|
||||
}
|
||||
@ -64,11 +61,9 @@ namespace Unity_Studio
|
||||
|
||||
if (frm.Show(owner.Handle) == NativeMethods.S_OK)
|
||||
{
|
||||
NativeMethods.IShellItem shellItem;
|
||||
if (frm.GetResult(out shellItem) == NativeMethods.S_OK)
|
||||
if (frm.GetResult(out var shellItem) == NativeMethods.S_OK)
|
||||
{
|
||||
IntPtr pszString;
|
||||
if (shellItem.GetDisplayName(NativeMethods.SIGDN_FILESYSPATH, out pszString) == NativeMethods.S_OK)
|
||||
if (shellItem.GetDisplayName(NativeMethods.SIGDN_FILESYSPATH, out var pszString) == NativeMethods.S_OK)
|
||||
{
|
||||
if (pszString != IntPtr.Zero)
|
||||
{
|
||||
|
@ -112,8 +112,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else
|
||||
{
|
||||
EndianBinaryReader estream;
|
||||
if (UnityStudio.assetsfileandstream.TryGetValue(Path.GetFileName(m_Source), out estream))
|
||||
if (UnityStudio.assetsfileandstream.TryGetValue(Path.GetFileName(m_Source), out var estream))
|
||||
{
|
||||
estream.Position = m_Offset;
|
||||
m_AudioData = estream.ReadBytes((int)m_Size);
|
||||
|
@ -42,7 +42,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else if (sourceFile.version[0] >= 5)//5.0 and up
|
||||
{
|
||||
m_ShaderKeywords = new string[1] { a_Stream.ReadAlignedString(a_Stream.ReadInt32()) };
|
||||
m_ShaderKeywords = new[] { a_Stream.ReadAlignedString(a_Stream.ReadInt32()) };
|
||||
uint m_LightmapFlags = a_Stream.ReadUInt32();
|
||||
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 6 || sourceFile.version[0] > 5)//5.6.0 and up
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace Unity_Studio
|
||||
string[][] stringTagMap = new string[a_Stream.ReadInt32()][];
|
||||
for (int i = 0; i < stringTagMap.Length; i++)
|
||||
{
|
||||
stringTagMap[i] = new string[2] { a_Stream.ReadAlignedString(a_Stream.ReadInt32()), a_Stream.ReadAlignedString(a_Stream.ReadInt32()) };
|
||||
stringTagMap[i] = new[] { a_Stream.ReadAlignedString(a_Stream.ReadInt32()), a_Stream.ReadAlignedString(a_Stream.ReadInt32()) };
|
||||
}
|
||||
}
|
||||
//disabledShaderPasses
|
||||
@ -79,8 +79,8 @@ namespace Unity_Studio
|
||||
{
|
||||
name = a_Stream.ReadAlignedString(a_Stream.ReadInt32()),
|
||||
m_Texture = sourceFile.ReadPPtr(),
|
||||
m_Scale = new float[2] { a_Stream.ReadSingle(), a_Stream.ReadSingle() },
|
||||
m_Offset = new float[2] { a_Stream.ReadSingle(), a_Stream.ReadSingle() }
|
||||
m_Scale = new[] { a_Stream.ReadSingle(), a_Stream.ReadSingle() },
|
||||
m_Offset = new[] { a_Stream.ReadSingle(), a_Stream.ReadSingle() }
|
||||
};
|
||||
m_TexEnvs[i] = m_TexEnv;
|
||||
}
|
||||
@ -102,7 +102,7 @@ namespace Unity_Studio
|
||||
strColorPair m_Color = new strColorPair()
|
||||
{
|
||||
first = a_Stream.ReadAlignedString(a_Stream.ReadInt32()),
|
||||
second = new float[4] { a_Stream.ReadSingle(), a_Stream.ReadSingle(), a_Stream.ReadSingle(), a_Stream.ReadSingle() }
|
||||
second = new[] { a_Stream.ReadSingle(), a_Stream.ReadSingle(), a_Stream.ReadSingle(), a_Stream.ReadSingle() }
|
||||
};
|
||||
m_Colors[i] = m_Color;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -186,8 +186,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else
|
||||
{
|
||||
EndianBinaryReader estream;
|
||||
if (UnityStudio.assetsfileandstream.TryGetValue(Path.GetFileName(path), out estream))
|
||||
if (UnityStudio.assetsfileandstream.TryGetValue(Path.GetFileName(path), out var estream))
|
||||
{
|
||||
estream.Position = offset;
|
||||
image_data = estream.ReadBytes(image_data_size);
|
||||
|
@ -85,8 +85,7 @@ namespace Unity_Studio
|
||||
{
|
||||
preloadData.extension = Path.GetExtension(m_OriginalPath);
|
||||
preloadData.Text = m_Name;
|
||||
if (m_Source != null)
|
||||
preloadData.fullSize = preloadData.Size + (int)m_Size;
|
||||
preloadData.fullSize = preloadData.Size + (int)m_Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Unity_Studio
|
||||
public int fileGen;
|
||||
public bool valid;
|
||||
public string m_Version = "2.5.0f5";
|
||||
public int[] version = new int[4] { 0, 0, 0, 0 };
|
||||
public int[] version = { 0, 0, 0, 0 };
|
||||
public string[] buildType;
|
||||
public int platform = 100663296;
|
||||
public string platformStr = "";
|
||||
@ -313,14 +313,7 @@ namespace Unity_Studio
|
||||
}
|
||||
|
||||
AssetPreloadData asset = new AssetPreloadData();
|
||||
if (fileGen < 14)
|
||||
{
|
||||
asset.m_PathID = a_Stream.ReadInt32();
|
||||
}
|
||||
else
|
||||
{
|
||||
asset.m_PathID = a_Stream.ReadInt64();
|
||||
}
|
||||
asset.m_PathID = fileGen < 14 ? a_Stream.ReadInt32() : a_Stream.ReadInt64();
|
||||
asset.Offset = a_Stream.ReadUInt32();
|
||||
asset.Offset += dataOffset;
|
||||
asset.Size = a_Stream.ReadInt32();
|
||||
@ -344,8 +337,7 @@ namespace Unity_Studio
|
||||
//but not the last!
|
||||
}
|
||||
|
||||
string typeString;
|
||||
if (ClassIDReference.Names.TryGetValue(asset.Type2, out typeString))
|
||||
if (ClassIDReference.Names.TryGetValue(asset.Type2, out var typeString))
|
||||
{
|
||||
asset.TypeString = typeString;
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ namespace Unity_Studio
|
||||
{
|
||||
var a_Stream = asset.sourceFile.a_Stream;
|
||||
a_Stream.Position = asset.Offset;
|
||||
ClassStruct classStructure;
|
||||
if (asset.sourceFile.ClassStructures.TryGetValue(asset.Type1, out classStructure))
|
||||
if (asset.sourceFile.ClassStructures.TryGetValue(asset.Type1, out var classStructure))
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
ReadClassStruct(sb, classStructure.members, a_Stream);
|
||||
|
@ -25,8 +25,7 @@ namespace Unity_Studio
|
||||
if (FileID >= 0 && FileID < sourceFile.sharedAssetsList.Count)
|
||||
{ result.m_FileID = sourceFile.sharedAssetsList[FileID].Index; }
|
||||
|
||||
if (sourceFile.fileGen < 14) { result.m_PathID = a_Stream.ReadInt32(); }
|
||||
else { result.m_PathID = a_Stream.ReadInt64(); }
|
||||
result.m_PathID = sourceFile.fileGen < 14 ? a_Stream.ReadInt32() : a_Stream.ReadInt64();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -81,8 +80,7 @@ namespace Unity_Studio
|
||||
if (m_Component.m_FileID >= 0 && m_Component.m_FileID < assetsfileList.Count)
|
||||
{
|
||||
AssetsFile sourceFile = assetsfileList[m_Component.m_FileID];
|
||||
AssetPreloadData asset;
|
||||
if (sourceFile.preloadTable.TryGetValue(m_Component.m_PathID, out asset))
|
||||
if (sourceFile.preloadTable.TryGetValue(m_Component.m_PathID, out var asset))
|
||||
{
|
||||
switch (asset.Type2)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ namespace Unity_Studio
|
||||
{
|
||||
int extractedCount = 0;
|
||||
|
||||
StatusStripUpdate("Decompressing " + Path.GetFileName(bundleFileName) + " ...");
|
||||
StatusStripUpdate($"Decompressing {Path.GetFileName(bundleFileName)} ...");
|
||||
|
||||
string extractPath = bundleFileName + "_unpacked\\";
|
||||
Directory.CreateDirectory(extractPath);
|
||||
@ -180,7 +180,7 @@ namespace Unity_Studio
|
||||
}
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
StatusStripUpdate("Extracting " + Path.GetFileName(memFile.fileName));
|
||||
StatusStripUpdate($"Extracting {Path.GetFileName(memFile.fileName)}");
|
||||
extractedCount += 1;
|
||||
|
||||
using (FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write))
|
||||
@ -385,11 +385,9 @@ namespace Unity_Studio
|
||||
|
||||
var parentNode = fileNode;
|
||||
|
||||
Transform m_Transform;
|
||||
if (assetsfileList.TryGetTransform(m_GameObject.m_Transform, out m_Transform))
|
||||
if (assetsfileList.TryGetTransform(m_GameObject.m_Transform, out var m_Transform))
|
||||
{
|
||||
Transform m_Father;
|
||||
if (assetsfileList.TryGetTransform(m_Transform.m_Father, out m_Father))
|
||||
if (assetsfileList.TryGetTransform(m_Transform.m_Father, out var m_Father))
|
||||
{
|
||||
//GameObject Parent;
|
||||
if (assetsfileList.TryGetGameObject(m_Father.m_GameObject, out parentNode))
|
||||
@ -413,7 +411,7 @@ namespace Unity_Studio
|
||||
|
||||
if (File.Exists(mainPath + "\\materials.json"))
|
||||
{
|
||||
string matLine = "";
|
||||
string matLine;
|
||||
using (StreamReader reader = File.OpenText(mainPath + "\\materials.json"))
|
||||
{ matLine = reader.ReadToEnd(); }
|
||||
|
||||
@ -429,8 +427,7 @@ namespace Unity_Studio
|
||||
//group class structures by versionv
|
||||
foreach (var assetsFile in assetsfileList)
|
||||
{
|
||||
SortedDictionary<int, ClassStruct> curVer;
|
||||
if (AllClassStructures.TryGetValue(assetsFile.m_Version, out curVer))
|
||||
if (AllClassStructures.TryGetValue(assetsFile.m_Version, out var curVer))
|
||||
{
|
||||
foreach (var uClass in assetsFile.ClassStructures)
|
||||
{
|
||||
@ -491,14 +488,12 @@ namespace Unity_Studio
|
||||
{
|
||||
GameObjects.Add(m_GameObject);
|
||||
|
||||
AssetPreloadData MeshFilterPD;
|
||||
if (assetsfileList.TryGetPD(m_GameObject.m_MeshFilter, out MeshFilterPD))
|
||||
if (assetsfileList.TryGetPD(m_GameObject.m_MeshFilter, out var MeshFilterPD))
|
||||
{
|
||||
//MeshFilters are not unique!
|
||||
//MeshFilters.Add(MeshFilterPD);
|
||||
MeshFilter m_MeshFilter = new MeshFilter(MeshFilterPD);
|
||||
AssetPreloadData MeshPD;
|
||||
if (assetsfileList.TryGetPD(m_MeshFilter.m_Mesh, out MeshPD))
|
||||
if (assetsfileList.TryGetPD(m_MeshFilter.m_Mesh, out var MeshPD))
|
||||
{
|
||||
Meshes.Add(MeshPD);
|
||||
|
||||
@ -510,15 +505,13 @@ namespace Unity_Studio
|
||||
}
|
||||
|
||||
#region get Renderer
|
||||
AssetPreloadData RendererPD;
|
||||
if (assetsfileList.TryGetPD(m_GameObject.m_MeshRenderer, out RendererPD))
|
||||
if (assetsfileList.TryGetPD(m_GameObject.m_MeshRenderer, out var RendererPD))
|
||||
{
|
||||
MeshRenderer m_Renderer = new MeshRenderer(RendererPD);
|
||||
|
||||
foreach (var MaterialPPtr in m_Renderer.m_Materials)
|
||||
{
|
||||
AssetPreloadData MaterialPD;
|
||||
if (assetsfileList.TryGetPD(MaterialPPtr, out MaterialPD))
|
||||
if (assetsfileList.TryGetPD(MaterialPPtr, out var MaterialPD))
|
||||
{
|
||||
Materials.Add(MaterialPD);
|
||||
cb2.AppendFormat("\n\n\t;Material::, Model::{0}", m_GameObject.m_Name);
|
||||
@ -526,11 +519,11 @@ namespace Unity_Studio
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region get SkinnedMeshRenderer
|
||||
AssetPreloadData SkinnedMeshPD;
|
||||
if (assetsfileList.TryGetPD(m_GameObject.m_SkinnedMeshRenderer, out SkinnedMeshPD))
|
||||
if (assetsfileList.TryGetPD(m_GameObject.m_SkinnedMeshRenderer, out var SkinnedMeshPD))
|
||||
{
|
||||
Skins.Add(SkinnedMeshPD);
|
||||
|
||||
@ -538,8 +531,7 @@ namespace Unity_Studio
|
||||
|
||||
foreach (var MaterialPPtr in m_SkinnedMeshRenderer.m_Materials)
|
||||
{
|
||||
AssetPreloadData MaterialPD;
|
||||
if (assetsfileList.TryGetPD(MaterialPPtr, out MaterialPD))
|
||||
if (assetsfileList.TryGetPD(MaterialPPtr, out var MaterialPD))
|
||||
{
|
||||
Materials.Add(MaterialPD);
|
||||
cb2.AppendFormat("\n\n\t;Material::, Model::{0}", m_GameObject.m_Name);
|
||||
@ -554,11 +546,9 @@ namespace Unity_Studio
|
||||
//collect skeleton dummies to make sure they are exported
|
||||
foreach (var bonePPtr in m_SkinnedMeshRenderer.m_Bones)
|
||||
{
|
||||
Transform b_Transform;
|
||||
if (assetsfileList.TryGetTransform(bonePPtr, out b_Transform))
|
||||
if (assetsfileList.TryGetTransform(bonePPtr, out var b_Transform))
|
||||
{
|
||||
GameObject m_Bone;
|
||||
if (assetsfileList.TryGetGameObject(b_Transform.m_GameObject, out m_Bone))
|
||||
if (assetsfileList.TryGetGameObject(b_Transform.m_GameObject, out var m_Bone))
|
||||
{
|
||||
LimbNodes.Add(m_Bone);
|
||||
//also collect the root bone
|
||||
@ -569,11 +559,9 @@ namespace Unity_Studio
|
||||
#region collect children because m_SkinnedMeshRenderer.m_Bones doesn't contain terminations
|
||||
foreach (var ChildPPtr in b_Transform.m_Children)
|
||||
{
|
||||
Transform ChildTR;
|
||||
if (assetsfileList.TryGetTransform(ChildPPtr, out ChildTR))
|
||||
if (assetsfileList.TryGetTransform(ChildPPtr, out var ChildTR))
|
||||
{
|
||||
GameObject m_Child;
|
||||
if (assetsfileList.TryGetGameObject(ChildTR.m_GameObject, out m_Child))
|
||||
if (assetsfileList.TryGetGameObject(ChildTR.m_GameObject, out var m_Child))
|
||||
{
|
||||
//check that the Model doesn't contain a Mesh, although this won't ensure it's part of the skeleton
|
||||
if (m_Child.m_MeshFilter == null && m_Child.m_SkinnedMeshRenderer == null)
|
||||
@ -662,15 +650,12 @@ namespace Unity_Studio
|
||||
#region write texture connections
|
||||
foreach (var m_TexEnv in m_Material.m_TexEnvs)
|
||||
{
|
||||
AssetPreloadData TexturePD;
|
||||
#region get Porsche material from json
|
||||
if (!assetsfileList.TryGetPD(m_TexEnv.m_Texture, out TexturePD) && jsonMats != null)
|
||||
if (!assetsfileList.TryGetPD(m_TexEnv.m_Texture, out var TexturePD) && jsonMats != null)
|
||||
{
|
||||
Dictionary<string, string> matProp;
|
||||
if (jsonMats.TryGetValue(m_Material.m_Name, out matProp))
|
||||
if (jsonMats.TryGetValue(m_Material.m_Name, out var matProp))
|
||||
{
|
||||
string texName;
|
||||
if (matProp.TryGetValue(m_TexEnv.name, out texName))
|
||||
if (matProp.TryGetValue(m_TexEnv.name, out var texName))
|
||||
{
|
||||
foreach (var asset in exportableAssets)
|
||||
{
|
||||
@ -872,8 +857,7 @@ namespace Unity_Studio
|
||||
ob.Append("\n\t\t\tP: \"ScalingMax\", \"Vector3D\", \"Vector\", \"\",0,0,0");
|
||||
ob.Append("\n\t\t\tP: \"DefaultAttributeIndex\", \"int\", \"Integer\", \"\",0");
|
||||
|
||||
Transform m_Transform;
|
||||
if (assetsfileList.TryGetTransform(m_GameObject.m_Transform, out m_Transform))
|
||||
if (assetsfileList.TryGetTransform(m_GameObject.m_Transform, out var m_Transform))
|
||||
{
|
||||
float[] m_EulerRotation = QuatToEuler(new[] { m_Transform.m_LocalRotation[0], -m_Transform.m_LocalRotation[1], -m_Transform.m_LocalRotation[2], m_Transform.m_LocalRotation[3] });
|
||||
|
||||
@ -929,10 +913,7 @@ namespace Unity_Studio
|
||||
foreach (var SkinnedMeshPD in Skins)
|
||||
{
|
||||
SkinnedMeshRenderer m_SkinnedMeshRenderer = new SkinnedMeshRenderer(SkinnedMeshPD);
|
||||
|
||||
GameObject m_GameObject;
|
||||
AssetPreloadData MeshPD;
|
||||
if (assetsfileList.TryGetGameObject(m_SkinnedMeshRenderer.m_GameObject, out m_GameObject) && assetsfileList.TryGetPD(m_SkinnedMeshRenderer.m_Mesh, out MeshPD))
|
||||
if (assetsfileList.TryGetGameObject(m_SkinnedMeshRenderer.m_GameObject, out var m_GameObject) && assetsfileList.TryGetPD(m_SkinnedMeshRenderer.m_Mesh, out var MeshPD))
|
||||
{
|
||||
//generate unique Geometry ID for instanced mesh objects
|
||||
//instanced skinned geometry is possible in FBX, but all instances are linked to the same skeleton nodes
|
||||
@ -984,11 +965,9 @@ namespace Unity_Studio
|
||||
|
||||
for (int b = 0; b < m_SkinnedMeshRenderer.m_Bones.Length; b++)
|
||||
{
|
||||
Transform m_Transform;
|
||||
if (assetsfileList.TryGetTransform(m_SkinnedMeshRenderer.m_Bones[b], out m_Transform))
|
||||
if (assetsfileList.TryGetTransform(m_SkinnedMeshRenderer.m_Bones[b], out var m_Transform))
|
||||
{
|
||||
GameObject m_Bone;
|
||||
if (assetsfileList.TryGetGameObject(m_Transform.m_GameObject, out m_Bone))
|
||||
if (assetsfileList.TryGetGameObject(m_Transform.m_GameObject, out var m_Bone))
|
||||
{
|
||||
int influences = 0, ibSplit = 0, wbSplit = 0;
|
||||
StringBuilder ib = new StringBuilder();//indices (vertex)
|
||||
@ -1426,8 +1405,7 @@ namespace Unity_Studio
|
||||
ob.Append("\n\t\t\tVersion: 101");
|
||||
ob.Append("\n\t\t\tName: \"\"");
|
||||
ob.Append("\n\t\t\tMappingInformationType: \"");
|
||||
if (m_Mesh.m_SubMeshes.Count == 1) { ob.Append("AllSame\""); }
|
||||
else { ob.Append("ByPolygon\""); }
|
||||
ob.Append(m_Mesh.m_SubMeshes.Count == 1 ? "AllSame\"" : "ByPolygon\"");
|
||||
ob.Append("\n\t\t\tReferenceInformationType: \"IndexToDirect\"");
|
||||
ob.AppendFormat("\n\t\t\tMaterials: *{0} {{", m_Mesh.m_materialIDs.Count);
|
||||
ob.Append("\n\t\t\t\ta: ");
|
||||
@ -1573,7 +1551,7 @@ namespace Unity_Studio
|
||||
eaz = 0;
|
||||
}
|
||||
|
||||
return new float[3] { (float)(eax * 180 / Math.PI), (float)(eay * 180 / Math.PI), (float)(eaz * 180 / Math.PI) };
|
||||
return new[] { (float)(eax * 180 / Math.PI), (float)(eay * 180 / Math.PI), (float)(eaz * 180 / Math.PI) };
|
||||
}
|
||||
|
||||
private static byte[] RandomColorGenerator(string name)
|
||||
@ -1586,7 +1564,7 @@ namespace Unity_Studio
|
||||
byte green = (byte)r.Next(0, 255);
|
||||
byte blue = (byte)r.Next(0, 255);
|
||||
|
||||
return new byte[3] { red, green, blue };
|
||||
return new[] { red, green, blue };
|
||||
}
|
||||
|
||||
public static bool ExportTexture2D(AssetPreloadData asset, string exportPathName, bool flip)
|
||||
@ -1647,12 +1625,9 @@ namespace Unity_Studio
|
||||
return false;
|
||||
if (convertfsb && oldextension == ".fsb")
|
||||
{
|
||||
FMOD.System system;
|
||||
FMOD.Sound sound;
|
||||
FMOD.RESULT result;
|
||||
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
|
||||
|
||||
result = FMOD.Factory.System_Create(out system);
|
||||
var result = FMOD.Factory.System_Create(out var system);
|
||||
if (result != FMOD.RESULT.OK) { return false; }
|
||||
|
||||
result = system.init(1, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
|
||||
@ -1661,7 +1636,7 @@ namespace Unity_Studio
|
||||
exinfo.cbsize = Marshal.SizeOf(exinfo);
|
||||
exinfo.length = (uint)m_AudioClip.m_Size;
|
||||
|
||||
result = system.createSound(m_AudioClip.m_AudioData, FMOD.MODE.OPENMEMORY, ref exinfo, out sound);
|
||||
result = system.createSound(m_AudioClip.m_AudioData, FMOD.MODE.OPENMEMORY, ref exinfo, out var sound);
|
||||
if (result != FMOD.RESULT.OK) { return false; }
|
||||
|
||||
result = sound.getSubSound(0, out var subsound);
|
||||
|
1
Unity Studio/UnityStudioForm.Designer.cs
generated
1
Unity Studio/UnityStudioForm.Designer.cs
generated
@ -721,6 +721,7 @@
|
||||
this.glControl1.TabIndex = 4;
|
||||
this.glControl1.VSync = false;
|
||||
this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);
|
||||
this.glControl1.MouseWheel += new System.Windows.Forms.MouseEventHandler(glControl1_MouseWheel);
|
||||
//
|
||||
// classPreviewPanel
|
||||
//
|
||||
|
@ -22,7 +22,8 @@ namespace Unity_Studio
|
||||
private AssetPreloadData lastSelectedItem;
|
||||
private AssetPreloadData lastLoadedAsset;
|
||||
|
||||
private string[] fileTypes = { "globalgamemanagers", "maindata.", "level*.", "*.assets", "*.sharedAssets", "CustomAssetBundle-*", "CAB-*", "BuildPlayer-*" };
|
||||
private string[] assetsFileTypes = { "globalgamemanagers", "maindata.", "level*.", "*.assets", "*.sharedAssets", "CustomAssetBundle-*", "CAB-*", "BuildPlayer-*" };
|
||||
private string[] bundleFileTypes = { "*.unity3d", "*.unity3d.lz4", "*.assetbundle", "*.assetbundle-*", "*.bundle", "*.bytes" };
|
||||
|
||||
private FMOD.System system;
|
||||
private FMOD.Sound sound;
|
||||
@ -153,9 +154,9 @@ namespace Unity_Studio
|
||||
|
||||
MergeSplitAssets(mainPath);
|
||||
|
||||
for (int t = 0; t < fileTypes.Length; t++)
|
||||
for (int t = 0; t < assetsFileTypes.Length; t++)
|
||||
{
|
||||
string[] fileNames = Directory.GetFiles(mainPath, fileTypes[t], SearchOption.AllDirectories);
|
||||
string[] fileNames = Directory.GetFiles(mainPath, assetsFileTypes[t], SearchOption.AllDirectories);
|
||||
#region sort specific types alphanumerically
|
||||
if (fileNames.Length > 0 && (t == 1 || t == 2))
|
||||
{
|
||||
@ -231,7 +232,7 @@ namespace Unity_Studio
|
||||
extractedCount += extractBundleFile(fileName);
|
||||
ProgressBarPerformStep();
|
||||
}
|
||||
StatusStripUpdate("Finished extracting " + extractedCount + " files.");
|
||||
StatusStripUpdate($"Finished extracting {extractedCount} files.");
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -245,8 +246,7 @@ namespace Unity_Studio
|
||||
if (openFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
string startPath = openFolderDialog1.Folder;
|
||||
string[] fileTypes = new string[6] { "*.unity3d", "*.unity3d.lz4", "*.assetbundle", "*.assetbundle-*", "*.bundle", "*.bytes" };
|
||||
foreach (var fileType in fileTypes)
|
||||
foreach (var fileType in bundleFileTypes)
|
||||
{
|
||||
string[] fileNames = Directory.GetFiles(startPath, fileType, SearchOption.AllDirectories);
|
||||
bundleFiles.AddRange(fileNames);
|
||||
@ -260,7 +260,7 @@ namespace Unity_Studio
|
||||
extractedCount += extractBundleFile(fileName);
|
||||
ProgressBarPerformStep();
|
||||
}
|
||||
StatusStripUpdate("Finished extracting " + extractedCount + " files.");
|
||||
StatusStripUpdate($"Finished extracting {extractedCount} files.");
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -278,11 +278,11 @@ namespace Unity_Studio
|
||||
{
|
||||
if (productName != "")
|
||||
{
|
||||
Text = "Unity Studio - " + productName + " - " + assetsfileList[0].m_Version + " - " + assetsfileList[0].platformStr;
|
||||
Text = $"Unity Studio - {productName} - {assetsfileList[0].m_Version} - {assetsfileList[0].platformStr}";
|
||||
}
|
||||
else if (assetsfileList.Count > 0)
|
||||
{
|
||||
Text = "Unity Studio - no productName - " + assetsfileList[0].m_Version + " - " + assetsfileList[0].platformStr;
|
||||
Text = $"Unity Studio - no productName - {assetsfileList[0].m_Version} - {assetsfileList[0].platformStr}";
|
||||
}
|
||||
if (!dontLoadAssetsMenuItem.Checked)
|
||||
{
|
||||
@ -312,7 +312,7 @@ namespace Unity_Studio
|
||||
}
|
||||
classesListView.EndUpdate();
|
||||
}
|
||||
StatusStripUpdate("Finished loading " + assetsfileList.Count + " files with " + (assetListView.Items.Count + sceneTreeView.Nodes.Count) + " exportable assets.");
|
||||
StatusStripUpdate($"Finished loading {assetsfileList.Count} files with {assetListView.Items.Count} exportable assets.");
|
||||
treeSearch.Select();
|
||||
}));
|
||||
}
|
||||
@ -329,88 +329,73 @@ namespace Unity_Studio
|
||||
else { tabControl1.TabPages.Add(tabPage3); }
|
||||
}
|
||||
|
||||
if (glControl1.Visible == true)
|
||||
if (glControl1.Visible)
|
||||
{
|
||||
// --> Right
|
||||
if (e.KeyCode == Keys.D)
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(0.1f, 0, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationY(0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
|
||||
// <-- Left
|
||||
if (e.KeyCode == Keys.A)
|
||||
{
|
||||
if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(-0.1f, 0, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationY(-0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
|
||||
// Up
|
||||
if (e.KeyCode == Keys.W)
|
||||
{
|
||||
if (e.Control) //Toggle WireFrame
|
||||
{
|
||||
wireFrameMode = (wireFrameMode + 1) % 3;
|
||||
case Keys.D: // --> Right
|
||||
if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(0.1f, 0, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationY(0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
else if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(0, 0.1f, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationX(0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
|
||||
// Down
|
||||
if (e.KeyCode == Keys.S)
|
||||
{
|
||||
if (e.Control) //Toggle Shade
|
||||
{
|
||||
shadeMode = (shadeMode + 1) % 2;
|
||||
break;
|
||||
case Keys.A: // <-- Left
|
||||
if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(-0.1f, 0, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationY(-0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
else if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(0, -0.1f, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationX(-0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
break;
|
||||
case Keys.W: // Up
|
||||
if (e.Control) //Toggle WireFrame
|
||||
{
|
||||
wireFrameMode = (wireFrameMode + 1) % 3;
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
else if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(0, 0.1f, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationX(0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
break;
|
||||
case Keys.S: // Down
|
||||
if (e.Control) //Toggle Shade
|
||||
{
|
||||
shadeMode = (shadeMode + 1) % 2;
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
else if (e.Shift) //Move
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateTranslation(0, -0.1f, 0);
|
||||
}
|
||||
else //Rotate
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationX(-0.1f);
|
||||
}
|
||||
glControl1.Invalidate();
|
||||
break;
|
||||
case Keys.Q: // Zoom Out
|
||||
viewMatrixData *= Matrix4.CreateScale(0.9f);
|
||||
glControl1.Invalidate();
|
||||
break;
|
||||
case Keys.E: // Zoom In
|
||||
viewMatrixData *= Matrix4.CreateScale(1.1f);
|
||||
glControl1.Invalidate();
|
||||
break;
|
||||
}
|
||||
|
||||
// Zoom Out
|
||||
if (e.KeyCode == Keys.Q)
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateScale(0.9f);
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
|
||||
// Zoom In
|
||||
if (e.KeyCode == Keys.E)
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateScale(1.1f);
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
|
||||
// Normal mode
|
||||
if (e.Control && e.KeyCode == Keys.N)
|
||||
{
|
||||
@ -418,7 +403,6 @@ namespace Unity_Studio
|
||||
createVAO();
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
|
||||
// Toggle Timer
|
||||
if (e.KeyCode == Keys.T)
|
||||
{
|
||||
@ -457,7 +441,7 @@ namespace Unity_Studio
|
||||
|
||||
foreach (var uclass in version.Value)
|
||||
{
|
||||
string saveFile = versionPath + "\\" + uclass.Key + " " + uclass.Value.Text + ".txt";
|
||||
string saveFile = $"{versionPath}\\{uclass.Key} {uclass.Value.Text}.txt";
|
||||
using (StreamWriter TXTwriter = new StreamWriter(saveFile))
|
||||
{
|
||||
TXTwriter.Write(uclass.Value.membersstr);
|
||||
@ -507,10 +491,7 @@ namespace Unity_Studio
|
||||
|
||||
if (sound != null && channel != null)
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
|
||||
bool playing = false;
|
||||
result = channel.isPlaying(out playing);
|
||||
var result = channel.isPlaying(out var playing);
|
||||
if (result == FMOD.RESULT.OK && playing)
|
||||
{
|
||||
result = channel.stop();
|
||||
@ -823,8 +804,7 @@ namespace Unity_Studio
|
||||
#region Texture2D
|
||||
case 28: //Texture2D
|
||||
{
|
||||
if (imageTexture != null)
|
||||
imageTexture.Dispose();
|
||||
imageTexture?.Dispose();
|
||||
var m_Texture2D = new Texture2D(asset, true);
|
||||
imageTexture = m_Texture2D.ConvertToBitmap(true);
|
||||
if (imageTexture != null)
|
||||
@ -848,17 +828,15 @@ namespace Unity_Studio
|
||||
AudioClip m_AudioClip = new AudioClip(asset, true);
|
||||
if (m_AudioClip.m_AudioData == null)
|
||||
break;
|
||||
FMOD.RESULT result;
|
||||
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
|
||||
|
||||
exinfo.cbsize = Marshal.SizeOf(exinfo);
|
||||
exinfo.length = (uint)m_AudioClip.m_Size;
|
||||
|
||||
result = system.createSound(m_AudioClip.m_AudioData, (FMOD.MODE.OPENMEMORY | loopMode), ref exinfo, out sound);
|
||||
var result = system.createSound(m_AudioClip.m_AudioData, FMOD.MODE.OPENMEMORY | loopMode, ref exinfo, out sound);
|
||||
if (ERRCHECK(result)) { break; }
|
||||
|
||||
FMOD.Sound subsound;
|
||||
result = sound.getSubSound(0, out subsound);
|
||||
result = sound.getSubSound(0, out var subsound);
|
||||
if (result == FMOD.RESULT.OK)
|
||||
{
|
||||
sound = subsound;
|
||||
@ -876,7 +854,7 @@ namespace Unity_Studio
|
||||
if (ERRCHECK(result)) { break; }
|
||||
|
||||
FMODinfoLabel.Text = FMODfrequency + " Hz";
|
||||
FMODtimerLabel.Text = "0:0.0 / " + (FMODlenms / 1000 / 60) + ":" + (FMODlenms / 1000 % 60) + "." + (FMODlenms / 10 % 100);
|
||||
FMODtimerLabel.Text = $"0:0.0 / {FMODlenms / 1000 / 60}:{FMODlenms / 1000 % 60}.{FMODlenms / 10 % 100}";
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
@ -1013,7 +991,6 @@ namespace Unity_Studio
|
||||
offset[i] = (max[i] + min[i]) / 2;
|
||||
}
|
||||
float d = Math.Max(1e-5f, dist.Length);
|
||||
Vector3 scale = new Vector3(2f / d);
|
||||
modelMatrixData = Matrix4.CreateTranslation(-offset) * Matrix4.CreateScale(2f / d);
|
||||
#endregion
|
||||
#region Indicies
|
||||
@ -1140,17 +1117,14 @@ namespace Unity_Studio
|
||||
{
|
||||
FMODreset();
|
||||
|
||||
FMOD.RESULT result;
|
||||
uint version = 0;
|
||||
|
||||
result = FMOD.Factory.System_Create(out system);
|
||||
var result = FMOD.Factory.System_Create(out system);
|
||||
if (ERRCHECK(result)) { return; }
|
||||
|
||||
result = system.getVersion(out version);
|
||||
result = system.getVersion(out var version);
|
||||
ERRCHECK(result);
|
||||
if (version < FMOD.VERSION.number)
|
||||
{
|
||||
MessageBox.Show("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + FMOD.VERSION.number.ToString("X") + ".");
|
||||
MessageBox.Show($"Error! You are using an old version of FMOD {version:X}. This program requires {FMOD.VERSION.number:X}.");
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
@ -1182,12 +1156,10 @@ namespace Unity_Studio
|
||||
|
||||
private void FMODplayButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
if (sound != null && channel != null)
|
||||
{
|
||||
timer.Start();
|
||||
bool playing = false;
|
||||
result = channel.isPlaying(out playing);
|
||||
var result = channel.isPlaying(out var playing);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
if (ERRCHECK(result)) { return; }
|
||||
@ -1226,14 +1198,9 @@ namespace Unity_Studio
|
||||
|
||||
private void FMODpauseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
|
||||
if (sound != null && channel != null)
|
||||
{
|
||||
bool playing = false;
|
||||
bool paused = false;
|
||||
|
||||
result = channel.isPlaying(out playing);
|
||||
var result = channel.isPlaying(out var playing);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
if (ERRCHECK(result)) { return; }
|
||||
@ -1241,14 +1208,14 @@ namespace Unity_Studio
|
||||
|
||||
if (playing)
|
||||
{
|
||||
result = channel.getPaused(out paused);
|
||||
result = channel.getPaused(out var paused);
|
||||
if (ERRCHECK(result)) { return; }
|
||||
result = channel.setPaused(!paused);
|
||||
if (ERRCHECK(result)) { return; }
|
||||
|
||||
if (paused)
|
||||
{
|
||||
FMODstatusLabel.Text = (playing ? "Playing" : "Stopped");
|
||||
FMODstatusLabel.Text = "Playing";
|
||||
FMODpauseButton.Text = "Pause";
|
||||
timer.Start();
|
||||
}
|
||||
@ -1264,11 +1231,9 @@ namespace Unity_Studio
|
||||
|
||||
private void FMODstopButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
if (channel != null)
|
||||
{
|
||||
bool playing = false;
|
||||
result = channel.isPlaying(out playing);
|
||||
var result = channel.isPlaying(out var playing);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
if (ERRCHECK(result)) { return; }
|
||||
@ -1293,14 +1258,7 @@ namespace Unity_Studio
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
|
||||
if (FMODloopButton.Checked)
|
||||
{
|
||||
loopMode = FMOD.MODE.LOOP_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
loopMode = FMOD.MODE.LOOP_OFF;
|
||||
}
|
||||
loopMode = FMODloopButton.Checked ? FMOD.MODE.LOOP_NORMAL : FMOD.MODE.LOOP_OFF;
|
||||
|
||||
if (sound != null)
|
||||
{
|
||||
@ -1310,15 +1268,13 @@ namespace Unity_Studio
|
||||
|
||||
if (channel != null)
|
||||
{
|
||||
bool playing = false;
|
||||
result = channel.isPlaying(out playing);
|
||||
result = channel.isPlaying(out var playing);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
if (ERRCHECK(result)) { return; }
|
||||
}
|
||||
|
||||
bool paused = false;
|
||||
result = channel.getPaused(out paused);
|
||||
result = channel.getPaused(out var paused);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
if (ERRCHECK(result)) { return; }
|
||||
@ -1334,10 +1290,9 @@ namespace Unity_Studio
|
||||
|
||||
private void FMODvolumeBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
FMODVolume = Convert.ToSingle(FMODvolumeBar.Value) / 10;
|
||||
|
||||
result = masterSoundGroup.setVolume(FMODVolume);
|
||||
var result = masterSoundGroup.setVolume(FMODVolume);
|
||||
if (ERRCHECK(result)) { return; }
|
||||
}
|
||||
|
||||
@ -1346,7 +1301,7 @@ namespace Unity_Studio
|
||||
if (channel != null)
|
||||
{
|
||||
uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value;
|
||||
FMODtimerLabel.Text = (newms / 1000 / 60) + ":" + (newms / 1000 % 60) + "." + (newms / 10 % 100) + "/" + (FMODlenms / 1000 / 60) + ":" + (FMODlenms / 1000 % 60) + "." + (FMODlenms / 10 % 100);
|
||||
FMODtimerLabel.Text = $"{newms / 1000 / 60}:{newms / 1000 % 60}.{newms / 10 % 100}/{FMODlenms / 1000 / 60}:{FMODlenms / 1000 % 60}.{FMODlenms / 10 % 100}";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1359,19 +1314,16 @@ namespace Unity_Studio
|
||||
{
|
||||
if (channel != null)
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
|
||||
uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value;
|
||||
|
||||
result = channel.setPosition(newms, FMOD.TIMEUNIT.MS);
|
||||
var result = channel.setPosition(newms, FMOD.TIMEUNIT.MS);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
if (ERRCHECK(result)) { return; }
|
||||
}
|
||||
|
||||
bool playing = false;
|
||||
|
||||
result = channel.isPlaying(out playing);
|
||||
result = channel.isPlaying(out var playing);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
if (ERRCHECK(result)) { return; }
|
||||
@ -1383,14 +1335,13 @@ namespace Unity_Studio
|
||||
|
||||
private void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
FMOD.RESULT result;
|
||||
uint ms = 0;
|
||||
bool playing = false;
|
||||
bool paused = false;
|
||||
|
||||
if (channel != null)
|
||||
{
|
||||
result = channel.getPosition(out ms, FMOD.TIMEUNIT.MS);
|
||||
var result = channel.getPosition(out ms, FMOD.TIMEUNIT.MS);
|
||||
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
|
||||
{
|
||||
ERRCHECK(result);
|
||||
@ -1409,9 +1360,9 @@ namespace Unity_Studio
|
||||
}
|
||||
}
|
||||
|
||||
FMODtimerLabel.Text = (ms / 1000 / 60) + ":" + (ms / 1000 % 60) + "." + (ms / 10 % 100) + " / " + (FMODlenms / 1000 / 60) + ":" + (FMODlenms / 1000 % 60) + "." + (FMODlenms / 10 % 100);
|
||||
FMODtimerLabel.Text = $"{ms / 1000 / 60}:{ms / 1000 % 60}.{ms / 10 % 100} / {FMODlenms / 1000 / 60}:{FMODlenms / 1000 % 60}.{FMODlenms / 10 % 100}";
|
||||
FMODprogressBar.Value = (int)(ms * 1000 / FMODlenms);
|
||||
FMODstatusLabel.Text = (paused ? "Paused " : playing ? "Playing" : "Stopped");
|
||||
FMODstatusLabel.Text = paused ? "Paused " : playing ? "Playing" : "Stopped";
|
||||
|
||||
if (system != null && channel != null)
|
||||
{
|
||||
@ -1424,7 +1375,7 @@ namespace Unity_Studio
|
||||
if (result != FMOD.RESULT.OK)
|
||||
{
|
||||
FMODreset();
|
||||
StatusStripUpdate("FMOD error! " + result + " - " + FMOD.Error.String(result));
|
||||
StatusStripUpdate($"FMOD error! {result} - {FMOD.Error.String(result)}");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1502,7 +1453,7 @@ namespace Unity_Studio
|
||||
{
|
||||
if (sceneTreeView.Nodes.Count > 0)
|
||||
{
|
||||
bool exportSwitch = (((ToolStripItem)sender).Name == "exportAll3DMenuItem") ? true : false;
|
||||
bool exportSwitch = ((ToolStripItem)sender).Name == "exportAll3DMenuItem";
|
||||
|
||||
|
||||
var timestamp = DateTime.Now;
|
||||
@ -1543,21 +1494,21 @@ namespace Unity_Studio
|
||||
{
|
||||
timer.Stop();
|
||||
List<AssetPreloadData> toExportAssets = null;
|
||||
if (((ToolStripItem)sender).Name == "exportAllAssetsMenuItem")
|
||||
switch (((ToolStripItem)sender).Name)
|
||||
{
|
||||
toExportAssets = exportableAssets;
|
||||
}
|
||||
else if (((ToolStripItem)sender).Name == "exportFilteredAssetsMenuItem")
|
||||
{
|
||||
toExportAssets = visibleAssets;
|
||||
}
|
||||
else if (((ToolStripItem)sender).Name == "exportSelectedAssetsMenuItem")
|
||||
{
|
||||
toExportAssets = new List<AssetPreloadData>(assetListView.SelectedIndices.Count);
|
||||
foreach (var i in assetListView.SelectedIndices.OfType<int>())
|
||||
{
|
||||
toExportAssets.Add((AssetPreloadData)assetListView.Items[i]);
|
||||
}
|
||||
case "exportAllAssetsMenuItem":
|
||||
toExportAssets = exportableAssets;
|
||||
break;
|
||||
case "exportFilteredAssetsMenuItem":
|
||||
toExportAssets = visibleAssets;
|
||||
break;
|
||||
case "exportSelectedAssetsMenuItem":
|
||||
toExportAssets = new List<AssetPreloadData>(assetListView.SelectedIndices.Count);
|
||||
foreach (var i in assetListView.SelectedIndices.OfType<int>())
|
||||
{
|
||||
toExportAssets.Add((AssetPreloadData)assetListView.Items[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
int assetGroupSelectedIndex = assetGroupOptions.SelectedIndex;
|
||||
|
||||
@ -1578,7 +1529,7 @@ namespace Unity_Studio
|
||||
string exportpath = savePath + "\\";
|
||||
if (assetGroupSelectedIndex == 1) { exportpath += Path.GetFileNameWithoutExtension(asset.sourceFile.filePath) + "_export\\"; }
|
||||
else if (assetGroupSelectedIndex == 0) { exportpath = savePath + "\\" + asset.TypeString + "\\"; }
|
||||
StatusStripUpdate("Exporting " + asset.TypeString + ": " + asset.Text);
|
||||
StatusStripUpdate($"Exporting {asset.TypeString}: {asset.Text}");
|
||||
switch (asset.Type2)
|
||||
{
|
||||
case 28: //Texture2D
|
||||
@ -1645,18 +1596,18 @@ namespace Unity_Studio
|
||||
}
|
||||
ProgressBarPerformStep();
|
||||
}
|
||||
string statusText = "";
|
||||
string statusText;
|
||||
switch (exportedCount)
|
||||
{
|
||||
case 0:
|
||||
statusText = "Nothing exported.";
|
||||
break;
|
||||
default:
|
||||
statusText = "Finished exporting " + exportedCount + " assets.";
|
||||
statusText = $"Finished exporting {exportedCount} assets.";
|
||||
break;
|
||||
}
|
||||
|
||||
if (toExport > exportedCount) { statusText += " " + (toExport - exportedCount) + " assets skipped (not extractable or files already exist)"; }
|
||||
if (toExport > exportedCount) { statusText += $" {toExport - exportedCount} assets skipped (not extractable or files already exist)"; }
|
||||
|
||||
StatusStripUpdate(statusText);
|
||||
|
||||
@ -1750,7 +1701,7 @@ namespace Unity_Studio
|
||||
|
||||
private void timerOpenTK_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (glControl1.Visible == true)
|
||||
if (glControl1.Visible)
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateRotationY(-0.1f);
|
||||
glControl1.Invalidate();
|
||||
@ -1761,11 +1712,9 @@ namespace Unity_Studio
|
||||
{
|
||||
GL.Viewport(0, 0, glControl1.ClientSize.Width, glControl1.ClientSize.Height);
|
||||
GL.ClearColor(Color.CadetBlue);
|
||||
int vsID, fsID;
|
||||
|
||||
pgmID = GL.CreateProgram();
|
||||
loadShader("vs", ShaderType.VertexShader, pgmID, out vsID);
|
||||
loadShader("fs", ShaderType.FragmentShader, pgmID, out fsID);
|
||||
loadShader("vs", ShaderType.VertexShader, pgmID, out int vsID);
|
||||
loadShader("fs", ShaderType.FragmentShader, pgmID, out int fsID);
|
||||
GL.LinkProgram(pgmID);
|
||||
|
||||
pgmColorID = GL.CreateProgram();
|
||||
@ -1948,5 +1897,14 @@ namespace Unity_Studio
|
||||
contextMenuStrip1.Show(assetListView, e.X, e.Y);
|
||||
}
|
||||
}
|
||||
|
||||
private void glControl1_MouseWheel(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (glControl1.Visible)
|
||||
{
|
||||
viewMatrixData *= Matrix4.CreateScale(1 + e.Delta / 1000f);
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user