Updated Wwise Integration

This commit is contained in:
Reinier Vens 2021-04-30 07:09:07 +01:00
commit 051e54d961
1067 changed files with 20597 additions and 13747 deletions

View file

@ -0,0 +1,20 @@
{
"name": "AK.Wwise.Unity.API.Editor",
"references": [
"AK.Wwise.Unity.API",
"AK.Wwise.Unity.API.WwiseTypes",
"AK.Wwise.Unity.MonoBehaviour",
"Ak.Wwise.Api.WAAPI"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3f1361d532510084ab0640363407119c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d727add5552d4f429e0497a8d6f4cb3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 69bde7d45ecaab748b48ccfedecaba20
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 26913be84cba5aa4d975a69312ac8022
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,128 @@
#if UNITY_EDITOR
public class AkUnityIntegrationBuilderBase
{
private readonly string m_progTitle = "WwiseUnity: Rebuilding Unity Integration Progress";
protected string m_assetsDir = "Undefined";
protected string m_assetsPluginsDir = "Undefined";
protected string m_buildScriptDir = "Undefined";
protected string m_buildScriptFile = "Undefined";
protected string m_platform = "Undefined";
protected string m_shell = "python";
protected string m_wwiseSdkDir = "";
public AkUnityIntegrationBuilderBase()
{
var unityProjectRoot = System.IO.Directory.GetCurrentDirectory();
m_assetsDir = System.IO.Path.Combine(unityProjectRoot, "Assets");
m_assetsPluginsDir = System.IO.Path.Combine(m_assetsDir, "Plugins");
m_buildScriptDir =
System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.Combine(m_assetsDir, "Wwise"), "AkSoundEngine"),
"Common");
m_buildScriptFile = "BuildWwiseUnityIntegration.py";
}
public void BuildByConfig(string config, string arch)
{
if (UnityEditor.EditorApplication.isPlaying)
{
UnityEngine.Debug.LogWarning("WwiseUnity: Editor is in play mode. Stop playing any scenes and retry. Aborted.");
return;
}
// Try to parse config to get Wwise location.
var configPath = System.IO.Path.Combine(m_buildScriptDir, "BuildWwiseUnityIntegration.json");
var fi = new System.IO.FileInfo(configPath);
if (fi.Exists)
{
var msg = string.Format("WwiseUnity: Found preference file: {0}. Use build variables defined in it.", configPath);
UnityEngine.Debug.Log(msg);
}
else
{
var msg = string.Format("WwiseUnity: Preference file: {0} is unavailable. Need user input.", configPath);
UnityEngine.Debug.Log(msg);
m_wwiseSdkDir = UnityEditor.EditorUtility.OpenFolderPanel("Choose Wwise SDK folder", ".", "");
var isUserCancelledBuild = m_wwiseSdkDir == "";
if (isUserCancelledBuild)
{
UnityEngine.Debug.Log("WwiseUnity: User cancelled the build.");
return;
}
}
if (!PreBuild())
return;
// On Windows, separate shell console window will open. When building is done, close the Window yourself if it stays active. Usually at the end you will see the last line says "Build succeeded" or "Build failed".
var progMsg = string.Format("WwiseUnity: Rebuilding Wwise Unity Integration for {0} ({1}) ...", m_platform, config);
UnityEngine.Debug.Log(progMsg);
var start = new System.Diagnostics.ProcessStartInfo();
start.FileName = m_shell;
start.Arguments = GetProcessArgs(config, arch);
if (start.Arguments == "")
return;
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
UnityEditor.EditorUtility.DisplayProgressBar(m_progTitle, progMsg, 0.5f);
using (var process = System.Diagnostics.Process.Start(start))
{
using (var reader = process.StandardOutput)
{
process.WaitForExit();
try
{
//ExitCode throws InvalidOperationException if the process is hanging
var isBuildSucceeded = process.ExitCode == 0;
if (isBuildSucceeded)
{
UnityEditor.EditorUtility.DisplayProgressBar(m_progTitle, progMsg, 1.0f);
UnityEngine.Debug.Log("WwiseUnity: Build succeeded. Check detailed logs under the Logs folder.");
}
else
UnityEngine.Debug.LogError("WwiseUnity: Build failed. Check detailed logs under the Logs folder.");
UnityEditor.AssetDatabase.Refresh();
UnityEditor.EditorUtility.ClearProgressBar();
}
catch (System.Exception ex)
{
UnityEditor.AssetDatabase.Refresh();
UnityEngine.Debug.LogError(string.Format(
"WwiseUnity: Build process failed with exception: {}. Check detailed logs under the Logs folder.", ex));
UnityEditor.EditorUtility.ClearProgressBar();
}
}
}
}
protected virtual string GetProcessArgs(string config, string arch)
{
var scriptPath = System.IO.Path.Combine(m_buildScriptDir, m_buildScriptFile);
var args = string.Format("\"{0}\" -p {1} -c {2}", scriptPath, m_platform, config);
if (arch != null)
args += string.Format(" -a {0}", arch);
if (m_wwiseSdkDir != "")
args += string.Format(" -w \"{0}\" -u", m_wwiseSdkDir);
return args;
}
protected virtual bool PreBuild()
{
return true;
}
}
#endif // #if UNITY_EDITOR

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e339e26fd91eb8c40b1a28af9b70a1ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,385 @@
#if UNITY_EDITOR
public class AkUnityAssetsInstaller
{
public string[] m_arches = { };
protected string m_assetsDir = UnityEngine.Application.dataPath;
protected System.Collections.Generic.List<string> m_excludes = new System.Collections.Generic.List<string> { ".meta" };
protected string m_platform = "Undefined";
protected string m_pluginDir = System.IO.Path.Combine(UnityEngine.Application.dataPath, "Plugins");
// Copy file to destination directory and create the directory when none exists.
public static bool CopyFileToDirectory(string srcFilePath, string destDir)
{
var fi = new System.IO.FileInfo(srcFilePath);
if (!fi.Exists)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to copy. Source is missing: {0}.", srcFilePath));
return false;
}
var di = new System.IO.DirectoryInfo(destDir);
if (!di.Exists)
di.Create();
const bool IsToOverwrite = true;
try
{
fi.CopyTo(System.IO.Path.Combine(di.FullName, fi.Name), IsToOverwrite);
}
catch (System.Exception ex)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Error during installation: {0}.", ex.Message));
return false;
}
return true;
}
// Copy or overwrite destination file with source file.
public static bool OverwriteFile(string srcFilePath, string destFilePath)
{
var fi = new System.IO.FileInfo(srcFilePath);
if (!fi.Exists)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to overwrite. Source is missing: {0}.", srcFilePath));
return false;
}
var di = new System.IO.DirectoryInfo(System.IO.Path.GetDirectoryName(destFilePath));
if (!di.Exists)
di.Create();
const bool IsToOverwrite = true;
try
{
fi.CopyTo(destFilePath, IsToOverwrite);
}
catch (System.Exception ex)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Error during installation: {0}.", ex.Message));
return false;
}
return true;
}
// Move file to destination directory and create the directory when none exists.
public static void MoveFileToDirectory(string srcFilePath, string destDir)
{
var fi = new System.IO.FileInfo(srcFilePath);
if (!fi.Exists)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to move. Source is missing: {0}.", srcFilePath));
return;
}
var di = new System.IO.DirectoryInfo(destDir);
if (!di.Exists)
di.Create();
var destFilePath = System.IO.Path.Combine(di.FullName, fi.Name);
try
{
fi.MoveTo(destFilePath);
}
catch (System.Exception ex)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Error during installation: {0}.", ex.Message));
}
}
// Recursively copy a directory to its destination.
public static bool RecursiveCopyDirectory(System.IO.DirectoryInfo srcDir, System.IO.DirectoryInfo destDir,
System.Collections.Generic.List<string> excludeExtensions = null)
{
if (!srcDir.Exists)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to copy. Source is missing: {0}.", srcDir));
return false;
}
if (!destDir.Exists)
destDir.Create();
// Copy all files.
var files = srcDir.GetFiles();
foreach (var file in files)
{
if (excludeExtensions != null)
{
var fileExt = System.IO.Path.GetExtension(file.Name);
var isFileExcluded = false;
foreach (var ext in excludeExtensions)
{
if (fileExt.ToLower() == ext)
{
isFileExcluded = true;
break;
}
}
if (isFileExcluded)
continue;
}
const bool IsToOverwrite = true;
try
{
file.CopyTo(System.IO.Path.Combine(destDir.FullName, file.Name), IsToOverwrite);
}
catch (System.Exception ex)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Error during installation: {0}.", ex.Message));
return false;
}
}
// Process subdirectories.
var dirs = srcDir.GetDirectories();
foreach (var dir in dirs)
{
// Get destination directory.
var destFullPath = System.IO.Path.Combine(destDir.FullName, dir.Name);
// Recurse
var isSuccess = RecursiveCopyDirectory(dir, new System.IO.DirectoryInfo(destFullPath), excludeExtensions);
if (!isSuccess)
return false;
}
return true;
}
}
public class AkUnityPluginInstallerBase : AkUnityAssetsInstaller
{
private readonly string m_progTitle = "WwiseUnity: Plugin Installation Progress";
public bool InstallPluginByConfig(string config)
{
var pluginSrc = GetPluginSrcPathByConfig(config);
var pluginDest = GetPluginDestPath("");
var progMsg = string.Format("Installing plugin for {0} ({1}) from {2} to {3}.", m_platform, config, pluginSrc,
pluginDest);
UnityEditor.EditorUtility.DisplayProgressBar(m_progTitle, progMsg, 0.5f);
var isSuccess = RecursiveCopyDirectory(new System.IO.DirectoryInfo(pluginSrc),
new System.IO.DirectoryInfo(pluginDest), m_excludes);
if (!isSuccess)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to install plugin for {0} ({1}) from {2} to {3}.",
m_platform, config, pluginSrc, pluginDest));
UnityEditor.EditorUtility.ClearProgressBar();
return false;
}
UnityEditor.EditorUtility.DisplayProgressBar(m_progTitle, progMsg, 1.0f);
UnityEditor.AssetDatabase.Refresh();
UnityEditor.EditorUtility.ClearProgressBar();
UnityEngine.Debug.Log(string.Format("WwiseUnity: Plugin for {0} {1} installed from {2} to {3}.", m_platform, config,
pluginSrc, pluginDest));
return true;
}
public virtual bool InstallPluginByArchConfig(string arch, string config)
{
var pluginSrc = GetPluginSrcPathByArchConfig(arch, config);
var pluginDest = GetPluginDestPath(arch);
var progMsg = string.Format("Installing plugin for {0} ({1}, {2}) from {3} to {4}.", m_platform, arch, config,
pluginSrc, pluginDest);
UnityEditor.EditorUtility.DisplayProgressBar(m_progTitle, progMsg, 0.5f);
var isSuccess = RecursiveCopyDirectory(new System.IO.DirectoryInfo(pluginSrc),
new System.IO.DirectoryInfo(pluginDest), m_excludes);
if (!isSuccess)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to install plugin for {0} ({1}, {2}) from {3} to {4}.",
m_platform, arch, config, pluginSrc, pluginDest));
UnityEditor.EditorUtility.ClearProgressBar();
return false;
}
UnityEditor.EditorUtility.DisplayProgressBar(m_progTitle, progMsg, 1.0f);
UnityEditor.AssetDatabase.Refresh();
UnityEditor.EditorUtility.ClearProgressBar();
UnityEngine.Debug.Log(string.Format("WwiseUnity: Plugin for {0} {1} {2} installed from {3} to {4}.", m_platform, arch,
config, pluginSrc, pluginDest));
return true;
}
protected string GetPluginSrcPathByConfig(string config)
{
return System.IO.Path.Combine(
System.IO.Path.Combine(
System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.Combine(m_assetsDir, "Wwise"), "API", "Runtime"),
"Plugins"), m_platform), config);
}
protected string GetPluginSrcPathByArchConfig(string arch, string config)
{
return System.IO.Path.Combine(
System.IO.Path.Combine(
System.IO.Path.Combine(
System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.Combine(m_assetsDir, "Wwise"), "API", "Runtime"),
"Plugins"), m_platform), arch), config);
}
protected virtual string GetPluginDestPath(string arch)
{
return m_pluginDir;
}
}
public class AkUnityPluginInstallerMultiArchBase : AkUnityPluginInstallerBase
{
protected override string GetPluginDestPath(string arch)
{
return System.IO.Path.Combine(System.IO.Path.Combine(m_pluginDir, m_platform), arch);
}
}
public class AkDocHelper
{
private static string m_WwiseVersionString = string.Empty;
public static void OpenDoc(string platform)
{
if (m_WwiseVersionString == string.Empty)
{
var temp = AkSoundEngine.GetMajorMinorVersion();
var temp2 = AkSoundEngine.GetSubminorBuildVersion();
m_WwiseVersionString = (temp >> 16) + "." + (temp & 0xFFFF);
if (temp2 >> 16 != 0)
m_WwiseVersionString += "." + (temp2 >> 16);
m_WwiseVersionString += "_" + (temp2 & 0xFFFF);
}
var docUrl = "http://www.audiokinetic.com/library/" + m_WwiseVersionString + "/?source=Unity&id=main.html";
var isConnected = false;
try
{
var request = (System.Net.HttpWebRequest) System.Net.WebRequest.Create("http://www.audiokinetic.com/robots.txt");
request.Timeout = 1000;
request.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
var response = (System.Net.HttpWebResponse) request.GetResponse();
isConnected = response.StatusCode == System.Net.HttpStatusCode.OK;
}
catch (System.Exception)
{
isConnected = false;
}
if (!isConnected)
{
// Can't access audiokinetic.com, open local doc.
docUrl = GetLocalDocUrl(platform);
if (string.IsNullOrEmpty(docUrl))
return;
}
UnityEngine.Application.OpenURL(docUrl);
}
private static string GetLocalDocUrl(string platform)
{
var docUrl = string.Empty;
var docPath = string.Empty;
var dataPath = UnityEngine.Application.dataPath;
#if UNITY_EDITOR_WIN
var format = (platform == "Windows")
? "{0}/Wwise/Documentation/{1}/en/WwiseUnityIntegrationHelp_en.chm"
: "{0}/Wwise/Documentation/{1}/en/WwiseUnityIntegrationHelp_{1}_en.chm";
docPath = string.Format(format, dataPath, platform);
#else
string DestPath = AkUtilities.GetFullPath(dataPath, "../WwiseUnityIntegrationHelp_en");
docPath = string.Format ("{0}/html/index.html", DestPath);
if (!System.IO.File.Exists(docPath))
UnzipHelp(DestPath);
if (!System.IO.File.Exists(docPath))
{
UnityEngine.Debug.Log("WwiseUnity: Unable to show documentation. Please unzip WwiseUnityIntegrationHelp_AppleCommon_en.zip manually.");
return string.Empty;
}
#endif
var fi = new System.IO.FileInfo(docPath);
if (!fi.Exists)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to find documentation: {0}. Aborted.", docPath));
return string.Empty;
}
docUrl = string.Format("file:///{0}", docPath.Replace(" ", "%20"));
return docUrl;
}
public static void UnzipHelp(string DestPath)
{
// Start by extracting the zip, if it exists
var ZipPath = System.IO.Path.Combine(
System.IO.Path.Combine(
System.IO.Path.Combine(
System.IO.Path.Combine(System.IO.Path.Combine(UnityEngine.Application.dataPath, "Wwise"), "Documentation"),
"AppleCommon"), "en"), "WwiseUnityIntegrationHelp_en.zip");
if (System.IO.File.Exists(ZipPath))
{
var start = new System.Diagnostics.ProcessStartInfo();
start.FileName = "unzip";
start.Arguments = "\"" + ZipPath + "\" -d \"" + DestPath + "\"";
start.UseShellExecute = true;
start.RedirectStandardOutput = false;
var progMsg = "WwiseUnity: Unzipping documentation...";
var progTitle = "Unzipping Wwise documentation";
UnityEditor.EditorUtility.DisplayProgressBar(progTitle, progMsg, 0.5f);
using (var process = System.Diagnostics.Process.Start(start))
{
while (!process.WaitForExit(1000))
System.Threading.Thread.Sleep(100);
try
{
//ExitCode throws InvalidOperationException if the process is hanging
var returnCode = process.ExitCode;
var isBuildSucceeded = returnCode == 0;
if (isBuildSucceeded)
{
UnityEditor.EditorUtility.DisplayProgressBar(progTitle, progMsg, 1.0f);
UnityEngine.Debug.Log("WwiseUnity: Documentation extraction succeeded. ");
}
else
UnityEngine.Debug.LogError("WwiseUnity: Extraction failed.");
UnityEditor.EditorUtility.ClearProgressBar();
}
catch (System.Exception ex)
{
UnityEditor.EditorUtility.ClearProgressBar();
UnityEngine.Debug.LogError(ex.ToString());
UnityEditor.EditorUtility.ClearProgressBar();
}
}
}
}
}
#endif // #if UNITY_EDITOR

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: beacbddfe55891249bea826bc322015f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,63 @@
#if UNITY_EDITOR
internal static class AkWwiseIDConverter
{
private static readonly string s_bankDir = UnityEngine.Application.dataPath;
private static readonly string s_converterScript = System.IO.Path.Combine(
System.IO.Path.Combine(System.IO.Path.Combine(UnityEngine.Application.dataPath, "Wwise"), "Tools"),
"WwiseIDConverter.py");
private static readonly string s_progTitle = "WwiseUnity: Converting SoundBank IDs";
[UnityEditor.MenuItem("Assets/Wwise/Convert Wwise SoundBank IDs", false, (int) AkWwiseMenuOrder.ConvertIDs)]
public static void ConvertWwiseSoundBankIDs()
{
var bankIdHeaderPath =
UnityEditor.EditorUtility.OpenFilePanel("Choose Wwise SoundBank ID C++ header", s_bankDir, "h");
if (string.IsNullOrEmpty(bankIdHeaderPath))
{
UnityEngine.Debug.Log("WwiseUnity: User canceled the action.");
return;
}
var start = new System.Diagnostics.ProcessStartInfo();
start.FileName = "python";
start.Arguments = string.Format("\"{0}\" \"{1}\"", s_converterScript, bankIdHeaderPath);
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
var progMsg = "WwiseUnity: Converting C++ SoundBank IDs into C# ...";
UnityEditor.EditorUtility.DisplayProgressBar(s_progTitle, progMsg, 0.5f);
using (var process = System.Diagnostics.Process.Start(start))
{
process.WaitForExit();
try
{
//ExitCode throws InvalidOperationException if the process is hanging
if (process.ExitCode == 0)
{
UnityEditor.EditorUtility.DisplayProgressBar(s_progTitle, progMsg, 1.0f);
UnityEngine.Debug.Log(string.Format(
"WwiseUnity: SoundBank ID conversion succeeded. Find generated Unity script under {0}.", s_bankDir));
}
else
UnityEngine.Debug.LogError("WwiseUnity: Conversion failed.");
UnityEditor.AssetDatabase.Refresh();
}
catch (System.Exception ex)
{
UnityEditor.AssetDatabase.Refresh();
UnityEditor.EditorUtility.ClearProgressBar();
UnityEngine.Debug.LogError(string.Format(
"WwiseUnity: SoundBank ID conversion process failed with exception: {}. Check detailed logs under the folder: Assets/Wwise/Logs.",
ex));
}
UnityEditor.EditorUtility.ClearProgressBar();
}
}
}
#endif // #if UNITY_EDITOR

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0af3cdd822fb2414fb284a2730bbdb29
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 43676f33ae6eb964f8b08322c0b5f845
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,13 @@
#if UNITY_EDITOR
public class AkWwiseMenu_Mac
{
private const string MENU_PATH = "Help/Wwise Help/";
private const string Platform = "Mac";
[UnityEditor.MenuItem(MENU_PATH + Platform, false, (int) AkWwiseHelpOrder.WwiseHelpOrder)]
public static void OpenDoc()
{
AkDocHelper.OpenDoc(Platform);
}
}
#endif // #if UNITY_EDITOR

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8be9f5b2f27bf6b4a863ada9a0cf0651
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0cfd87c035b29fb4faedb9097b304c66
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,13 @@
#if UNITY_EDITOR
public class AkWwiseMenu_Windows
{
private const string MENU_PATH = "Help/Wwise Help/";
private const string Platform = "Windows";
[UnityEditor.MenuItem(MENU_PATH + Platform, false, (int) AkWwiseHelpOrder.WwiseHelpOrder)]
public static void OpenDoc()
{
AkDocHelper.OpenDoc(Platform);
}
}
#endif // #if UNITY_EDITOR

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13699b1b1a4f1b04491d49457d840453
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9dc14105c2a9e0c49a5b2207bcd80952
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(AcousticTexture))]
public class AcousticTextureDrawer : BaseTypeDrawer
{
protected override string GetComponentName(UnityEditor.SerializedProperty wwiseObjectReference)
{
var componentName = base.GetComponentName(wwiseObjectReference);
return string.IsNullOrEmpty(componentName) ? "None" : componentName;
}
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.AcousticTexture; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0a36ba03468834a459e1a15f3ba50859
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(AuxBus))]
public class AuxBusDrawer : BaseTypeDrawer
{
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.AuxBus; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 73b3e876b5a417843b9d94156e3c43b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(Bank))]
public class BankDrawer : BaseTypeDrawer
{
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.Soundbank; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d0552a3dcd819684e9c5f2d46e8ebccf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,116 @@
namespace AK.Wwise.Editor
{
public abstract class BaseTypeDrawer : UnityEditor.PropertyDrawer
{
public override void OnGUI(UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label)
{
// Get unique control Id
int controlId = UnityEngine.GUIUtility.GetControlID(label, UnityEngine.FocusType.Passive);
UnityEditor.EditorGUI.BeginProperty(position, label, property);
var wwiseObjectReference = property.FindPropertyRelative("WwiseObjectReference");
HandleDragAndDrop(wwiseObjectReference, position);
position = UnityEditor.EditorGUI.PrefixLabel(position, controlId, label);
var style = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.button);
style.alignment = UnityEngine.TextAnchor.MiddleLeft;
style.fontStyle = UnityEngine.FontStyle.Normal;
var componentName = GetComponentName(wwiseObjectReference);
if (string.IsNullOrEmpty(componentName))
{
componentName = "No " + WwiseObjectType + " is currently selected";
style.normal.textColor = UnityEngine.Color.red;
}
if (UnityEngine.GUI.Button(position, componentName, style))
{
new AkWwiseComponentPicker.PickerCreator
{
objectType = WwiseObjectType,
wwiseObjectReference = wwiseObjectReference,
serializedObject = property.serializedObject,
//Current selected object
currentWwiseObjectReference = GetWwiseObjectReference(wwiseObjectReference),
//We're currently clicking focus windows must be the right
pickedSourceEditorWindow = UnityEditor.EditorWindow.focusedWindow,
//Useful to control event source
pickedSourceControlId = controlId,
pickerPosition = AkUtilities.GetLastRectAbsolute(position),
};
}
// Check picker window close event and we're in the right drawer instance using control ID
if (UnityEngine.Event.current.commandName == AkWwiseComponentPicker.PickerClosedEventName &&
controlId == AkWwiseComponentPicker.GetObjectPickerControlID())
{
var oldValue = GetWwiseObjectReference(wwiseObjectReference);
var newValue = AkWwiseComponentPicker.GetObjectPickerObjectReference();
if (oldValue != newValue)
{
// Serialized object updating
wwiseObjectReference.serializedObject.Update();
SetSerializedObject(wwiseObjectReference, newValue);
wwiseObjectReference.serializedObject.ApplyModifiedProperties();
// Force GUI modification, to send back to the base component drawer
UnityEngine.GUI.changed = true;
}
}
UnityEditor.EditorGUI.EndProperty();
}
protected abstract WwiseObjectType WwiseObjectType { get; }
protected virtual string GetComponentName(UnityEditor.SerializedProperty wwiseObjectReference)
{
var reference = wwiseObjectReference.objectReferenceValue as WwiseObjectReference;
return reference ? reference.DisplayName : string.Empty;
}
// These are to be able use other type instead of WwiseObjectReference
protected virtual WwiseObjectReference GetWwiseObjectReference(UnityEditor.SerializedProperty serializedProperty)
{
return serializedProperty.objectReferenceValue as WwiseObjectReference;
}
protected virtual void SetSerializedObject(UnityEditor.SerializedProperty serializedProperty, WwiseObjectReference wwiseObjectReference)
{
serializedProperty.objectReferenceValue = wwiseObjectReference;
}
private void HandleDragAndDrop(UnityEditor.SerializedProperty wwiseObjectReference, UnityEngine.Rect dropArea)
{
var currentEvent = UnityEngine.Event.current;
if (!dropArea.Contains(currentEvent.mousePosition))
return;
if (currentEvent.type != UnityEngine.EventType.DragUpdated && currentEvent.type != UnityEngine.EventType.DragPerform)
return;
var reference = AkWwiseTypes.DragAndDropObjectReference;
if (reference != null && reference.WwiseObjectType != WwiseObjectType)
reference = null;
UnityEditor.DragAndDrop.visualMode = reference != null ? UnityEditor.DragAndDropVisualMode.Link : UnityEditor.DragAndDropVisualMode.Rejected;
if (currentEvent.type == UnityEngine.EventType.DragPerform)
{
UnityEditor.DragAndDrop.AcceptDrag();
if (reference != null)
{
SetSerializedObject(wwiseObjectReference, reference);
}
UnityEditor.DragAndDrop.PrepareStartDrag();
UnityEngine.GUIUtility.hotControl = 0;
}
currentEvent.Use();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c3fe74a19ed66fa45b17eea4d8dbd427
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(Event))]
public class EventDrawer : BaseTypeDrawer
{
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.Event; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e3aded9dafd94a4fa817f8a990e0efa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(RTPC))]
public class RTPCDrawer : BaseTypeDrawer
{
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.GameParameter; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 79c15edebabbb5146b4068a9a9b017f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(State))]
public class StateDrawer : BaseTypeDrawer
{
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.State; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac51eff351c52444c84daaba2054a967
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(Switch))]
public class SwitchDrawer : BaseTypeDrawer
{
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.Switch; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b471700968b33944e854fe5c01131010
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
namespace AK.Wwise.Editor
{
[UnityEditor.CustomPropertyDrawer(typeof(Trigger))]
public class TriggerDrawer : BaseTypeDrawer
{
protected override WwiseObjectType WwiseObjectType { get { return WwiseObjectType.Trigger; } }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2bb6e06f811ade64291a0abc0897e777
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1f452b070fdaf384a8cb91ebc3c474d1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,199 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
public class AkWwiseComponentPicker : UnityEditor.EditorWindow
{
/// <summary>
/// Return the last picked object
/// </summary>
public static WwiseObjectReference GetObjectPickerObjectReference()
{
return s_componentPicker != null ? s_componentPicker.m_CurrentObjectReference : default;
}
/// <summary>
/// Return last control Id which opened the window
/// </summary>
public static int GetObjectPickerControlID()
{
return s_componentPicker != null ? s_componentPicker.m_ObjectSelectorId : default;
}
public const string PickerClosedEventName = "AkWwiseComponentPickerClosed";
public static AkWwiseComponentPicker s_componentPicker;
private AkWwiseTreeView m_treeView;
private bool m_close;
private UnityEditor.SerializedProperty m_WwiseObjectReference;
private UnityEditor.SerializedObject m_serializedObject;
private WwiseObjectType m_type;
UnityEditor.IMGUI.Controls.SearchField m_SearchField;
private WwiseObjectReference m_CurrentObjectReference;
private UnityEditor.EditorWindow m_PickedSourceEditorWindow;
private int m_ObjectSelectorId = 0;
/// <summary>
/// The window to repaint after closing the picker
/// </summary>
public static UnityEditor.EditorWindow LastFocusedWindow = null;
private void Update()
{
//Unity sometimes generates an error when the window is closed from the OnGUI function.
//So We close it here
if (m_close)
{
Close();
if (LastFocusedWindow)
{
UnityEditor.EditorApplication.delayCall += LastFocusedWindow.Repaint;
LastFocusedWindow = null;
}
}
}
private void OnGUI()
{
using (new UnityEngine.GUILayout.VerticalScope())
{
UnityEngine.GUILayout.Space(10);
m_treeView.StoredSearchString = m_SearchField.OnGUI(UnityEngine.GUILayoutUtility.GetRect(position.width - 60, 20), m_treeView.StoredSearchString);
UnityEngine.GUILayout.FlexibleSpace();
UnityEngine.Rect lastRect = UnityEngine.GUILayoutUtility.GetLastRect();
m_treeView.OnGUI(new UnityEngine.Rect(lastRect.x, lastRect.y, position.width, lastRect.height));
using (new UnityEngine.GUILayout.HorizontalScope("box"))
{
if (UnityEngine.GUILayout.Button("Ok"))
{
//Get the selected item
var selectedItem = m_treeView.dataSource.Find(m_treeView.state.lastClickedID);
SetGuid(selectedItem);
}
else if (UnityEngine.GUILayout.Button("Cancel"))
m_close = true;
else if (UnityEngine.GUILayout.Button("Reset"))
{
ResetGuid();
m_close = true;
}
}
}
}
private void SetGuid(AkWwiseTreeViewItem in_element)
{
if (in_element == null || m_type != in_element.objectType) return;
m_serializedObject.Update();
var reference = WwiseObjectReference.FindOrCreateWwiseObject(m_type, in_element.name, in_element.objectGuid);
var groupReference = reference as WwiseGroupValueObjectReference;
if (groupReference)
{
var parent = in_element.parent as AkWwiseTreeViewItem;
groupReference.SetupGroupObjectReference(parent.name, parent.objectGuid);
}
m_CurrentObjectReference = reference;
if (m_PickedSourceEditorWindow)
{
m_PickedSourceEditorWindow.SendEvent(UnityEditor.EditorGUIUtility.CommandEvent(PickerClosedEventName));
}
else
{
m_serializedObject.Update();
m_WwiseObjectReference.objectReferenceValue = reference;
m_serializedObject.ApplyModifiedProperties();
}
m_close = true;
}
private void ResetGuid()
{
m_CurrentObjectReference = null;
if (m_PickedSourceEditorWindow)
{
m_PickedSourceEditorWindow.SendEvent(UnityEditor.EditorGUIUtility.CommandEvent(PickerClosedEventName));
}
else
{
m_serializedObject.Update();
m_WwiseObjectReference.objectReferenceValue = null;
m_serializedObject.ApplyModifiedProperties();
}
}
public class PickerCreator
{
public UnityEditor.SerializedProperty wwiseObjectReference;
public WwiseObjectType objectType;
public UnityEngine.Rect pickerPosition;
public UnityEditor.SerializedObject serializedObject;
public WwiseObjectReference currentWwiseObjectReference;
public UnityEditor.EditorWindow pickedSourceEditorWindow;
public int pickedSourceControlId = 0;
private int minPickerWidth = 300;
internal PickerCreator()
{
UnityEditor.EditorApplication.delayCall += DelayCall;
}
private void DelayCall()
{
if (s_componentPicker != null)
return;
s_componentPicker = CreateInstance<AkWwiseComponentPicker>();
//position the window below the button
var pos = new UnityEngine.Rect(pickerPosition.x, pickerPosition.yMax, 0, 0);
//If the window gets out of the screen, we place it on top of the button instead
if (pickerPosition.yMax > UnityEngine.Screen.currentResolution.height / 2)
pos.y = pickerPosition.y - UnityEngine.Screen.currentResolution.height / 2;
//We show a drop down window which is automatically destroyed when focus is lost
s_componentPicker.ShowAsDropDown(pos,
new UnityEngine.Vector2(pickerPosition.width >= minPickerWidth ? pickerPosition.width : minPickerWidth,
UnityEngine.Screen.currentResolution.height / 2));
s_componentPicker.m_WwiseObjectReference = wwiseObjectReference;
s_componentPicker.m_serializedObject = serializedObject;
s_componentPicker.m_type = objectType;
s_componentPicker.m_CurrentObjectReference = currentWwiseObjectReference;
s_componentPicker.m_PickedSourceEditorWindow = pickedSourceEditorWindow;
s_componentPicker.m_ObjectSelectorId = pickedSourceControlId;
UnityEditor.IMGUI.Controls.TreeViewState treeViewState = new UnityEditor.IMGUI.Controls.TreeViewState();
s_componentPicker.m_treeView = new AkWwiseTreeView(treeViewState, AkWwiseProjectInfo.GetTreeData(), objectType);
s_componentPicker.m_treeView.DragDropEnabled = false;
s_componentPicker.m_treeView.SetDoubleClickFunction(s_componentPicker.SetGuid);
s_componentPicker.m_SearchField = new UnityEditor.IMGUI.Controls.SearchField();
s_componentPicker.m_SearchField.downOrUpArrowKeyPressed += s_componentPicker.m_treeView.SetFocusAndEnsureSelectedItem;
s_componentPicker.m_SearchField.SetFocus();
var reference = currentWwiseObjectReference;
if (reference)
{
s_componentPicker.m_treeView.dataSource.SelectItem(reference.Guid);
}
}
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f64cbdeb252c84438649da05a61c59f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,233 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
public class AkWwisePicker : UnityEditor.EditorWindow
{
[UnityEngine.SerializeField] UnityEditor.IMGUI.Controls.TreeViewState m_treeViewState;
public static AkWwiseTreeView m_treeView;
UnityEditor.IMGUI.Controls.SearchField m_SearchField;
[UnityEditor.MenuItem("Window/Wwise Picker", false, (int)AkWwiseWindowOrder.WwisePicker)]
public static void InitPickerWindow()
{
GetWindow<AkWwisePicker>("Wwise Picker", true,
typeof(UnityEditor.EditorWindow).Assembly.GetType("UnityEditor.ConsoleWindow"));
}
public void OnEnable()
{
if (m_treeViewState == null)
m_treeViewState = new UnityEditor.IMGUI.Controls.TreeViewState();
var multiColumnHeaderState = AkWwiseTreeView.CreateDefaultMultiColumnHeaderState();
var multiColumnHeader = new UnityEditor.IMGUI.Controls.MultiColumnHeader(multiColumnHeaderState);
m_treeView = new AkWwiseTreeView(m_treeViewState, multiColumnHeader, AkWwiseProjectInfo.GetTreeData());
m_treeView.SetDoubleClickFunction(PlayPauseItem);
m_treeView.dirtyDelegate = RequestRepaint;
m_SearchField = new UnityEditor.IMGUI.Controls.SearchField();
m_SearchField.downOrUpArrowKeyPressed += m_treeView.SetFocusAndEnsureSelectedItem;
m_SearchField.SetFocus();
}
public static void Refresh(bool ignoreIfWaapi = false)
{
if (AkWwiseProjectInfo.GetData().currentDataSource == AkWwiseProjectInfo.DataSourceType.WwiseAuthoring && ignoreIfWaapi)
{
return;
}
if (m_treeView != null)
{
m_treeView.dataSource.FetchData();
};
}
private void PlayPauseItem(AkWwiseTreeViewItem item)
{
if (m_treeView != null && m_treeView.CheckWaapi())
AkWaapiUtilities.TogglePlayEvent(item.objectType, item.objectGuid);
}
private bool isDirty;
public void RequestRepaint()
{
isDirty = true;
}
void Update()
{
if (isDirty)
{
Repaint();
m_treeView.Reload();
isDirty = false;
}
if (AkWwiseEditorSettings.Instance.UseWaapi)
{
AkWwiseProjectInfo.WaapiPickerData.Update();
}
}
public void OnGUI()
{
AkWwiseProjectInfo.DataSourceType ds;
var buttonWidth = 150;
using (new UnityEngine.GUILayout.HorizontalScope("box"))
{
ds = (AkWwiseProjectInfo.DataSourceType)UnityEditor.EditorGUILayout.EnumPopup(
AkWwiseProjectInfo.GetData().currentDataSource, UnityEngine.GUILayout.Width(buttonWidth));
UnityEngine.GUILayout.Space(5);
var projectData = AkWwiseProjectInfo.GetData();
if (ds != projectData.currentDataSource)
{
projectData.currentDataSource = ds;
m_treeView.SetDataSource(AkWwiseProjectInfo.GetTreeData());
}
if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem)
{
projectData.autoPopulateEnabled =
UnityEngine.GUILayout.Toggle(projectData.autoPopulateEnabled, "Auto populate");
}
else
{
projectData.AutoSyncSelection =
UnityEngine.GUILayout.Toggle(projectData.AutoSyncSelection, "Autosync selection");
AkWwiseProjectInfo.WaapiPickerData.AutoSyncSelection = projectData.AutoSyncSelection;
}
UnityEngine.GUILayout.FlexibleSpace();
if (UnityEngine.GUILayout.Button("Refresh Project", UnityEngine.GUILayout.Width(buttonWidth)))
{
if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem)
{
AkWwiseProjectInfo.Populate();
}
Refresh();
}
if (UnityEngine.GUILayout.Button("Generate SoundBanks", UnityEngine.GUILayout.Width(buttonWidth)))
{
if (AkUtilities.IsSoundbankGenerationAvailable())
{
AkUtilities.GenerateSoundbanks();
}
else
{
UnityEngine.Debug.LogError("Access to Wwise is required to generate the SoundBanks. Please go to Edit > Project Settings... and set the Wwise Application Path found in the Wwise Editor view.");
}
}
if (projectData.autoPopulateEnabled && AkUtilities.IsWwiseProjectAvailable)
AkWwiseWWUBuilder.StartWWUWatcher();
else
AkWwiseWWUBuilder.StopWWUWatcher();
}
using (new UnityEngine.GUILayout.HorizontalScope("box"))
{
var search_width = System.Math.Max(position.width / 3, buttonWidth * 2);
if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem)
{
m_treeView.StoredSearchString = m_SearchField.OnGUI(UnityEngine.GUILayoutUtility.GetRect(search_width, 20), m_treeView.StoredSearchString);
UnityEngine.GUILayout.FlexibleSpace();
}
else
{
m_treeView.StoredSearchString = m_SearchField.OnGUI(UnityEngine.GUILayoutUtility.GetRect(search_width, 20), m_treeView.StoredSearchString);
UnityEngine.GUILayout.FlexibleSpace();
var labelStyle = new UnityEngine.GUIStyle();
labelStyle.richText = true;
UnityEngine.GUILayout.Label(AkWaapiUtilities.GetStatusString(), labelStyle);
}
}
UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);
UnityEngine.GUILayout.FlexibleSpace();
UnityEngine.Rect lastRect = UnityEngine.GUILayoutUtility.GetLastRect();
m_treeView.OnGUI(new UnityEngine.Rect(lastRect.x, lastRect.y, position.width, lastRect.height));
if (UnityEngine.GUI.changed && AkUtilities.IsWwiseProjectAvailable)
UnityEditor.EditorUtility.SetDirty(AkWwiseProjectInfo.GetData());
}
static void SelectInWwisePicker(System.Guid guid)
{
InitPickerWindow();
m_treeView.SelectItem(guid);
}
[UnityEditor.MenuItem("CONTEXT/AkBank/Select in Wwise Picker")]
[UnityEditor.MenuItem("CONTEXT/AkAmbient/Select in Wwise Picker")]
[UnityEditor.MenuItem("CONTEXT/AkEvent/Select in Wwise Picker")]
[UnityEditor.MenuItem("CONTEXT/AkState/Select in Wwise Picker")]
[UnityEditor.MenuItem("CONTEXT/AkSwitch/Select in Wwise Picker")]
static void SelectItemInWwisePicker(UnityEditor.MenuCommand command)
{
AkTriggerHandler component = (AkTriggerHandler)command.context;
try
{
var data = component.GetType().GetField("data");
var guid = (data.GetValue(component) as AK.Wwise.BaseType).ObjectReference.Guid;
SelectInWwisePicker(guid);
}
catch { }
}
[UnityEditor.MenuItem("CONTEXT/AkRoom/Select Aux Bus in Wwise Picker")]
static void SelectAkRoomAuxBusInWwisePicker(UnityEditor.MenuCommand command)
{
AkRoom component = (AkRoom)command.context;
SelectInWwisePicker(component.reverbAuxBus.ObjectReference.Guid);
}
[UnityEditor.MenuItem("CONTEXT/AkRoom/Select Event in Wwise Picker")]
static void SelectAkRoomEventInWwisePicker(UnityEditor.MenuCommand command)
{
AkRoom component = (AkRoom)command.context;
SelectInWwisePicker(component.roomToneEvent.ObjectReference.Guid);
}
[UnityEditor.MenuItem("CONTEXT/AkSurfaceReflector/Select in Wwise Picker")]
static void SelectReflectorTextureItemInWwisePicker(UnityEditor.MenuCommand command)
{
AkSurfaceReflector component = (AkSurfaceReflector)command.context;
if (component.AcousticTextures.Length >0 && component.AcousticTextures[0].ObjectReference !=null)
{
SelectInWwisePicker(component.AcousticTextures[0].ObjectReference.Guid);
}
}
[UnityEditor.MenuItem("CONTEXT/AkEnvironment/Select in Wwise Picker")]
static void SelectEnvironmentItemInWwisePicker(UnityEditor.MenuCommand command)
{
AkEnvironment component = (AkEnvironment)command.context;
SelectInWwisePicker(component.data.ObjectReference.Guid);
}
[UnityEditor.MenuItem("CONTEXT/AkEarlyReflections/Select in Wwise Picker")]
static void SelectReflectionsItemInWwisePicker(UnityEditor.MenuCommand command)
{
AkEarlyReflections component = (AkEarlyReflections)command.context;
SelectInWwisePicker(component.reflectionsAuxBus.ObjectReference.Guid);
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc793ecb16bff044dba5442507fae6ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,407 @@
using UnityEngine;
public class AkWwiseProjectData : UnityEngine.ScriptableObject
{
public System.Collections.Generic.List<AkInfoWorkUnit> AcousticTextureWwu =
new System.Collections.Generic.List<AkInfoWorkUnit>();
public System.Collections.Generic.List<AkInfoWorkUnit> AuxBusWwu =
new System.Collections.Generic.List<AkInfoWorkUnit>();
public System.Collections.Generic.List<AkInfoWorkUnit> BankWwu =
new System.Collections.Generic.List<AkInfoWorkUnit>();
public System.Collections.Generic.List<EventWorkUnit> EventWwu =
new System.Collections.Generic.List<EventWorkUnit>();
public System.Collections.Generic.List<AkInfoWorkUnit> RtpcWwu =
new System.Collections.Generic.List<AkInfoWorkUnit>();
public System.Collections.Generic.List<GroupValWorkUnit> StateWwu =
new System.Collections.Generic.List<GroupValWorkUnit>();
public System.Collections.Generic.List<GroupValWorkUnit> SwitchWwu =
new System.Collections.Generic.List<GroupValWorkUnit>();
public System.Collections.Generic.List<AkInfoWorkUnit> TriggerWwu =
new System.Collections.Generic.List<AkInfoWorkUnit>();
////Contains the int id of all items that are expanded in the Wwise picker
public System.Collections.Generic.List<int> ExpandedFileSystemItemIds = new System.Collections.Generic.List<int>();
public System.Collections.Generic.List<int> ExpandedWaapiItemIds = new System.Collections.Generic.List<int>();
public bool AutoSyncSelection;
public bool autoPopulateEnabled = true;
public AkWwiseProjectInfo.DataSourceType currentDataSource;
public string CurrentPluginConfig;
public System.Collections.ArrayList GetWwuListByString(string in_wwuType)
{
if (string.Equals(in_wwuType, "Events", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(EventWwu);
if (string.Equals(in_wwuType, "States", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(StateWwu);
if (string.Equals(in_wwuType, "Switches", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(SwitchWwu);
if (string.Equals(in_wwuType, "Master-Mixer Hierarchy", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(AuxBusWwu);
if (string.Equals(in_wwuType, "SoundBanks", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(BankWwu);
if (string.Equals(in_wwuType, "Game Parameters", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(RtpcWwu);
if (string.Equals(in_wwuType, "Triggers", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(TriggerWwu);
if (string.Equals(in_wwuType, "Virtual Acoustics", System.StringComparison.OrdinalIgnoreCase))
return System.Collections.ArrayList.Adapter(AcousticTextureWwu);
return null;
}
public float GetEventMaxAttenuation(uint eventID)
{
var Event = GetEventInfo(eventID);
return Event != null ? Event.maxAttenuation : 0.0f;
}
public Event GetEventInfo(uint eventID)
{
foreach (var wwu in EventWwu)
{
foreach (var entry in wwu.List)
{
if (entry.Id == eventID)
{
return entry;
}
}
}
return null;
}
public void Reset()
{
EventWwu = new System.Collections.Generic.List<EventWorkUnit>();
StateWwu = new System.Collections.Generic.List<GroupValWorkUnit>();
SwitchWwu = new System.Collections.Generic.List<GroupValWorkUnit>();
BankWwu = new System.Collections.Generic.List<AkInfoWorkUnit>();
AuxBusWwu = new System.Collections.Generic.List<AkInfoWorkUnit>();
RtpcWwu = new System.Collections.Generic.List<AkInfoWorkUnit>();
TriggerWwu = new System.Collections.Generic.List<AkInfoWorkUnit>();
AcousticTextureWwu = new System.Collections.Generic.List<AkInfoWorkUnit>();
}
public void Migrate()
{
foreach (var wwu in EventWwu)
wwu.Migrate();
foreach (var wwu in StateWwu)
wwu.Migrate();
foreach (var wwu in SwitchWwu)
wwu.Migrate();
foreach (var wwu in BankWwu)
wwu.Migrate();
foreach (var wwu in AuxBusWwu)
wwu.Migrate();
foreach (var wwu in RtpcWwu)
wwu.Migrate();
foreach (var wwu in TriggerWwu)
wwu.Migrate();
foreach (var wwu in AcousticTextureWwu)
wwu.Migrate();
UnityEditor.EditorUtility.SetDirty(this);
}
[System.Serializable]
public class ByteArrayWrapper
{
public byte[] bytes;
public ByteArrayWrapper(byte[] byteArray)
{
bytes = byteArray;
}
public static implicit operator ByteArrayWrapper(System.Guid guid) => new ByteArrayWrapper(guid.ToByteArray());
public static implicit operator System.Guid(ByteArrayWrapper bytes) => new System.Guid(bytes.bytes);
}
private static System.Guid GetGuid(byte[] bytes)
{
try
{
return new System.Guid(bytes);
}
catch
{
return System.Guid.Empty;
}
}
[System.Serializable]
public class AkBaseInformation : System.IComparable
{
[UnityEngine.SerializeField]
[UnityEngine.Serialization.FormerlySerializedAs("Name")]
private string name;
public string Name
{
get { return name; }
set
{
name = value;
id = AkUtilities.ShortIDGenerator.Compute(value);
}
}
[UnityEngine.HideInInspector]
[UnityEngine.SerializeField]
[UnityEngine.Serialization.FormerlySerializedAs("Guid")]
private byte[] guid = null;
public System.Guid Guid
{
get { return GetGuid(guid); }
set { guid = value.ToByteArray(); }
}
[UnityEngine.SerializeField]
[UnityEngine.Serialization.FormerlySerializedAs("ID")]
private uint id;
public uint Id
{
get { return id; }
}
[UnityEngine.HideInInspector]
public System.Collections.Generic.List<PathElement> PathAndIcons = new System.Collections.Generic.List<PathElement>();
int System.IComparable.CompareTo(object other)
{
if (other == null)
return 1;
var otherAkInformation = other as AkBaseInformation;
if (otherAkInformation == null)
throw new System.ArgumentException("Object is not of type AkBaseInformation");
return Name.CompareTo(otherAkInformation.Name);
}
private class _CompareByGuid : System.Collections.Generic.IComparer<AkBaseInformation>
{
int System.Collections.Generic.IComparer<AkBaseInformation>.Compare(AkBaseInformation a, AkBaseInformation b)
{
if (a == null)
return b == null ? 0 : -1;
return a.Guid.CompareTo(b.Guid);
}
}
public static System.Collections.Generic.IComparer<AkBaseInformation> CompareByGuid = new _CompareByGuid();
}
[System.Serializable]
public class AkInformation : AkBaseInformation
{
public string Path;
}
[System.Serializable]
public class GroupValue : AkInformation
{
public System.Collections.Generic.List<AkBaseInformation> values =
new System.Collections.Generic.List<AkBaseInformation>();
[UnityEngine.HideInInspector]
[UnityEngine.SerializeField]
private System.Collections.Generic.List<ByteArrayWrapper> ValueGuids =
new System.Collections.Generic.List<ByteArrayWrapper>();
[UnityEngine.HideInInspector]
[UnityEngine.SerializeField]
private System.Collections.Generic.List<PathElement> ValueIcons = new System.Collections.Generic.List<PathElement>();
[UnityEngine.HideInInspector]
[UnityEngine.SerializeField]
[UnityEngine.Serialization.FormerlySerializedAs("values")]
private System.Collections.Generic.List<string> valuesInternal = new System.Collections.Generic.List<string>();
public void Migrate()
{
var count = ValueGuids.Count;
if (count < 1 || count != ValueIcons.Count || count != valuesInternal.Count)
return;
values.Clear();
for (var i = 0; i < count; ++i)
{
var value = new AkBaseInformation
{
Name = valuesInternal[i],
Guid = GetGuid(ValueGuids[i].bytes)
};
value.PathAndIcons.Add(ValueIcons[i]);
values.Add(value);
}
}
}
[System.Serializable]
public class Event : AkInformation
{
public float maxAttenuation;
public float maxDuration = -1;
public float minDuration = -1;
}
[System.Serializable]
public class WorkUnit : System.IComparable
{
public string PhysicalPath;
[UnityEngine.HideInInspector]
public System.Collections.Generic.List<PathElement> PathAndIcons = new System.Collections.Generic.List<PathElement>();
[UnityEngine.Serialization.FormerlySerializedAs("ParentPhysicalPath")]
public string ParentPath;
[UnityEngine.HideInInspector]
[UnityEngine.SerializeField]
private byte[] guid = null;
[UnityEngine.HideInInspector]
[UnityEngine.SerializeField]
[UnityEngine.Serialization.FormerlySerializedAs("Guid")]
private string GuidInternal = string.Empty;
public System.Guid Guid
{
get { return GetGuid(guid); }
set { guid = value.ToByteArray(); }
}
[UnityEngine.HideInInspector]
[UnityEngine.SerializeField]
private long m_lastTime;
public System.DateTime LastTime
{
get { return m_lastTime == 0 ? System.DateTime.MinValue : System.DateTime.FromBinary(m_lastTime); }
set { m_lastTime = value.ToBinary(); }
}
public virtual void Migrate()
{
try
{
Guid = new System.Guid(GuidInternal);
}
catch
{
Guid = System.Guid.Empty;
}
}
int System.IComparable.CompareTo(object other)
{
if (other == null)
return 1;
var otherWwu = other as WorkUnit;
if (otherWwu == null)
throw new System.ArgumentException("Object is not a WorkUnit");
return PhysicalPath.CompareTo(otherWwu.PhysicalPath);
}
public virtual System.Collections.ArrayList GetChildrenArrayList() { return null; }
}
[System.Serializable]
public class GenericWorkUnit<T> : WorkUnit where T : AkInformation
{
public System.Collections.Generic.List<T> List = new System.Collections.Generic.List<T>();
public T Find(string name)
{
foreach (var item in List)
if (item.Name == name)
return item;
return null;
}
public override System.Collections.ArrayList GetChildrenArrayList()
{
return System.Collections.ArrayList.Adapter(List);
}
}
[System.Serializable]
public class AkInfoWorkUnit : GenericWorkUnit<AkInformation> { }
[System.Serializable]
public class EventWorkUnit : GenericWorkUnit<Event> { }
[System.Serializable]
public class GroupValWorkUnit : GenericWorkUnit<GroupValue>
{
public override void Migrate()
{
base.Migrate();
foreach (var item in List)
item.Migrate();
}
}
[System.Serializable]
public class PathElement
{
public string ElementName;
public WwiseObjectType ObjectType;
[UnityEngine.SerializeField]
[UnityEngine.HideInInspector]
private byte[] guid = null;
public System.Guid ObjectGuid
{
get { return GetGuid(guid); }
set { guid = value.ToByteArray(); }
}
public PathElement(string Name, WwiseObjectType objType, System.Guid guid)
{
ElementName = Name;
ObjectType = objType;
ObjectGuid = guid;
}
public static string GetProjectPathString(System.Collections.Generic.List<PathElement> pathElements, int index)
{
string path = "";
for (int i = 0; i<=index && i < pathElements.Count; i++)
{
path += $"/{pathElements[i].ElementName}";
}
return path;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7b9fcd7ddb9dea64c905ea2e2bfa1a68
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,131 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
using System.Runtime.CompilerServices;
using UnityEngine;
public static class AkWwiseProjectInfo
{
private const string DataFileName = "AkWwiseProjectData.asset";
private static string WwiseEditorDirectory = System.IO.Path.Combine("Wwise", "Editor");
private static string DataRelativeDirectory = System.IO.Path.Combine(WwiseEditorDirectory, "ProjectData");
private static string DataRelativePath = System.IO.Path.Combine(DataRelativeDirectory, DataFileName);
private static string DataAssetPath = System.IO.Path.Combine("Assets", DataRelativePath);
public static AkWwiseProjectData m_Data;
public static AkWwiseTreeWAAPIDataSource m_WaapiPickerData = new AkWwiseTreeWAAPIDataSource();
public static AkWwiseTreeProjectDataSource m_ProjectPickerData = new AkWwiseTreeProjectDataSource();
public enum DataSourceType
{
WwiseAuthoring,
FileSystem
}
public static AkWwiseTreeWAAPIDataSource WaapiPickerData
{
get
{
return m_WaapiPickerData;
}
}
public static AkWwiseTreeProjectDataSource ProjectPickerData
{
get
{
return m_ProjectPickerData;
}
}
public static AkWwiseTreeDataSource GetTreeData()
{
AkWwiseTreeDataSource treeData;
if (GetData().currentDataSource == DataSourceType.WwiseAuthoring)
{
treeData = WaapiPickerData;
}
else
{
treeData = ProjectPickerData;
}
return treeData;
}
private static bool WwiseFolderExists()
{
return System.IO.Directory.Exists(System.IO.Path.Combine(UnityEngine.Application.dataPath, "Wwise"));
}
public static AkWwiseProjectData GetData()
{
if (m_Data == null && WwiseFolderExists())
{
try
{
m_Data = UnityEditor.AssetDatabase.LoadAssetAtPath<AkWwiseProjectData>(DataAssetPath);
if (m_Data == null)
{
var dataAbsolutePath = System.IO.Path.Combine(UnityEngine.Application.dataPath, DataRelativePath);
var dataExists = System.IO.File.Exists(dataAbsolutePath);
if (!dataExists)
{
var dataAbsoluteDirectory = System.IO.Path.Combine(UnityEngine.Application.dataPath, DataRelativeDirectory);
if (!System.IO.Directory.Exists(dataAbsoluteDirectory))
System.IO.Directory.CreateDirectory(dataAbsoluteDirectory);
}
m_Data = UnityEngine.ScriptableObject.CreateInstance<AkWwiseProjectData>();
if (dataExists)
UnityEngine.Debug.LogWarning("WwiseUnity: Unable to load asset at <" + dataAbsolutePath + ">.");
else
{
#if UNITY_2019_3_OR_LATER
if (UnityEditor.EditorSettings.assetPipelineMode == UnityEditor.AssetPipelineMode.Version2)
{
UnityEditor.EditorApplication.delayCall += () => UnityEditor.AssetDatabase.CreateAsset(m_Data, DataAssetPath);
}
else
#else
{
UnityEditor.AssetDatabase.CreateAsset(m_Data, DataAssetPath);
}
#endif
}
}
}
catch (System.Exception e)
{
UnityEngine.Debug.LogError("WwiseUnity: Unable to load Wwise Data: " + e);
}
}
return m_Data;
}
public static bool Populate()
{
var bDirty = false;
if (AkUtilities.IsWwiseProjectAvailable)
{
bDirty = AkWwiseWWUBuilder.Populate();
bDirty |= AkWwiseXMLBuilder.Populate();
if (bDirty)
{
UnityEditor.EditorUtility.SetDirty(GetData());
UnityEditor.AssetDatabase.SaveAssets();
UnityEditor.AssetDatabase.Refresh();
}
}
return bDirty;
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 008080a84899ef046b02bf218d816649
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,240 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2020 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
using System.Linq;
using System.Collections.Generic;
using UnityEditor.IMGUI.Controls;
public abstract class AkWwiseTreeDataSource
{
public List<AkWwiseTreeViewItem> Data { get; protected set; }
public AkWwiseTreeViewItem ProjectRoot { get; protected set; }
public Dictionary<WwiseObjectType, AkWwiseTreeViewItem> wwiseObjectFolders;
public AkWwiseTreeViewItem SearchRoot { get; protected set; }
public List<AkWwiseTreeViewItem> SearchItems { get; protected set; }
public AkWwiseTreeView TreeView { protected get; set; }
public event System.Action modelChanged;
static readonly List<TreeViewItem> collapsedChildren = new List<TreeViewItem>();
public static List<TreeViewItem> CreateCollapsedChild()
{
// To mark a collapsed parent we use a list with one element that is null.
// The null element in the children list ensures we show the collapse arrow.
// Reuse read-only list to prevent allocations.
if (collapsedChildren.Count != 1 || collapsedChildren[0] != null)
{
collapsedChildren.Clear();
collapsedChildren.Add(null);
}
return collapsedChildren;
}
public AkWwiseTreeViewItem CreateProjectRootItem()
{
return new AkWwiseTreeViewItem(System.IO.Path.GetFileNameWithoutExtension(AkWwiseEditorSettings.Instance.WwiseProjectPath),
-1, GenerateUniqueID(), System.Guid.Empty, WwiseObjectType.Project);
}
protected int m_MaxID;
public int GenerateUniqueID()
{
return ++m_MaxID;
}
public AkWwiseTreeDataSource()
{
Data = new List<AkWwiseTreeViewItem>(100);
wwiseObjectFolders = new Dictionary<WwiseObjectType, AkWwiseTreeViewItem>();
ProjectRoot = CreateProjectRootItem();
}
public virtual AkWwiseTreeViewItem Find(IEnumerable<AkWwiseTreeViewItem> data, System.Guid guid)
{
return data.FirstOrDefault(element => element.objectGuid == guid);
}
public virtual AkWwiseTreeViewItem Find(IEnumerable<AkWwiseTreeViewItem> data, System.Guid guid, string name)
{
return data.FirstOrDefault(element => element.objectGuid == guid && element.name ==name);
}
public virtual AkWwiseTreeViewItem Find(IEnumerable<AkWwiseTreeViewItem> data, int id)
{
return data.FirstOrDefault(element => element.id == id);
}
public virtual AkWwiseTreeViewItem Find(int id)
{
return Find(Data, id);
}
public virtual AkWwiseTreeViewItem Find(System.Guid guid)
{
return Find(Data, guid);
}
public virtual AkWwiseTreeViewItem Find(System.Guid guid, string name)
{
return Find(Data, guid, name);
}
public IEnumerable<System.Guid> GetGuidsFromIds(IEnumerable<int> ids)
{
if (Data.Count == 0) return new List<System.Guid>();
return Data.Where(el => ids.Contains(el.id)).Select(el => el.objectGuid);
}
public IEnumerable<int> GetIdsFromGuids(IEnumerable<System.Guid> guids)
{
if (Data.Count == 0) return new List<int>();
return Data.Where(el => guids.Contains(el.objectGuid)).Select(el => el.id);
}
public IList<int> GetAncestors(int id)
{
var parents = new List<int>();
TreeViewItem el = Find(id);
if (el != null)
{
while (el.parent != null)
{
parents.Add(el.parent.id);
el = el.parent;
}
}
return parents;
}
public IList<int> GetDescendantsThatHaveChildren(int id)
{
AkWwiseTreeViewItem searchFromThis = Find(id);
if (searchFromThis != null)
{
return GetParentsBelowStackBased(searchFromThis);
}
return new List<int>();
}
IList<int> GetParentsBelowStackBased(AkWwiseTreeViewItem searchFromThis)
{
Stack<AkWwiseTreeViewItem> stack = new Stack<AkWwiseTreeViewItem>();
stack.Push(searchFromThis);
var parentsBelow = new List<int>();
while (stack.Count > 0)
{
AkWwiseTreeViewItem current = stack.Pop();
if (current.hasChildren)
{
parentsBelow.Add(current.id);
foreach (AkWwiseTreeViewItem el in current.children)
{
stack.Push(el);
}
}
}
return parentsBelow;
}
abstract public AkWwiseTreeViewItem GetComponentDataRoot(WwiseObjectType objectType);
protected void Changed()
{
if (modelChanged != null)
modelChanged();
}
public bool IsExpanded(TreeViewState state, int id)
{
if (ProjectRoot != null && id == ProjectRoot.id)
{
return true;
}
return state.expandedIDs.BinarySearch(id) >= 0;
}
public abstract void FetchData();
public static int GetDepthFromPath(string path)
{
return path.Split('\\').Length - 1;
}
public virtual void ScheduleRebuild()
{
}
public abstract void SaveExpansionStatus(List<int> itemIds);
public abstract List<int> LoadExpansionSatus();
public string currentSearchString;
public bool isSearching = false;
public abstract AkWwiseTreeViewItem GetSearchResults();
public abstract void UpdateSearchResults(string searchString, WwiseObjectType objectType);
public virtual void SelectItem(System.Guid itemGuid)
{
TreeView.ExpandItem(itemGuid, true);
}
public virtual void LoadComponentData(WwiseObjectType objectType) { }
public virtual void ItemSelected(AkWwiseTreeViewItem itemID) { }
public virtual void SelectObjectInAuthoring(System.Guid objectGuid) { }
public abstract void SetExpanded(IEnumerable<System.Guid> ids);
}
#region Utility Functions
public static class TreeUtility
{
public static void CopyTree(AkWwiseTreeViewItem sourceRoot, AkWwiseTreeViewItem destRoot)
{
for (int i = 0; i < sourceRoot.children.Count(); i++)
{
var currItem = sourceRoot.children[i];
var newItem = new AkWwiseTreeViewItem(currItem as AkWwiseTreeViewItem);
CopyTree(currItem as AkWwiseTreeViewItem, newItem);
destRoot.AddWwiseItemChild(newItem);
}
}
public static void TreeToList(AkWwiseTreeViewItem root, IList<AkWwiseTreeViewItem> result)
{
if (root == null)
return;
if (result == null)
return;
result.Clear();
Stack<AkWwiseTreeViewItem> stack = new Stack<AkWwiseTreeViewItem>();
stack.Push(root);
while (stack.Count > 0)
{
AkWwiseTreeViewItem current = stack.Pop();
result.Add(current);
if (current.children != null && current.children.Count > 0)
{
for (int i = current.children.Count - 1; i >= 0; i--)
{
if (current.children[i] != null)
{
stack.Push((AkWwiseTreeViewItem)current.children[i]);
}
}
}
}
}
}
#endregion
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d93836597034c343b184cc57f01cfa9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,281 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2020 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
using System.Linq;
using System.Collections.Generic;
public class AkWwiseTreeProjectDataSource : AkWwiseTreeDataSource
{
public AkWwiseTreeProjectDataSource() : base()
{
}
public override void FetchData()
{
Data.Clear();
m_MaxID = 0;
InitializeMinimal();
Changed();
}
protected void InitializeMinimal()
{
ProjectRoot = CreateProjectRootItem();
ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(WwiseObjectType.Event));
ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(WwiseObjectType.Switch));
ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(WwiseObjectType.State));
ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(WwiseObjectType.Soundbank));
ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(WwiseObjectType.AuxBus));
ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(WwiseObjectType.AcousticTexture));
TreeUtility.TreeToList(ProjectRoot, Data);
}
public override AkWwiseTreeViewItem GetComponentDataRoot(WwiseObjectType objectType)
{
if (!wwiseObjectFolders.ContainsKey(objectType))
ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(objectType));
var tempProjectRoot = new AkWwiseTreeViewItem(ProjectRoot);
tempProjectRoot.AddWwiseItemChild(wwiseObjectFolders[objectType]);
return tempProjectRoot;
}
protected AkWwiseTreeViewItem BuildObjectTypeTree(WwiseObjectType objectType)
{
var rootElement = new AkWwiseTreeViewItem();
switch (objectType)
{
case WwiseObjectType.AuxBus:
rootElement = BuildTree("Master-Mixer Hierarchy", AkWwiseProjectInfo.GetData().AuxBusWwu);
break;
case WwiseObjectType.Event:
rootElement = BuildTree("Events", AkWwiseProjectInfo.GetData().EventWwu);
break;
case WwiseObjectType.Soundbank:
rootElement = BuildTree("SoundBanks", AkWwiseProjectInfo.GetData().BankWwu);
break;
case WwiseObjectType.State:
rootElement = BuildTree("States", AkWwiseProjectInfo.GetData().StateWwu);
break;
case WwiseObjectType.Switch:
case WwiseObjectType.SwitchGroup:
rootElement = BuildTree("Switches", AkWwiseProjectInfo.GetData().SwitchWwu);
break;
case WwiseObjectType.GameParameter:
rootElement = BuildTree("Game Parameters", AkWwiseProjectInfo.GetData().RtpcWwu);
break;
case WwiseObjectType.Trigger:
rootElement = BuildTree("Triggers", AkWwiseProjectInfo.GetData().TriggerWwu);
break;
case WwiseObjectType.AcousticTexture:
rootElement = BuildTree("Virtual Acoustics", AkWwiseProjectInfo.GetData().AcousticTextureWwu);
break;
}
wwiseObjectFolders[objectType] = rootElement;
return rootElement;
}
public AkWwiseTreeViewItem BuildTree(string name,
List<AkWwiseProjectData.EventWorkUnit> Events)
{
var akInfoWwu = new List<AkWwiseProjectData.AkInfoWorkUnit>(Events.Count);
for (var i = 0; i < Events.Count; i++)
{
akInfoWwu.Add(new AkWwiseProjectData.AkInfoWorkUnit());
akInfoWwu[i].PhysicalPath = Events[i].PhysicalPath;
akInfoWwu[i].ParentPath = Events[i].ParentPath;
akInfoWwu[i].PathAndIcons = Events[i].PathAndIcons;
akInfoWwu[i].Guid = Events[i].Guid;
akInfoWwu[i].List = Events[i].List.ConvertAll(x => (AkWwiseProjectData.AkInformation)x);
}
return BuildTree(name, akInfoWwu);
}
public AkWwiseTreeViewItem BuildTree(string name, List<AkWwiseProjectData.GroupValWorkUnit> workUnits)
{
var rootFolder = new AkWwiseTreeViewItem(name, 1, GenerateUniqueID(), System.Guid.Empty, WwiseObjectType.PhysicalFolder);
foreach (var wwu in workUnits)
{
var wwuItem = AddTreeItem(rootFolder, wwu.PathAndIcons);
foreach (var group in wwu.List)
{
var groupElement = AddTreeItem(wwuItem, group.PathAndIcons);
foreach (var child in group.values)
{
AddTreeItem(groupElement, child.PathAndIcons);
}
}
}
return rootFolder;
}
private AkWwiseTreeViewItem BuildTree(string name, List<AkWwiseProjectData.AkInfoWorkUnit> workUnits)
{
var rootFolder = new AkWwiseTreeViewItem(name, 1, GenerateUniqueID(), System.Guid.Empty, WwiseObjectType.PhysicalFolder);
foreach (var wwu in workUnits)
{
var wwuElement = AddTreeItem(rootFolder, wwu.PathAndIcons);
if (wwu.List.Count > 0)
{
foreach (var akInfo in wwu.List)
{
AddTreeItem(wwuElement, akInfo.PathAndIcons);
}
}
}
return rootFolder;
}
private AkWwiseTreeViewItem AddTreeItem(AkWwiseTreeViewItem parentWorkUnit, List<AkWwiseProjectData.PathElement> pathAndIcons)
{
var pathDepth = pathAndIcons.Count;
var treeDepth = pathDepth + 1;
AkWwiseTreeViewItem newItem;
AkWwiseProjectData.PathElement pathElem;
var parent = parentWorkUnit;
if (pathDepth > parentWorkUnit.depth)
{
var unaccountedDepth = pathDepth - parentWorkUnit.depth;
for (; unaccountedDepth > 0; unaccountedDepth--)
{
var pathIndex = pathAndIcons.Count - unaccountedDepth;
pathElem = pathAndIcons[pathIndex];
if (pathElem.ObjectGuid == System.Guid.Empty)
{
var path = AkWwiseProjectData.PathElement.GetProjectPathString(pathAndIcons, pathIndex);
newItem = Find(pathElem.ObjectGuid, pathElem.ElementName, path);
}
else
newItem = Find(pathElem.ObjectGuid, pathElem.ElementName);
if (newItem == null)
{
newItem = new AkWwiseTreeViewItem(pathElem.ElementName, treeDepth - unaccountedDepth, GenerateUniqueID(), pathElem.ObjectGuid, pathElem.ObjectType);
parent.AddWwiseItemChild(newItem);
Data.Add(newItem);
}
parent = newItem;
}
}
pathElem = pathAndIcons.Last();
newItem = Find(pathElem.ObjectGuid);
if (newItem == null)
{
newItem = new AkWwiseTreeViewItem(pathElem.ElementName, treeDepth, GenerateUniqueID(), pathElem.ObjectGuid, pathElem.ObjectType);
parent.AddWwiseItemChild(newItem);
Data.Add(newItem);
}
return newItem;
}
public virtual AkWwiseTreeViewItem Find(System.Guid guid, string name, string path)
{
var results = Data.FindAll(element => element.objectGuid == guid && element.name == name);
foreach (var r in results)
{
var itemPath = GetProjectPath(r,"");
if (itemPath == path)
{
return r;
}
}
return null;
}
public string GetProjectPath(AkWwiseTreeViewItem item, string currentpath)
{
currentpath = $"/{item.name}{currentpath}";
if (item.parent == null || item.parent == ProjectRoot)
{
return currentpath;
}
return GetProjectPath(item.parent as AkWwiseTreeViewItem, currentpath);
}
public override AkWwiseTreeViewItem GetSearchResults()
{
return SearchRoot;
}
public override void UpdateSearchResults(string searchString, WwiseObjectType objectType)
{
SearchRoot = new AkWwiseTreeViewItem(ProjectRoot);
if (objectType != WwiseObjectType.None)
{
SearchRoot = new AkWwiseTreeViewItem(ProjectRoot);
var objectRoot = new AkWwiseTreeViewItem(wwiseObjectFolders[objectType]);
TreeUtility.CopyTree(wwiseObjectFolders[objectType], objectRoot);
SearchRoot.AddWwiseItemChild(objectRoot);
}
else
{
TreeUtility.CopyTree(ProjectRoot, SearchRoot);
}
FilterTree(SearchRoot, searchString);
}
void FilterTree(AkWwiseTreeViewItem treeElement, string searchFilter)
{
var ItemsToRemove = new List<AkWwiseTreeViewItem>();
for (int i = 0; i < treeElement.children.Count(); i++)
{
var current = treeElement.children[i] as AkWwiseTreeViewItem;
FilterTree(current, searchFilter);
if (current.name.IndexOf(searchFilter, System.StringComparison.OrdinalIgnoreCase) == -1 && current.children.Count == 0)
{
ItemsToRemove.Add(current);
}
}
for (int i = 0; i < ItemsToRemove.Count(); i++)
{
treeElement.children.Remove(ItemsToRemove[i]);
}
}
public override void SetExpanded(IEnumerable<System.Guid> ids)
{
if (TreeView != null)
{
TreeView.state.expandedIDs = GetIdsFromGuids(ids).ToList();
}
Changed();
}
public override void SaveExpansionStatus(List<int> expandedItems )
{
AkWwiseProjectInfo.GetData().ExpandedFileSystemItemIds = expandedItems;
}
public override List<int> LoadExpansionSatus()
{
return AkWwiseProjectInfo.GetData().ExpandedFileSystemItemIds;
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 50db06aaedd9e6644a4daf4fe3254ce3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,966 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2020 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
using System.Linq;
using System.Collections.Generic;
using UnityEditor.IMGUI.Controls;
public class AkWwiseTreeView : TreeView
{
public enum PickerMode
{
FullPicker,
ComponentPicker
}
private PickerMode m_pickerMode;
private WwiseObjectType componentObjectType;
AkWwisePickerIcons icons;
protected AkWwiseTreeDataSource m_dataSource;
public AkWwiseTreeDataSource dataSource { get { return m_dataSource; } }
readonly IList<AkWwiseTreeViewItem> m_Rows = new List<AkWwiseTreeViewItem>(100);
public event System.Action treeChanged;
private static Dictionary<WwiseObjectType, UnityEditor.MonoScript> DragDropMonoScriptMap;
private static Dictionary<System.Type, WwiseObjectType> ScriptTypeMap
= new Dictionary<System.Type, WwiseObjectType>{
{ typeof(AkAmbient), WwiseObjectType.Event },
{ typeof(AkBank), WwiseObjectType.Soundbank },
{ typeof(AkEnvironment), WwiseObjectType.AuxBus },
{ typeof(AkState), WwiseObjectType.State },
{ typeof(AkSurfaceReflector), WwiseObjectType.AcousticTexture },
{ typeof(AkSwitch), WwiseObjectType.Switch },
};
public AkWwiseTreeView(TreeViewState treeViewState,
MultiColumnHeader multiColumnHeader, AkWwiseTreeDataSource data)
: base(treeViewState, multiColumnHeader)
{
m_pickerMode = PickerMode.FullPicker;
Initialize(data);
Reload();
}
public AkWwiseTreeView(TreeViewState treeViewState,
AkWwiseTreeDataSource data, WwiseObjectType componentType)
: base(treeViewState)
{
m_pickerMode = PickerMode.ComponentPicker;
componentObjectType = componentType;
Initialize(data);
data.LoadComponentData(componentObjectType);
Reload();
}
private void Initialize(AkWwiseTreeDataSource data)
{
m_dataSource = data;
m_dataSource.TreeView = this;
m_dataSource.modelChanged += ModelChanged;
this.LoadExpansionStatus();
icons = new AkWwisePickerIcons();
icons.LoadIcons();
DragDropEnabled = true;
extraSpaceBeforeIconAndLabel = AkWwisePickerIcons.kIconWidth;
StoredSearchString = "";
if (DragDropMonoScriptMap == null)
{
DragDropMonoScriptMap = new Dictionary<WwiseObjectType, UnityEditor.MonoScript>();
var scripts = UnityEngine.Resources.FindObjectsOfTypeAll<UnityEditor.MonoScript>();
foreach (var script in scripts)
{
WwiseObjectType wwiseObjectType;
var type = script.GetClass();
if (type != null && ScriptTypeMap.TryGetValue(type, out wwiseObjectType))
DragDropMonoScriptMap[wwiseObjectType] = script;
}
}
UnityEditor.EditorApplication.playModeStateChanged += (UnityEditor.PlayModeStateChange playMode) =>
{
if (playMode == UnityEditor.PlayModeStateChange.ExitingEditMode)
SaveExpansionStatus();
};
UnityEditor.EditorApplication.quitting += SaveExpansionStatus;
}
private bool bSearchStringChanged;
public string m_storedSearchString;
public string StoredSearchString
{
get { return m_storedSearchString; }
set
{
if (m_storedSearchString != value)
{
if (value != string.Empty)
{
bSearchStringChanged = true;
SaveExpansionStatus();
}
else
{
LoadExpansionStatus();
}
}
m_storedSearchString = value;
searchString = value;
}
}
public void SaveExpansionStatus()
{
//Don't save exansion state when searching
if (m_storedSearchString != string.Empty) return;
dataSource.SaveExpansionStatus(new List<int>(state.expandedIDs));
}
public void LoadExpansionStatus()
{
state.expandedIDs = dataSource.LoadExpansionSatus();
}
protected override void ExpandedStateChanged()
{
if (this.m_storedSearchString == string.Empty)
{
this.m_dataSource.ScheduleRebuild();
}
}
void ModelChanged()
{
if (treeChanged != null)
treeChanged();
SetDirty();
}
public delegate void DirtyDelegate();
public DirtyDelegate dirtyDelegate;
public void SetDirty()
{
dirtyDelegate?.Invoke();
}
public override void OnGUI(UnityEngine.Rect rect)
{
if (bSearchStringChanged)
{
if (!m_dataSource.isSearching)
{
m_dataSource.UpdateSearchResults(searchString, componentObjectType);
bSearchStringChanged = false;
}
}
base.OnGUI(rect);
}
protected override TreeViewItem BuildRoot()
{
return m_dataSource.CreateProjectRootItem();
}
public void RebuildRows()
{
BuildRows(new AkWwiseTreeViewItem());
}
protected override IList<TreeViewItem> BuildRows(
TreeViewItem root)
{
m_Rows.Clear();
var dataRoot = m_dataSource.ProjectRoot;
if (m_pickerMode == PickerMode.ComponentPicker)
{
dataRoot = m_dataSource.GetComponentDataRoot(componentObjectType);
}
if (!string.IsNullOrEmpty(searchString))
{
dataRoot = m_dataSource.GetSearchResults();
}
AddChildrenRecursive(dataRoot, m_Rows);
searchString = "";
return m_Rows.Cast<TreeViewItem>().ToList();
}
private bool TestExpanded(AkWwiseTreeViewItem node)
{
if (node.children.Count > 0)
{
if (node.depth ==-1)
{
return true;
}
return IsExpanded(node.id);
}
return false;
}
void AddChildrenRecursive(AkWwiseTreeViewItem parent, IList<AkWwiseTreeViewItem> newRows)
{
if (parent == null)
{
return;
}
foreach (AkWwiseTreeViewItem child in parent.children)
{
var item = new AkWwiseTreeViewItem(child);
item.parent = parent;
item.children = child.children;
newRows.Add(item);
if (child.children.Count > 0)
{
if (TestExpanded(child))
{
AddChildrenRecursive(child, newRows);
}
else
{
item.children = AkWwiseTreeDataSource.CreateCollapsedChild();
}
}
}
}
protected override IList<int> GetAncestors(int id)
{
return m_dataSource.GetAncestors(id);
}
protected override IList<int> GetDescendantsThatHaveChildren(int id)
{
return m_dataSource.GetDescendantsThatHaveChildren(id);
}
public AkWwiseTreeViewItem GetItemByGuid(System.Guid guid)
{
return m_dataSource.Find(m_Rows, guid);
}
public void SelectItem(System.Guid guid)
{
var item = dataSource.Find(guid);
if (item == null && AkWwiseProjectInfo.GetData().currentDataSource == AkWwiseProjectInfo.DataSourceType.WwiseAuthoring)
{
m_dataSource.SelectItem(guid);
}
else
{
HighlightItem(item, true);
}
}
public bool ExpandItem(System.Guid guid, bool select)
{
var item = GetItemByGuid(guid);
if (item != null)
{
HighlightItem(item, select);
return true;
}
item = m_dataSource.Find(guid);
if (item != null)
{
var parent = item.parent;
while (parent != null && GetItemByGuid((parent as AkWwiseTreeViewItem).objectGuid) == null)
{
parent = parent.parent;
}
if (parent != null)
{
SetExpandedRecursive(parent.id, true);
}
}
return false;
}
public void HighlightItem(AkWwiseTreeViewItem item, bool select)
{
if (item != null)
{
FrameItem(item.id);
if (select)
{
SetSelection(new List<int>() { item.id });
}
SetDirty();
}
}
#region Mulicolumn
enum ObjectColumns
{
Name,
Guid,
Depth,
}
public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState()
{
var columns = new[]
{
new MultiColumnHeaderState.Column
{
headerContent = new UnityEngine.GUIContent("Name"),
headerTextAlignment = UnityEngine.TextAlignment.Left,
sortedAscending = true,
sortingArrowAlignment = UnityEngine.TextAlignment.Center,
width = 300,
minWidth = 200,
autoResize = true,
allowToggleVisibility = false
},
};
var state = new MultiColumnHeaderState(columns);
return state;
}
public static MultiColumnHeaderState CreateDebug()
{
var columns = new[]
{
new MultiColumnHeaderState.Column
{
headerContent = new UnityEngine.GUIContent("Name"),
headerTextAlignment = UnityEngine.TextAlignment.Left,
sortedAscending = true,
sortingArrowAlignment = UnityEngine.TextAlignment.Center,
width = 300,
minWidth = 200,
autoResize = true,
allowToggleVisibility = false
},
new MultiColumnHeaderState.Column
{
headerContent = new UnityEngine.GUIContent("Guid"),
headerTextAlignment = UnityEngine.TextAlignment.Right,
sortedAscending = true,
sortingArrowAlignment = UnityEngine.TextAlignment.Left,
width = 200,
minWidth = 60,
autoResize = true
},
new MultiColumnHeaderState.Column
{
headerContent = new UnityEngine.GUIContent("depth"),
headerTextAlignment = UnityEngine.TextAlignment.Right,
sortedAscending = true,
sortingArrowAlignment = UnityEngine.TextAlignment.Left,
width = 200,
minWidth = 60,
autoResize = true
},
};
var state = new MultiColumnHeaderState(columns);
return state;
}
#endregion
#region Search
protected void SearchStringChanged(string lastSearch, string newSearch)
{
}
#endregion
#region Drawing
protected override void AfterRowsGUI()
{
base.AfterRowsGUI();
this.searchString = StoredSearchString;
}
//check here to see if multicolumn or not
protected override void RowGUI(RowGUIArgs args)
{
var evt = UnityEngine.Event.current;
var item = (AkWwiseTreeViewItem)args.item;
if (m_pickerMode == PickerMode.ComponentPicker)
{
CellGUI(args.rowRect, item, ObjectColumns.Name, ref args);
}
else
{
for (int i = 0; i < args.GetNumVisibleColumns(); ++i)
{
CellGUI(args.GetCellRect(i), item, (ObjectColumns)args.GetColumn(i), ref args);
}
}
}
void CellGUI(UnityEngine.Rect cellRect, AkWwiseTreeViewItem item, ObjectColumns column, ref RowGUIArgs args)
{
// Center cell rect vertically (makes it easier to place controls, icons etc in the cells)
CenterRectUsingSingleLineHeight(ref cellRect);
switch (column)
{
case ObjectColumns.Name:
{
UnityEngine.Rect iconRect = new UnityEngine.Rect(cellRect);
iconRect.x += GetContentIndent(item);
iconRect.width = AkWwisePickerIcons.kIconWidth;
UnityEngine.GUI.DrawTexture(iconRect, icons.GetIcon(item.objectType), UnityEngine.ScaleMode.ScaleToFit);
//// Default icon and label
args.rowRect = cellRect;
base.RowGUI(args);
}
break;
case ObjectColumns.Guid:
{
UnityEngine.GUI.Label(cellRect, item.objectGuid.ToString());
}
break;
case ObjectColumns.Depth:
{
UnityEngine.GUI.Label(cellRect, item.depth.ToString());
}
break;
}
}
public void SetExpandedUpwardsRecursive(TreeViewItem item)
{
if (item == null)
{
return;
}
SetExpanded(item.id, true);
SetExpandedUpwardsRecursive(item.parent);
}
public AkWwiseTreeViewItem Find(int id)
{
var result = this.m_Rows.FirstOrDefault(element => element.id == id);
return result as AkWwiseTreeViewItem;
}
#endregion
#region click and drag/drop
protected override bool CanMultiSelect(TreeViewItem item)
{
return false;
}
protected override void SelectionChanged(IList<int> selectedIds)
{
dataSource.ItemSelected(Find(selectedIds.Last()));
base.SelectionChanged(selectedIds);
}
public bool CheckWaapi()
{
return AkWwiseEditorSettings.Instance.UseWaapi && AkWaapiUtilities.IsConnected() &&
AkWwiseProjectInfo.GetData().currentDataSource == AkWwiseProjectInfo.DataSourceType.WwiseAuthoring;
}
protected override void ContextClickedItem(int id)
{
UnityEditor.GenericMenu menu = new UnityEditor.GenericMenu();
var item = Find(id);
if (CheckWaapi())
{
if (CanPlay(item))
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Play \u2215 Stop _SPACE"), false,
() => AkWaapiUtilities.TogglePlayEvent(item.objectType, item.objectGuid));
else
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Play \u2215 Stop _Space"));
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Stop All"), false,
() => AkWaapiUtilities.StopAllTransports());
menu.AddSeparator("");
if (CanRenameWithLog(item, false))
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Rename _F2"), false,
() => BeginRename(item));
else
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Rename"));
if (CanDelete(item, false))
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Delete _Delete"), false,
() => AkWaapiUtilities.Delete(item.objectGuid));
else
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Delete"));
menu.AddSeparator("");
if (item.objectType == WwiseObjectType.Soundbank)
{
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Folder/WorkUnit #O"), false,
() => AkWaapiUtilities.OpenWorkUnitInExplorer(item.objectGuid));
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Folder/SoundBank "), false,
() => AkWaapiUtilities.OpenSoundBankInExplorer(item.objectGuid));
}
else
{
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Containing Folder #O"), false,
() => AkWaapiUtilities.OpenWorkUnitInExplorer(item.objectGuid));
}
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Find in Project Explorer #F"), false,
() => m_dataSource.SelectObjectInAuthoring(item.objectGuid));
}
else
{
if (AkWwiseProjectInfo.GetData().currentDataSource == AkWwiseProjectInfo.DataSourceType.WwiseAuthoring)
{
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Wwise Connection Settings"), false,
OpenSettings);
menu.AddSeparator("");
}
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Play \u2215 Stop"));
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Stop all"));
menu.AddSeparator("");
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Rename"));
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Delete"));
menu.AddSeparator("");
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Containing Folder"));
menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Find in Project Explorer"));
}
menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Find References in Scene #R"), false,
() => FindReferencesInScene(item));
menu.ShowAsContext();
}
protected void OpenSettings()
{
UnityEditor.SettingsService.OpenProjectSettings("Project/Wwise Editor");
}
protected override void KeyEvent()
{
var selected = GetSelection();
if (selected.Count == 0)
{
return;
}
var item = Find(GetSelection()[0]);
if (UnityEngine.Event.current.type == UnityEngine.EventType.KeyDown)
{
switch (UnityEngine.Event.current.keyCode)
{
case UnityEngine.KeyCode.KeypadEnter:
DoubleClickedItem(item.id);
UnityEngine.Event.current.Use();
break;
case UnityEngine.KeyCode.Space:
if (CanPlay(item))
AkWaapiUtilities.TogglePlayEvent(item.objectType, item.objectGuid);
UnityEngine.Event.current.Use();
break;
case UnityEngine.KeyCode.Delete:
if (CanDelete(item))
AkWaapiUtilities.Delete(item.objectGuid);
UnityEngine.Event.current.Use();
break;
case UnityEngine.KeyCode.F2:
if (CanRename(item))
BeginRename(item);
UnityEngine.Event.current.Use();
break;
case UnityEngine.KeyCode.O:
if (UnityEngine.Event.current.shift)
{
if (CanOpen(item))
AkWaapiUtilities.OpenWorkUnitInExplorer(item.objectGuid);
UnityEngine.Event.current.Use();
}
break;
case UnityEngine.KeyCode.F:
if (UnityEngine.Event.current.shift)
{
if (CanSelect(item))
m_dataSource.SelectObjectInAuthoring(item.objectGuid);
UnityEngine.Event.current.Use();
}
break;
case UnityEngine.KeyCode.R:
if (UnityEngine.Event.current.shift)
{
FindReferencesInScene(item);
UnityEngine.Event.current.Use();
}
break;
}
}
}
internal static void FindReferencesInScene(AkWwiseTreeViewItem item)
{
var reference = WwiseObjectReference.FindWwiseObject(item.objectType, item.objectGuid);
var path = UnityEditor.AssetDatabase.GetAssetPath(reference);
if (path.IndexOf(' ') != -1)
path = '"' + path + '"';
if (path == string.Empty)
{
UnityEngine.Debug.Log($"No references to {item.displayName} in scene.");
return;
}
#if !UNITY_2019_1_OR_NEWER
//drop "Assets" part of path
path = string.Join("/", path.Split('/').Skip(1));
#endif
var searchFilter = "ref:" + path;
System.Type type = typeof(UnityEditor.SearchableEditorWindow);
System.Reflection.FieldInfo info = type.GetField("searchableWindows",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
var searchableWindows = info.GetValue(null) as List<UnityEditor.SearchableEditorWindow>;
foreach (UnityEditor.SearchableEditorWindow sw in searchableWindows)
{
info = type.GetField("m_HierarchyType",
System.Reflection.BindingFlags.NonPublic);
if (sw.GetType().ToString() == "UnityEditor.SceneHierarchyWindow")
{
if (sw.GetType().ToString() == "UnityEditor.SceneHierarchyWindow")
{
System.Reflection.MethodInfo setSearchFilter = typeof(UnityEditor.SearchableEditorWindow).GetMethod(
"SetSearchFilter", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
object[] parameters = new object[] { searchFilter, 0, false, false };
setSearchFilter.Invoke(sw, parameters);
sw.Repaint();
}
}
}
}
protected override void RenameEnded(RenameEndedArgs args)
{
var item = Find(args.itemID);
if (ValidateNameChange(item, args.newName))
{
var name = args.newName.Replace(" ", "_");
AkWaapiUtilities.Rename(item.objectGuid, name);
item.displayName = args.newName;
}
}
protected override bool CanRename(TreeViewItem item)
{
return CanRenameWithLog(item, true);
}
protected bool CanRenameWithLog(TreeViewItem item, bool log)
{
if (!CheckWaapi()) return false;
var wwiseItem = (AkWwiseTreeViewItem)item;
if (item == null)
{
if (log) UnityEngine.Debug.LogWarning("Tree item no longer exists");
return false;
}
if ((wwiseItem.objectType == WwiseObjectType.PhysicalFolder) || (wwiseItem.objectType == WwiseObjectType.WorkUnit))
{
if (log) UnityEngine.Debug.LogWarning("You can't change the name of a PhysicalFolder/WorkUnit");
return false;
}
if (item.parent == null)
{
if (log) UnityEngine.Debug.LogWarning("A root tree item can not be renamed");
return false;
}
return true;
}
protected bool CanPlay(TreeViewItem item)
{
if (!CheckWaapi()) return false;
var wwiseItem = (AkWwiseTreeViewItem)item;
if (wwiseItem.objectType == WwiseObjectType.Event) return true;
return false;
}
protected bool CanDelete(TreeViewItem item, bool log = true)
{
if (!CheckWaapi()) return false;
var wwiseItem = (AkWwiseTreeViewItem)item;
if ((wwiseItem.objectType == WwiseObjectType.PhysicalFolder) || (wwiseItem.objectType == WwiseObjectType.WorkUnit)
|| wwiseItem.WwiseTypeInChildren(WwiseObjectType.WorkUnit))
{
if (log) UnityEngine.Debug.LogWarning("You can't delete a PhysicalFolder/WorkUnit from within Unity");
return false;
}
return true;
}
protected bool CanSelect(TreeViewItem item)
{
if (!CheckWaapi()) return false;
return true;
}
protected bool CanOpen(TreeViewItem item)
{
if (!CheckWaapi()) return false;
return true;
}
const int MAX_NAME_LENGTH = 1024;
bool ValidateNameChange(AkWwiseTreeViewItem item, string newName)
{
if (item == null)
{
UnityEngine.Debug.LogWarning("Tree item no longer exists");
return false;
}
if (newName.Trim() == System.String.Empty)
{
UnityEngine.Debug.LogWarning("Names cannot be left blank");
return false;
}
if (newName.Trim().Length >= MAX_NAME_LENGTH)
{
UnityEngine.Debug.LogWarning($"Names must be less than {MAX_NAME_LENGTH} characters long.");
return false;
}
// If the new name is the same as the old name, consider this to be unchanged
if (item.displayName == newName)
{
return false;
}
if (newName.Contains('/') || newName.Contains('\\'))
{
UnityEngine.Debug.LogWarning("Item names cannot contain / or \\.");
return false;
}
// Validate that an item with this name doesn't exist already
if (item.parent.children.Find((i) => i.displayName == newName) != null)
{
UnityEngine.Debug.LogWarning("An item with this name already exists at this level");
return false;
}
return true;
}
public delegate void DoubleClickFunctionDelegate(AkWwiseTreeViewItem element);
private DoubleClickFunctionDelegate doubleClickExternalFunction;
public void SetDoubleClickFunction(DoubleClickFunctionDelegate f)
{
doubleClickExternalFunction = f;
}
protected override void DoubleClickedItem(int id)
{
base.DoubleClickedItem(id);
var doubleClickedElement = m_dataSource.Find(id);
doubleClickExternalFunction?.Invoke(doubleClickedElement);
}
public bool DragDropEnabled;
protected override bool CanStartDrag(CanStartDragArgs args)
{
return DragDropEnabled;
}
protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
{
UnityEditor.DragAndDrop.PrepareStartDrag();
var draggedRows = GetRows().Where(item => args.draggedItemIDs.Contains(item.id)).ToList();
var draggedItem = draggedRows[0] as AkWwiseTreeViewItem;
if (draggedItem.objectGuid == System.Guid.Empty ||
draggedItem.objectType == WwiseObjectType.Bus ||
draggedItem.objectType == WwiseObjectType.PhysicalFolder ||
draggedItem.objectType == WwiseObjectType.Folder ||
draggedItem.objectType == WwiseObjectType.WorkUnit ||
draggedItem.objectType == WwiseObjectType.Project ||
draggedItem.objectType == WwiseObjectType.StateGroup ||
draggedItem.objectType == WwiseObjectType.SwitchGroup)
return;
var reference = WwiseObjectReference.FindOrCreateWwiseObject(draggedItem.objectType, draggedItem.name, draggedItem.objectGuid);
if (!reference)
return;
var groupReference = reference as WwiseGroupValueObjectReference;
if (groupReference)
{
var parent = draggedItem.parent as AkWwiseTreeViewItem;
groupReference.SetupGroupObjectReference(parent.name, parent.objectGuid);
}
UnityEditor.MonoScript script;
if (DragDropMonoScriptMap.TryGetValue(reference.WwiseObjectType, out script))
{
UnityEngine.GUIUtility.hotControl = 0;
UnityEditor.DragAndDrop.PrepareStartDrag();
UnityEditor.DragAndDrop.objectReferences = new UnityEngine.Object[] { script };
AkWwiseTypes.DragAndDropObjectReference = reference;
UnityEditor.DragAndDrop.StartDrag("Dragging an AkObject");
}
}
public void SetDataSource(AkWwiseTreeDataSource datasource)
{
if (m_dataSource != null)
{
m_dataSource.modelChanged -= this.ModelChanged;
m_dataSource.TreeView = null;
}
m_dataSource = datasource;
m_dataSource.modelChanged += this.ModelChanged;
m_dataSource.TreeView = this;
m_dataSource.FetchData();
}
~AkWwiseTreeView()
{
if (m_pickerMode != PickerMode.ComponentPicker && StoredSearchString == System.String.Empty)
{
SaveExpansionStatus();
}
}
#endregion
}
#region Icons
public class AkWwisePickerIcons
{
public const float kIconWidth = 18f;
private UnityEngine.Texture2D m_textureWwiseAcousticTextureIcon;
private UnityEngine.Texture2D m_textureWwiseAuxBusIcon;
private UnityEngine.Texture2D m_textureWwiseBusIcon;
private UnityEngine.Texture2D m_textureWwiseEventIcon;
private UnityEngine.Texture2D m_textureWwiseFolderIcon;
private UnityEngine.Texture2D m_textureWwiseGameParameterIcon;
private UnityEngine.Texture2D m_textureWwisePhysicalFolderIcon;
private UnityEngine.Texture2D m_textureWwiseProjectIcon;
private UnityEngine.Texture2D m_textureWwiseSoundbankIcon;
private UnityEngine.Texture2D m_textureWwiseStateIcon;
private UnityEngine.Texture2D m_textureWwiseStateGroupIcon;
private UnityEngine.Texture2D m_textureWwiseSwitchIcon;
private UnityEngine.Texture2D m_textureWwiseSwitchGroupIcon;
private UnityEngine.Texture2D m_textureWwiseWorkUnitIcon;
protected UnityEngine.Texture2D GetTexture(string texturePath)
{
try
{
return UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.Texture2D>(texturePath);
}
catch (System.Exception ex)
{
UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to find local texture: {0}", ex));
return null;
}
}
public void LoadIcons()
{
var tempWwisePath = "Assets/Wwise/API/Editor/WwiseWindows/TreeViewIcons/";
m_textureWwiseAcousticTextureIcon = GetTexture(tempWwisePath + "acoustictexture_nor.png");
m_textureWwiseAuxBusIcon = GetTexture(tempWwisePath + "auxbus_nor.png");
m_textureWwiseBusIcon = GetTexture(tempWwisePath + "bus_nor.png");
m_textureWwiseEventIcon = GetTexture(tempWwisePath + "event_nor.png");
m_textureWwiseFolderIcon = GetTexture(tempWwisePath + "folder_nor.png");
m_textureWwiseGameParameterIcon = GetTexture(tempWwisePath + "gameparameter_nor.png");
m_textureWwisePhysicalFolderIcon = GetTexture(tempWwisePath + "physical_folder_nor.png");
m_textureWwiseProjectIcon = GetTexture(tempWwisePath + "wproj.png");
m_textureWwiseSoundbankIcon = GetTexture(tempWwisePath + "soundbank_nor.png");
m_textureWwiseStateIcon = GetTexture(tempWwisePath + "state_nor.png");
m_textureWwiseStateGroupIcon = GetTexture(tempWwisePath + "stategroup_nor.png");
m_textureWwiseSwitchIcon = GetTexture(tempWwisePath + "switch_nor.png");
m_textureWwiseSwitchGroupIcon = GetTexture(tempWwisePath + "switchgroup_nor.png");
m_textureWwiseWorkUnitIcon = GetTexture(tempWwisePath + "workunit_nor.png");
}
public UnityEngine.Texture2D GetIcon(WwiseObjectType type)
{
switch (type)
{
case WwiseObjectType.AcousticTexture:
return m_textureWwiseAcousticTextureIcon;
case WwiseObjectType.AuxBus:
return m_textureWwiseAuxBusIcon;
case WwiseObjectType.Bus:
return m_textureWwiseBusIcon;
case WwiseObjectType.Event:
return m_textureWwiseEventIcon;
case WwiseObjectType.Folder:
return m_textureWwiseFolderIcon;
case WwiseObjectType.GameParameter:
return m_textureWwiseGameParameterIcon;
case WwiseObjectType.PhysicalFolder:
return m_textureWwisePhysicalFolderIcon;
case WwiseObjectType.Project:
return m_textureWwiseProjectIcon;
case WwiseObjectType.Soundbank:
return m_textureWwiseSoundbankIcon;
case WwiseObjectType.State:
return m_textureWwiseStateIcon;
case WwiseObjectType.StateGroup:
return m_textureWwiseStateGroupIcon;
case WwiseObjectType.Switch:
return m_textureWwiseSwitchIcon;
case WwiseObjectType.SwitchGroup:
return m_textureWwiseSwitchGroupIcon;
case WwiseObjectType.WorkUnit:
return m_textureWwiseWorkUnitIcon;
default:
return m_textureWwisePhysicalFolderIcon;
}
}
}
#endregion
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f1154c445cddd1a4d912765f7ad3ece5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,172 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2020 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
using System.Linq;
using System.Collections.Generic;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
public class AkWwiseTreeViewItem : TreeViewItem, System.IEquatable<AkWwiseTreeViewItem>
{
public System.Guid objectGuid;
public WwiseObjectType objectType;
public int numChildren;
public string name
{
get { return displayName; }
set {
displayName = value;
if (parent != null)
{
parent.children.Sort();
}
}
}
private int m_depth;
public override int depth
{
get { return m_depth; }
set {
m_depth= value;
if (children != null)
{
foreach (var child in this.children)
{
if (child != null && child.depth != depth + 1)
child.depth = depth + 1;
}
}
}
}
public AkWwiseTreeViewItem(WwiseObjectInfo info, int id, int depth) : base(id, depth, info.name)
{
objectGuid = info.objectGUID;
objectType = info.type;
numChildren = info.childrenCount;
if (objectType == WwiseObjectType.Event)
{
numChildren = 0;
}
children = new List<TreeViewItem>();
this.depth = depth;
}
public AkWwiseTreeViewItem(string displayName, int depth, int id, System.Guid objGuid, WwiseObjectType objType) : base(id, depth, displayName)
{
objectGuid = objGuid;
objectType = objType;
children = new List<TreeViewItem>();
this.depth = depth;
}
public AkWwiseTreeViewItem()
{
objectGuid = System.Guid.Empty;
objectType = WwiseObjectType.None;
children = new List<TreeViewItem>();
}
public AkWwiseTreeViewItem(AkWwiseTreeViewItem other) : base(other.id, other.depth, other.displayName)
{
objectGuid = other.objectGuid;
objectType = other.objectType;
children = new List<TreeViewItem>();
this.depth = other.depth;
}
public bool Equals(AkWwiseTreeViewItem other)
{
return objectGuid == other.objectGuid && displayName == other.displayName && objectType == other.objectType;
}
public void AddWwiseItemChild(AkWwiseTreeViewItem child)
{
child.depth = this.depth + 1;
child.parent = this;
children.Add(child);
children.Sort();
}
public override int CompareTo(TreeViewItem B)
{
return CompareTo(this, B as AkWwiseTreeViewItem);
}
public int CompareTo(AkWwiseTreeViewItem A, AkWwiseTreeViewItem B)
{
// Items are sorted like so:
// 1- Physical folders, sorted alphabetically
// 1- WorkUnits, sorted alphabetically (with default work unit first)
// 2- Virtual folders, sorted alphabetically
// 3- Normal items, sorted alphabetically
if (A.objectType == B.objectType)
{
if (A.objectType == WwiseObjectType.WorkUnit)
{
if (A.displayName == "Default Work Unit")
return -1;
else if (B.displayName == "Default Work Unit")
return 1;
}
return string.CompareOrdinal(A.displayName, B.displayName);
}
else if (A.objectType == WwiseObjectType.PhysicalFolder)
{
return -1;
}
else if (B.objectType == WwiseObjectType.PhysicalFolder)
{
return 1;
}
else if (A.objectType == WwiseObjectType.WorkUnit || A.objectType == WwiseObjectType.WorkUnit)
{
return -1;
}
else if (B.objectType == WwiseObjectType.WorkUnit || B.objectType == WwiseObjectType.WorkUnit)
{
return 1;
}
else if (A.objectType == WwiseObjectType.Folder)
{
return -1;
}
else if (B.objectType == WwiseObjectType.Folder)
{
return 1;
}
else if (A.objectType == WwiseObjectType.Bus || B.objectType == WwiseObjectType.AuxBus)
{
return -1;
}
else if (A.objectType == WwiseObjectType.AuxBus || B.objectType == WwiseObjectType.Bus)
{
return 1;
}
else
{
return 1;
}
}
public bool WwiseTypeInChildren(WwiseObjectType t)
{
if (this.objectType == t) return true;
foreach (var child in children)
{
if ((child as AkWwiseTreeViewItem).WwiseTypeInChildren(t)) return true;
}
return false;
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8fc198a18167442409e698ae9a2e7116
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,741 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2020 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
using System.Linq;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using UnityEditor.IMGUI.Controls;
/// <summary>
/// This class communicates with Wwise Authoring via AkWaapiUtilities to keep track of the Wwise object hierarchy in the project.
/// This hierarchy information is stored in a tree structure and is used by the Wwise Picker when it is in WAAPI mode.
/// Changes to the project are received via WAAPI subscriptions.
/// </summary>
public class AkWwiseTreeWAAPIDataSource : AkWwiseTreeDataSource
{
private System.Timers.Timer selectTimer;
private System.Timers.Timer searchTimer;
private ReturnOptions waapiWwiseObjectOptions =
new ReturnOptions(new string[] { "id", "name", "type", "childrenCount", "path", "workunitType", "parent" });
public bool AutoSyncSelection;
public AkWwiseTreeWAAPIDataSource() : base()
{
Connect();
selectTimer = new System.Timers.Timer();
selectTimer.Interval = 200;
selectTimer.AutoReset = false;
selectTimer.Elapsed += FireSelect;
searchTimer = new System.Timers.Timer();
searchTimer.Interval = 200;
searchTimer.AutoReset = false;
searchTimer.Elapsed += FireSearch;
}
public override void FetchData()
{
Data.Clear();
m_MaxID = 0;
ProjectRoot = CreateProjectRootItem();
foreach (var type in FolderNames.Keys)
{
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
AddBaseFolder(AkWaapiUtilities.ParseObjectInfo(items), type);
};
AkWaapiUtilities.GetWwiseObjectAndDescendants(FolderNames[type], waapiWwiseObjectOptions, 2, callback);
}
Changed();
}
public override AkWwiseTreeViewItem GetComponentDataRoot(WwiseObjectType objectType)
{
var tempProjectRoot = new AkWwiseTreeViewItem(ProjectRoot);
if (!wwiseObjectFolders.ContainsKey(objectType))
{
return tempProjectRoot;
}
tempProjectRoot.AddWwiseItemChild(wwiseObjectFolders[objectType]);
return tempProjectRoot;
}
WwiseObjectType componentObjectType;
public override void LoadComponentData(WwiseObjectType objectType)
{
componentObjectType = objectType;
LoadComponentDataDelayed();
}
public void LoadComponentDataDelayed()
{
//Delay call until data has been fetched
if (!wwiseObjectFolders.ContainsKey(componentObjectType))
{
UnityEditor.EditorApplication.delayCall += LoadComponentDataDelayed;
}
else
{
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
AddItems(AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.GetWwiseObjectAndDescendants(wwiseObjectFolders[componentObjectType].objectGuid,
waapiWwiseObjectOptions, -1, callback);
}
}
private string searchString;
private WwiseObjectType searchObjectTypeFilter;
public override void UpdateSearchResults(string searchFilter, WwiseObjectType objectType = WwiseObjectType.None)
{
searchTimer.Stop();
searchString = searchFilter;
searchObjectTypeFilter = objectType;
searchTimer.Enabled = true;
searchTimer.Start();
}
private void FireSearch(object sender, System.Timers.ElapsedEventArgs e)
{
if (SearchRoot == null)
{
SearchRoot = new AkWwiseTreeViewItem(ProjectRoot);
}
SearchRoot.children.Clear();
SearchItems = new List<AkWwiseTreeViewItem>(new[] { SearchRoot });
TreeUtility.TreeToList(SearchRoot, SearchItems);
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
AddSearchResults(AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.Search(searchString, searchObjectTypeFilter, waapiWwiseObjectOptions, callback);
}
public override AkWwiseTreeViewItem GetSearchResults()
{
if (SearchRoot == null)
{
SearchRoot = new AkWwiseTreeViewItem(ProjectRoot);
}
return SearchRoot;
}
public void AddSearchResults(IEnumerable<WwiseObjectInfo> matchList)
{
try
{
foreach (var info in matchList)
{
if (!FilterPath(info.path))
{
continue;
}
var match = Find(SearchItems, info.objectGUID);
if (match != null)
{
continue;
}
var matchItem = Find(info.objectGUID);
if (matchItem == null)
{
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
AddItemWithAncestorsToSearch(AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.GetWwiseObjectAndAncestors(info.objectGUID, waapiWwiseObjectOptions, callback);
continue;
}
AddItemToSearch(matchItem);
treeviewCommandQueue.Enqueue(new TreeViewCommand(() => Expand(matchItem.objectGuid, false)));
}
}
catch (System.Exception e)
{
UnityEngine.Debug.LogError("Search died");
UnityEngine.Debug.LogError(e.Message);
}
}
private void AddItemToSearch(AkWwiseTreeViewItem sourceItem)
{
var matchItem = new AkWwiseTreeViewItem(sourceItem);
SearchItems.Add(matchItem);
var sourceParent = sourceItem.parent as AkWwiseTreeViewItem;
var parentCopy = Find(SearchItems, sourceParent.objectGuid);
if (parentCopy != null)
{
parentCopy.AddWwiseItemChild(matchItem);
return;
}
else
{
parentCopy = new AkWwiseTreeViewItem(sourceParent);
parentCopy.AddWwiseItemChild(matchItem);
SearchItems.Add(parentCopy);
var nextParent = sourceParent.parent as AkWwiseTreeViewItem;
while (nextParent != null)
{
var parentInSearchItems = Find(SearchItems, nextParent.objectGuid);
if (parentInSearchItems != null)
{
parentInSearchItems.AddWwiseItemChild(parentCopy);
break;
}
parentInSearchItems = new AkWwiseTreeViewItem(nextParent);
parentInSearchItems.AddWwiseItemChild(parentCopy);
SearchItems.Add(parentInSearchItems);
parentCopy = parentInSearchItems;
nextParent = nextParent.parent as AkWwiseTreeViewItem;
}
}
}
public void AddItemWithAncestors(List<WwiseObjectInfo> infoItems, bool selectAfterCreated = false)
{
var parent = ProjectRoot;
//Items obtained from the WAAPI call are sorted by path so we can simply iterate over them
foreach (var infoItem in infoItems)
{
var newItem = Find(infoItem.objectGUID);
if (newItem == null)
{
newItem = new AkWwiseTreeViewItem(infoItem, GenerateUniqueID(), parent.depth + 1);
Data.Add(newItem);
parent.AddWwiseItemChild(newItem);
}
if (!CheckIfFullyLoaded(parent))
{
System.Guid guid = new System.Guid(parent.objectGuid.ToString());
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
UpdateParentWithLoadedChildren(guid, AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.GetChildren(parent.objectGuid, waapiWwiseObjectOptions, callback);
}
parent = newItem;
}
if (selectAfterCreated)
{
treeviewCommandQueue.Enqueue(new TreeViewCommand(() => Expand(parent.objectGuid, true)));
}
}
public void AddItemWithAncestorsToSearch(List<WwiseObjectInfo> infoItems)
{
AddItemWithAncestors(infoItems, false);
var item = Find(infoItems.Last().objectGUID);
AddItemToSearch(item);
treeviewCommandQueue.Enqueue(new TreeViewCommand(() => Expand(item.objectGuid, false)));
}
public void AddItems(List<WwiseObjectInfo> infoItems)
{
foreach (var infoItem in infoItems)
{
if (infoItem.type == WwiseObjectType.None)
{
continue;
}
var tParent = Find(infoItem.parentID);
if (tParent == null || tParent == ProjectRoot)
{
tParent = ProjectRoot;
}
var tChild = Find(infoItem.objectGUID);
if (tChild == null)
{
tChild = new AkWwiseTreeViewItem(infoItem, GenerateUniqueID(), tParent.depth + 1);
Data.Add(tChild);
tParent.AddWwiseItemChild(tChild);
}
}
}
public void AddBaseFolder(List<WwiseObjectInfo> infoItems, WwiseObjectType oType)
{
if (infoItems != null && infoItems.Count > 0)
{
AddItems(infoItems);
var folder = Find(infoItems[0].objectGUID);
wwiseObjectFolders[oType] = folder;
}
}
public void UpdateParentWithLoadedChildren(System.Guid parentGuid, List<WwiseObjectInfo> children)
{
if (children == null)
{
return;
}
var parent = Find(parentGuid);
if (parent == null)
{
return;
}
parent.children.Remove(null);
parent.numChildren = children.Count;
if (parent.children.Count > children.Count)
{
parent.children.Clear();
}
foreach (var child in children)
{
if (parent.children.Any(c => ((AkWwiseTreeViewItem)c).objectGuid == child.objectGUID))
continue;
else
parent.AddWwiseItemChild(new AkWwiseTreeViewItem(child, GenerateUniqueID(), parent.depth + 1));
}
}
public void SetChildren(System.Guid parentGuid, List<WwiseObjectInfo> children)
{
if (children == null)
{
return;
}
var parent = Find(parentGuid);
parent.children.Clear();
parent.children.Remove(null);
parent.numChildren = children.Count;
foreach (var child in children)
{
parent.AddWwiseItemChild(new AkWwiseTreeViewItem(child, GenerateUniqueID(), parent.depth + 1));
}
}
bool CheckIfFullyLoaded(AkWwiseTreeViewItem item)
{
if (item == ProjectRoot)
{
return true;
}
if (item.objectType == WwiseObjectType.Event)
{
return true;
}
if (item.numChildren != item.children.Count)
{
return false;
}
if (item.children.Contains(null))
{
return false;
}
return true;
}
private ReadOnlyDictionary<WwiseObjectType, string> FolderNames = new ReadOnlyDictionary<WwiseObjectType, string>(new Dictionary<WwiseObjectType, string>()
{
{ WwiseObjectType.AuxBus , @"\Master-Mixer Hierarchy" },
{ WwiseObjectType.Event , @"\Events" },
{ WwiseObjectType.State, @"\States"},
{ WwiseObjectType.StateGroup, @"\States"},
{ WwiseObjectType.Soundbank, @"\SoundBanks"},
{ WwiseObjectType.Switch, @"\Switches"},
{ WwiseObjectType.SwitchGroup, @"\Switches"},
{ WwiseObjectType.AcousticTexture, @"\Virtual Acoustics" },
{ WwiseObjectType.GameParameter, @"\Game Parameters" },
});
static List<AkWaapiUtilities.SubscriptionInfo> subscriptions = new List<AkWaapiUtilities.SubscriptionInfo>();
/// <summary>
/// Subscribes to nameChanged, childAdded, childRemoved, and selectionChanged WAAPI events in order to keep the picker in sync with the Wwise project explorer.
/// </summary>
public void SubscribeTopics()
{
AkWaapiUtilities.Subscribe(ak.wwise.core.@object.nameChanged, OnWaapiRenamed, SubscriptionHandshake);
AkWaapiUtilities.Subscribe(ak.wwise.core.@object.childAdded, OnWaapiChildAdded, SubscriptionHandshake);
AkWaapiUtilities.Subscribe(ak.wwise.core.@object.childRemoved, OnWaapiChildRemoved, SubscriptionHandshake);
AkWaapiUtilities.Subscribe(ak.wwise.ui.selectionChanged, OnWwiseSelectionChanged, SubscriptionHandshake);
}
public void SubscriptionHandshake(AkWaapiUtilities.SubscriptionInfo sub)
{
subscriptions.Add(sub);
}
/// <summary>
/// Unsubscribes from currently active subscriptions.
/// </summary>
void UnsubscribeTopics()
{
var tSubs = subscriptions;
foreach (var sub in tSubs)
{
if (sub.SubscriptionId != 0)
{
AkWaapiUtilities.Unsubscribe(sub.SubscriptionId);
}
}
subscriptions.Clear();
}
void OnWaapiRenamed(string json)
{
var renamedItem = AkWaapiUtilities.ParseRenameObject(json);
treeviewCommandQueue.Enqueue(new TreeViewCommand(() => Rename(renamedItem.objectInfo.objectGUID, renamedItem.newName)));
}
void OnWaapiChildAdded(string json)
{
var added = AkWaapiUtilities.ParseChildAddedOrRemoved(json);
if (added.childInfo.type == WwiseObjectType.None)
return;
var parent = Find(added.parentInfo.objectGUID);
// New object created, but parent is not loaded yet, so we can ignore it
if (parent == null)
{
return;
}
var child = Find(added.childInfo.objectGUID);
if (child == null)
{
child = new AkWwiseTreeViewItem(added.childInfo, GenerateUniqueID(), parent.depth + 1);
}
else
{
child.numChildren = added.childInfo.childrenCount;
child.displayName = added.childInfo.name;
}
parent.AddWwiseItemChild(child);
Data.Add(child);
parent.numChildren = added.parentInfo.childrenCount;
child.depth = parent.depth + 1;
if (!CheckIfFullyLoaded(parent))
{
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
UpdateParentWithLoadedChildren(parent.objectGuid, AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.GetChildren(parent.objectGuid, waapiWwiseObjectOptions, callback);
}
if (!CheckIfFullyLoaded(child))
{
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
UpdateParentWithLoadedChildren(child.objectGuid, AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.GetChildren(child.objectGuid, waapiWwiseObjectOptions, callback);
}
ScheduleRebuild();
}
void OnWaapiChildRemoved(string json)
{
var removed = AkWaapiUtilities.ParseChildAddedOrRemoved(json);
toRequeue.Enqueue(new TreeViewCommand(() => Remove(removed.parentInfo, removed.childInfo)));
}
void OnWwiseSelectionChanged(string json)
{
if (AutoSyncSelection)
{
var objects = AkWaapiUtilities.ParseSelectedObjects(json);
if (objects.Count > 0)
{
if (FilterPath(objects[0].path))
{
treeviewCommandQueue.Enqueue(new TreeViewCommand(() => SelectItem(objects[0].objectGUID)));
}
}
}
}
public void Rename(System.Guid objectGuid, string newName)
{
var item = Find(objectGuid);
if (item != null)
{
item.name = newName;
}
else
{
toRequeue.Enqueue(new TreeViewCommand(() => Rename(objectGuid, newName)));
}
}
public void Remove(WwiseObjectInfo parentInfo, WwiseObjectInfo childInfo)
{
var parent = Find(parentInfo.objectGUID);
//Object removed, but it was never loaded so we can ignore it
if (parent == null)
{
return;
}
parent.numChildren = parentInfo.childrenCount;
var index = parent.children.FindIndex(el => ((AkWwiseTreeViewItem)el).objectGuid == childInfo.objectGUID);
if (index != -1)
{
parent.children.RemoveAt(index);
}
}
public void Expand(System.Guid objectGuid, bool select)
{
if (TreeView == null || !TreeView.ExpandItem(objectGuid, select))
{
toRequeue.Enqueue(new TreeViewCommand(() => Expand(objectGuid, select)));
}
}
public override void SelectItem(System.Guid itemGuid)
{
if (TreeView == null)
{
return;
}
if (TreeView.m_storedSearchString != string.Empty)
{
return;
}
if (!TreeView.ExpandItem(itemGuid, true))
{
var item = Find(itemGuid);
treeviewCommandQueue.Enqueue(new TreeViewCommand(() => Expand(itemGuid, true)));
if (item == null)
{
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
AddItemWithAncestors(AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.GetWwiseObjectAndAncestors(itemGuid, waapiWwiseObjectOptions, callback);
}
}
}
public bool FilterPath(string path)
{
var splitpath = path.Split('\\');
if (splitpath.Length > 1)
{
var folder = @"\" + splitpath[1];
if (FolderNames.Values.Contains(folder) || WaapiKeywords.FolderDisplaynames.Values.Contains(folder))
{
return true;
}
}
return false;
}
public override void ItemSelected(AkWwiseTreeViewItem item)
{
if (AutoSyncSelection)
{
SelectObjectInAuthoring(item.objectGuid);
}
}
private System.Guid guidToSelect;
public override void SelectObjectInAuthoring(System.Guid objectGuid)
{
selectTimer.Stop();
guidToSelect = objectGuid;
selectTimer.Enabled = true;
selectTimer.Start();
}
private void FireSelect(object sender, System.Timers.ElapsedEventArgs e)
{
AkWaapiUtilities.SelectObjectInAuthoring(guidToSelect);
}
//Make a single command queue
private ConcurrentQueue<TreeViewCommand> treeviewCommandQueue = new ConcurrentQueue<TreeViewCommand>();
private Queue<TreeViewCommand> toRequeue = new Queue<TreeViewCommand>();
public class TreeViewCommand
{
public System.Action payload;
public TreeViewCommand(System.Action payload)
{
this.payload = payload;
}
public void Execute()
{
payload.Invoke();
}
}
public override void ScheduleRebuild()
{
rebuildFlag = true;
}
private bool rebuildFlag = false;
private bool refreshFlag = false;
public void Update()
{
while (treeviewCommandQueue.Count > 0)
{
if (treeviewCommandQueue.TryDequeue(out TreeViewCommand cmd))
{
cmd.Execute();
refreshFlag = true;
}
}
while (toRequeue.Count > 0)
{
treeviewCommandQueue.Enqueue(toRequeue.Dequeue());
}
//Preemptively load items in heirarchy that are close to being exposed ( up to grandchildren of unexpanded items)
if (rebuildFlag)
{
TreeUtility.TreeToList(ProjectRoot, Data);
if (TreeView != null)
{
Preload(ProjectRoot, TreeView.state);
}
refreshFlag = true;
rebuildFlag = false;
}
//Updates treeView data and sets repaint flag
if (refreshFlag)
{
Changed();
refreshFlag = false;
}
}
void Preload(AkWwiseTreeViewItem parent, TreeViewState treeState)
{
if (parent == null)
{
return;
}
if (!CheckIfFullyLoaded(parent))
{
AkWaapiUtilities.GetResultListDelegate<WwiseObjectInfoJsonObject> callback = (List<WwiseObjectInfoJsonObject> items) =>
{
UpdateParentWithLoadedChildren(parent.objectGuid, AkWaapiUtilities.ParseObjectInfo(items));
};
AkWaapiUtilities.GetChildren(parent.objectGuid, waapiWwiseObjectOptions, callback);
}
//Preload one level of hidden items.
if (IsExpanded(treeState, parent.id) || (parent.parent != null && IsExpanded(treeState, parent.parent.id)) ||
parent.id == ProjectRoot.id )
{
foreach (AkWwiseTreeViewItem childItem in parent.children)
{
Preload(childItem, treeState);
}
}
}
public override void SetExpanded(IEnumerable<System.Guid> ids)
{
if (TreeView != null)
{
foreach (var id in ids)
{
treeviewCommandQueue.Enqueue(new TreeViewCommand(() => Expand(id, false)));
}
TreeView.state.expandedIDs.Clear();
}
}
public void Connect()
{
AkWaapiUtilities.Connected += OnConnection;
AkWaapiUtilities.QueueConsumed += ScheduleRebuild;
AkWaapiUtilities.Disconnecting += Disconnect;
}
public void OnConnection()
{
SubscribeTopics();
FetchData();
}
public void Disconnect(bool still_connected)
{
this.treeviewCommandQueue = new ConcurrentQueue<TreeViewCommand>();
if (ProjectRoot != null)
ProjectRoot.children = new List<TreeViewItem>();
if (still_connected)
{
UnsubscribeTopics();
}
else
{
subscriptions.Clear();
}
Changed();
}
public void Cleanup()
{
subscriptions.Clear();
}
~AkWwiseTreeWAAPIDataSource()
{
Disconnect(true);
}
public override void SaveExpansionStatus(List<int> expandedItems)
{
AkWwiseProjectInfo.GetData().ExpandedWaapiItemIds = expandedItems;
}
public override List<int> LoadExpansionSatus()
{
return AkWwiseProjectInfo.GetData().ExpandedWaapiItemIds;
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6838c30b0f8791c4898666cbd6d20edf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,947 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
#pragma warning disable 0168
[UnityEditor.InitializeOnLoad]
public class AkWwiseWWUBuilder
{
private const string s_progTitle = "Populating Wwise Picker";
private const int s_SecondsBetweenChecks = 3;
private static string s_wwiseProjectPath = System.IO.Path.GetDirectoryName(AkWwiseEditorSettings.WwiseProjectAbsolutePath);
private static System.DateTime s_lastFileCheck = System.DateTime.Now.AddSeconds(-s_SecondsBetweenChecks);
private static readonly FileInfo_CompareByPath s_FileInfo_CompareByPath = new FileInfo_CompareByPath();
private readonly System.Collections.Generic.HashSet<string> m_WwuToProcess =
new System.Collections.Generic.HashSet<string>();
private int m_currentWwuCnt;
private int m_totWwuCnt = 1;
private static void Tick()
{
isTicking = true;
if (AkWwiseProjectInfo.GetData() != null)
{
if (System.DateTime.Now.Subtract(s_lastFileCheck).Seconds > s_SecondsBetweenChecks &&
!UnityEditor.EditorApplication.isCompiling && !UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode &&
AkWwiseProjectInfo.GetData().autoPopulateEnabled)
{
if (Populate())
{
AkWwiseXMLBuilder.Populate();
//check if WAAPI or not
AkWwisePicker.Refresh(ignoreIfWaapi: true);
//Make sure that the Wwise picker and the inspector are updated
AkUtilities.RepaintInspector();
}
s_lastFileCheck = System.DateTime.Now;
}
}
}
public static void InitializeWwiseProjectData()
{
try
{
if (string.IsNullOrEmpty(AkWwiseEditorSettings.Instance.WwiseProjectPath))
{
UnityEngine.Debug.LogError("WwiseUnity: Wwise project needed to populate from Work Units. Aborting.");
return;
}
var fullWwiseProjectPath = AkWwiseEditorSettings.WwiseProjectAbsolutePath;
s_wwiseProjectPath = System.IO.Path.GetDirectoryName(fullWwiseProjectPath);
AkUtilities.IsWwiseProjectAvailable = System.IO.File.Exists(fullWwiseProjectPath);
if (!AkUtilities.IsWwiseProjectAvailable || UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || string.IsNullOrEmpty(s_wwiseProjectPath) ||
UnityEditor.EditorApplication.isCompiling)
return;
var builder = new AkWwiseWWUBuilder();
builder.GatherModifiedFiles();
builder.UpdateFiles();
}
catch
{
}
}
public static bool Populate()
{
try
{
if (string.IsNullOrEmpty(AkWwiseEditorSettings.Instance.WwiseProjectPath))
{
UnityEngine.Debug.LogError("WwiseUnity: Wwise project needed to populate from Work Units. Aborting.");
return false;
}
var fullWwiseProjectPath = AkWwiseEditorSettings.WwiseProjectAbsolutePath;
s_wwiseProjectPath = System.IO.Path.GetDirectoryName(fullWwiseProjectPath);
AkUtilities.IsWwiseProjectAvailable = System.IO.File.Exists(fullWwiseProjectPath);
if (!AkUtilities.IsWwiseProjectAvailable || UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || string.IsNullOrEmpty(s_wwiseProjectPath) ||
(UnityEditor.EditorApplication.isCompiling && !AkUtilities.IsMigrating))
return false;
AkPluginActivator.Update();
var builder = new AkWwiseWWUBuilder();
if (!builder.GatherModifiedFiles())
return false;
builder.UpdateFiles();
return true;
}
catch (System.Exception e)
{
UnityEngine.Debug.LogError(e.ToString());
UnityEditor.EditorUtility.ClearProgressBar();
return true;
}
}
public static void UpdateWwiseObjectReferenceData()
{
UnityEngine.Debug.Log("WwiseUnity: Updating Wwise Object References");
WwiseObjectReference.ClearWwiseObjectDataMap();
UpdateWwiseObjectReference(WwiseObjectType.AuxBus, AkWwiseProjectInfo.GetData().AuxBusWwu);
UpdateWwiseObjectReference(WwiseObjectType.Event, AkWwiseProjectInfo.GetData().EventWwu);
UpdateWwiseObjectReference(WwiseObjectType.Soundbank, AkWwiseProjectInfo.GetData().BankWwu);
UpdateWwiseObjectReference(WwiseObjectType.GameParameter, AkWwiseProjectInfo.GetData().RtpcWwu);
UpdateWwiseObjectReference(WwiseObjectType.Trigger, AkWwiseProjectInfo.GetData().TriggerWwu);
UpdateWwiseObjectReference(WwiseObjectType.AcousticTexture, AkWwiseProjectInfo.GetData().AcousticTextureWwu);
UpdateWwiseObjectReference(WwiseObjectType.StateGroup, WwiseObjectType.State, AkWwiseProjectInfo.GetData().StateWwu);
UpdateWwiseObjectReference(WwiseObjectType.SwitchGroup, WwiseObjectType.Switch, AkWwiseProjectInfo.GetData().SwitchWwu);
}
private int RecurseWorkUnit(AssetType in_type, System.IO.FileInfo in_workUnit, string in_currentPathInProj,
string in_currentPhysicalPath, System.Collections.Generic.LinkedList<AkWwiseProjectData.PathElement> in_pathAndIcons,
string in_parentPath = "")
{
m_WwuToProcess.Remove(in_workUnit.FullName);
var wwuIndex = -1;
try
{
//Progress bar stuff
var msg = "Parsing Work Unit " + in_workUnit.Name;
UnityEditor.EditorUtility.DisplayProgressBar(s_progTitle, msg, m_currentWwuCnt / (float)m_totWwuCnt);
m_currentWwuCnt++;
in_currentPathInProj =
System.IO.Path.Combine(in_currentPathInProj, System.IO.Path.GetFileNameWithoutExtension(in_workUnit.Name));
var WwuPhysicalPath = System.IO.Path.Combine(in_currentPhysicalPath, in_workUnit.Name);
var wwu = ReplaceWwuEntry(WwuPhysicalPath, in_type, out wwuIndex);
wwu.ParentPath = in_currentPathInProj;
wwu.PhysicalPath = WwuPhysicalPath;
wwu.Guid = System.Guid.Empty;
wwu.LastTime = System.IO.File.GetLastWriteTime(in_workUnit.FullName);
using (var reader = System.Xml.XmlReader.Create(in_workUnit.FullName))
{
reader.MoveToContent();
reader.Read();
while (!reader.EOF && reader.ReadState == System.Xml.ReadState.Interactive)
{
if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.Name.Equals("WorkUnit"))
{
if (wwu.Guid.Equals(System.Guid.Empty))
{
var ID = reader.GetAttribute("ID");
try
{
wwu.Guid = new System.Guid(ID);
in_pathAndIcons.AddLast(new AkWwiseProjectData.PathElement(
System.IO.Path.GetFileNameWithoutExtension(in_workUnit.Name), WwiseObjectType.WorkUnit, wwu.Guid));
wwu.PathAndIcons = new System.Collections.Generic.List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
}
catch
{
UnityEngine.Debug.LogWarning("WwiseUnity: Error reading ID <" + ID + "> from work unit <" + in_workUnit.FullName + ">.");
throw;
}
}
var persistMode = reader.GetAttribute("PersistMode");
if (persistMode == "Reference")
{
// ReadFrom advances the reader
var matchedElement = System.Xml.Linq.XNode.ReadFrom(reader) as System.Xml.Linq.XElement;
var newWorkUnitPath =
System.IO.Path.Combine(in_workUnit.Directory.FullName, matchedElement.Attribute("Name").Value + ".wwu");
var newWorkUnit = new System.IO.FileInfo(newWorkUnitPath);
// Parse the referenced Work Unit
RecurseWorkUnit(in_type, newWorkUnit, in_currentPathInProj, in_currentPhysicalPath, in_pathAndIcons,
WwuPhysicalPath);
}
else
{
// If the persist mode is "Standalone" or "Nested", it means the current XML tag
// is the one corresponding to the current file. We can ignore it and advance the reader
reader.Read();
}
}
else if (reader.NodeType == System.Xml.XmlNodeType.Element && (reader.Name.Equals("AuxBus") || reader.Name.Equals("Folder") || reader.Name.Equals("Bus")))
{
WwiseObjectType objType;
switch (reader.Name)
{
case "AuxBus":
objType = WwiseObjectType.AuxBus;
break;
case "Bus":
objType = WwiseObjectType.Bus;
break;
case "Folder":
default:
objType = WwiseObjectType.Folder;
break;
}
in_currentPathInProj = System.IO.Path.Combine(in_currentPathInProj, reader.GetAttribute("Name"));
in_pathAndIcons.AddLast(new AkWwiseProjectData.PathElement(reader.GetAttribute("Name"), objType, new System.Guid(reader.GetAttribute("ID"))));
bool IsEmptyElement = reader.IsEmptyElement; // Need to cache this because AddElementToList advances the reader.
AddElementToList(in_currentPathInProj, reader, in_type, in_pathAndIcons, wwuIndex, objType);
if (IsEmptyElement)
{
// This element has no children, step out of it immediately
// Remove the folder/bus from the path
in_currentPathInProj = in_currentPathInProj.Remove(in_currentPathInProj.LastIndexOf(System.IO.Path.DirectorySeparatorChar));
in_pathAndIcons.RemoveLast();
// Reader was already advanced by AddElementToList
}
}
else if (reader.NodeType == System.Xml.XmlNodeType.EndElement &&
(reader.Name.Equals("Folder") || reader.Name.Equals("Bus") || reader.Name.Equals("AuxBus")))
{
// Remove the folder/bus from the path
in_currentPathInProj = in_currentPathInProj.Remove(in_currentPathInProj.LastIndexOf(System.IO.Path.DirectorySeparatorChar));
in_pathAndIcons.RemoveLast();
// Advance the reader
reader.Read();
}
else if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.Name.Equals(in_type.XmlElementName))
{
// Add the element to the list
AddElementToList(in_currentPathInProj, reader, in_type, in_pathAndIcons, wwuIndex);
}
else
reader.Read();
}
}
// Sort the newly populated Wwu alphabetically
SortWwu(in_type, wwuIndex);
}
catch (System.Exception e)
{
UnityEngine.Debug.LogError(e.ToString());
wwuIndex = -1;
}
in_pathAndIcons.RemoveLast();
return wwuIndex;
}
private static bool isTicking = false;
public static void StartWWUWatcher()
{
if (isTicking)
return;
Tick();
UnityEditor.EditorApplication.update += Tick;
}
public static void StopWWUWatcher()
{
if (isTicking)
UnityEditor.EditorApplication.update -= Tick;
}
private static void RestartWWUWatcher()
{
if (AkWwiseProjectInfo.GetData().autoPopulateEnabled)
StartWWUWatcher();
}
static AkWwiseWWUBuilder()
{
InitializeWwiseProjectData();
UnityEditor.EditorApplication.playModeStateChanged += (UnityEditor.PlayModeStateChange playMode) =>
{
if (playMode == UnityEditor.PlayModeStateChange.EnteredEditMode)
RestartWWUWatcher();
};
}
private static System.Collections.Generic.Dictionary<WwiseObjectType, System.Collections.Generic.List<AkWwiseProjectData.AkBaseInformation>> _WwiseObjectsToRemove
= new System.Collections.Generic.Dictionary<WwiseObjectType, System.Collections.Generic.List<AkWwiseProjectData.AkBaseInformation>>();
private static System.Collections.Generic.Dictionary<WwiseObjectType, System.Collections.Generic.List<AkWwiseProjectData.AkBaseInformation>> _WwiseObjectsToAdd
= new System.Collections.Generic.Dictionary<WwiseObjectType, System.Collections.Generic.List<AkWwiseProjectData.AkBaseInformation>>();
private static void FlagForRemoval(WwiseObjectType type, int wwuIndex)
{
switch (type)
{
case WwiseObjectType.AuxBus:
foreach (var wwobject in AkWwiseProjectInfo.GetData().AuxBusWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
case WwiseObjectType.Event:
foreach (var wwobject in AkWwiseProjectInfo.GetData().EventWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
case WwiseObjectType.Soundbank:
foreach (var wwobject in AkWwiseProjectInfo.GetData().BankWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
case WwiseObjectType.GameParameter:
foreach (var wwobject in AkWwiseProjectInfo.GetData().RtpcWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
case WwiseObjectType.Trigger:
foreach (var wwobject in AkWwiseProjectInfo.GetData().TriggerWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
case WwiseObjectType.AcousticTexture:
foreach (var wwobject in AkWwiseProjectInfo.GetData().AcousticTextureWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
case WwiseObjectType.StateGroup:
foreach (var wwobject in AkWwiseProjectInfo.GetData().StateWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
case WwiseObjectType.SwitchGroup:
foreach (var wwobject in AkWwiseProjectInfo.GetData().SwitchWwu[wwuIndex].List)
FlagForRemoval(wwobject, type);
break;
}
}
private static void FlagForInsertion(AkWwiseProjectData.AkBaseInformation info, WwiseObjectType type)
{
if (!_WwiseObjectsToAdd.ContainsKey(type))
_WwiseObjectsToAdd[type] = new System.Collections.Generic.List<AkWwiseProjectData.AkBaseInformation>();
_WwiseObjectsToAdd[type].Add(info);
if (!AkUtilities.IsMigrating)
WwiseObjectReference.UpdateWwiseObject(type, info.Name, info.Guid);
}
private static void FlagForRemoval(AkWwiseProjectData.AkBaseInformation info, WwiseObjectType type)
{
if (!_WwiseObjectsToRemove.ContainsKey(type))
_WwiseObjectsToRemove[type] = new System.Collections.Generic.List<AkWwiseProjectData.AkBaseInformation>();
_WwiseObjectsToRemove[type].Add(info);
}
private bool GatherModifiedFiles()
{
_WwiseObjectsToRemove.Clear();
_WwiseObjectsToAdd.Clear();
var bChanged = false;
var iBasePathLen = s_wwiseProjectPath.Length + 1;
foreach (var scannedAsset in AssetType.ScannedAssets)
{
var dir = scannedAsset.RootDirectoryName;
var deleted = new System.Collections.Generic.List<int>();
var knownFiles = AkWwiseProjectInfo.GetData().GetWwuListByString(dir);
var cKnownBefore = knownFiles.Count;
try
{
//Get all Wwus in this folder.
var di = new System.IO.DirectoryInfo(System.IO.Path.Combine(s_wwiseProjectPath, dir));
var files = di.GetFiles("*.wwu", System.IO.SearchOption.AllDirectories);
System.Array.Sort(files, s_FileInfo_CompareByPath);
//Walk both arrays
var iKnown = 0;
var iFound = 0;
while (iFound < files.Length && iKnown < knownFiles.Count)
{
var workunit = knownFiles[iKnown] as AkWwiseProjectData.WorkUnit;
var foundRelPath = files[iFound].FullName.Substring(iBasePathLen);
switch (workunit.PhysicalPath.CompareTo(foundRelPath))
{
case 0:
//File was there and is still there. Check the FileTimes.
try
{
if (files[iFound].LastWriteTime > workunit.LastTime)
{
//File has been changed!
//If this file had a parent, parse recursively the parent itself
m_WwuToProcess.Add(files[iFound].FullName);
FlagForRemoval(scannedAsset.Type, iKnown);
bChanged = true;
}
}
catch
{
//Access denied probably (file does exists since it was picked up by GetFiles).
//Just ignore this file.
}
iFound++;
iKnown++;
break;
case 1:
m_WwuToProcess.Add(files[iFound].FullName);
iFound++;
break;
case -1:
//A file was deleted. Can't process it now, it would change the array indices.
deleted.Add(iKnown);
iKnown++;
break;
}
}
//The remainder from the files found on disk are all new files.
for (; iFound < files.Length; iFound++)
m_WwuToProcess.Add(files[iFound].FullName);
//All the remainder is deleted. From the end, of course.
if (iKnown < knownFiles.Count)
{
for (var i = iKnown; i < knownFiles.Count; ++i)
FlagForRemoval(scannedAsset.Type, i);
knownFiles.RemoveRange(iKnown, knownFiles.Count - iKnown);
}
//Delete those tagged.
for (var i = deleted.Count - 1; i >= 0; i--)
{
FlagForRemoval(scannedAsset.Type, deleted[i]);
knownFiles.RemoveAt(deleted[i]);
}
bChanged |= cKnownBefore != knownFiles.Count;
}
catch
{
return false;
}
}
return bChanged || m_WwuToProcess.Count > 0;
}
private void UpdateFiles()
{
m_totWwuCnt = m_WwuToProcess.Count;
var iBasePathLen = s_wwiseProjectPath.Length + 1;
var iUnprocessed = 0;
while (m_WwuToProcess.Count - iUnprocessed > 0)
{
System.Collections.IEnumerator e = m_WwuToProcess.GetEnumerator();
for (var i = 0; i < iUnprocessed + 1; i++)
e.MoveNext();
var fullPath = e.Current as string;
var relPath = fullPath.Substring(iBasePathLen);
var typeStr = relPath.Remove(relPath.IndexOf(System.IO.Path.DirectorySeparatorChar));
if (!CreateWorkUnit(relPath, typeStr, fullPath))
iUnprocessed++;
}
//Add the unprocessed directly. This can happen if we don't find the parent WorkUnit.
//Normally, it should never happen, this is just a safe guard.
while (m_WwuToProcess.Count > 0)
{
System.Collections.IEnumerator e = m_WwuToProcess.GetEnumerator();
e.MoveNext();
var fullPath = e.Current as string;
var relPath = fullPath.Substring(iBasePathLen);
var typeStr = relPath.Remove(relPath.IndexOf(System.IO.Path.DirectorySeparatorChar));
UpdateWorkUnit(fullPath, typeStr, relPath);
}
foreach (var pair in _WwiseObjectsToAdd)
{
System.Collections.Generic.List<AkWwiseProjectData.AkBaseInformation> removeList = null;
if (!_WwiseObjectsToRemove.TryGetValue(pair.Key, out removeList))
continue;
removeList.Sort(AkWwiseProjectData.AkBaseInformation.CompareByGuid);
foreach (var info in pair.Value)
{
var index = removeList.BinarySearch(info, AkWwiseProjectData.AkBaseInformation.CompareByGuid);
if (index >= 0)
removeList.RemoveAt(index);
}
}
foreach (var pair in _WwiseObjectsToRemove)
{
var type = pair.Key;
var childType = type == WwiseObjectType.StateGroup ? WwiseObjectType.State : WwiseObjectType.Switch;
foreach (var info in pair.Value)
{
var groupValue = info as AkWwiseProjectData.GroupValue;
if (groupValue != null)
foreach (var value in groupValue.values)
WwiseObjectReference.DeleteWwiseObject(childType, value.Guid);
WwiseObjectReference.DeleteWwiseObject(type, info.Guid);
}
}
UnityEditor.EditorUtility.SetDirty(AkWwiseProjectInfo.GetData());
UnityEditor.EditorUtility.ClearProgressBar();
}
private static void UpdateWwiseObjectReference(WwiseObjectType type, System.Collections.Generic.List<AkWwiseProjectData.AkInfoWorkUnit> infoWwus)
{
foreach (var infoWwu in infoWwus)
foreach (var info in infoWwu.List)
WwiseObjectReference.UpdateWwiseObjectDataMap(type, info.Name, info.Guid);
}
private static void UpdateWwiseObjectReference(WwiseObjectType type, System.Collections.Generic.List<AkWwiseProjectData.EventWorkUnit> infoWwus)
{
foreach (var infoWwu in infoWwus)
foreach (var info in infoWwu.List)
WwiseObjectReference.UpdateWwiseObjectDataMap(type, info.Name, info.Guid);
}
private static void UpdateWwiseObjectReference(WwiseObjectType groupType, WwiseObjectType type, System.Collections.Generic.List<AkWwiseProjectData.GroupValWorkUnit> infoWwus)
{
foreach (var infoWwu in infoWwus)
{
foreach (var info in infoWwu.List)
{
WwiseObjectReference.UpdateWwiseObjectDataMap(groupType, info.Name, info.Guid);
foreach (var subTypeInfo in info.values)
WwiseObjectReference.UpdateWwiseObjectDataMap(type, subTypeInfo.Name, subTypeInfo.Guid);
}
}
}
private static void SortWwu(AssetType in_type, int in_wwuIndex)
{
switch (in_type.Type)
{
case WwiseObjectType.AuxBus:
AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Sort();
break;
case WwiseObjectType.Event:
AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Sort();
break;
case WwiseObjectType.Soundbank:
AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Sort();
break;
case WwiseObjectType.GameParameter:
AkWwiseProjectInfo.GetData().RtpcWwu[in_wwuIndex].List.Sort();
break;
case WwiseObjectType.Trigger:
AkWwiseProjectInfo.GetData().TriggerWwu[in_wwuIndex].List.Sort();
break;
case WwiseObjectType.AcousticTexture:
AkWwiseProjectInfo.GetData().AcousticTextureWwu[in_wwuIndex].List.Sort();
break;
case WwiseObjectType.StateGroup:
var stateList = AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List;
stateList.Sort();
foreach (var group in stateList)
if (group.values.Count > 0)
group.values.Sort();
break;
case WwiseObjectType.SwitchGroup:
var switchList = AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List;
switchList.Sort();
foreach (var group in switchList)
if (group.values.Count > 0)
group.values.Sort();
break;
}
}
private static AkWwiseProjectData.WorkUnit ReplaceWwuEntry(string in_currentPhysicalPath, AssetType in_type, out int out_wwuIndex)
{
var list = AkWwiseProjectInfo.GetData().GetWwuListByString(in_type.RootDirectoryName);
out_wwuIndex = list.BinarySearch(new AkWwiseProjectData.WorkUnit { PhysicalPath = in_currentPhysicalPath });
AkWwiseProjectData.WorkUnit out_wwu = null;
switch (in_type.Type)
{
case WwiseObjectType.Event:
out_wwu = new AkWwiseProjectData.EventWorkUnit();
break;
case WwiseObjectType.StateGroup:
case WwiseObjectType.SwitchGroup:
out_wwu = new AkWwiseProjectData.GroupValWorkUnit();
break;
case WwiseObjectType.AuxBus:
case WwiseObjectType.Soundbank:
case WwiseObjectType.GameParameter:
case WwiseObjectType.Trigger:
case WwiseObjectType.AcousticTexture:
out_wwu = new AkWwiseProjectData.AkInfoWorkUnit();
break;
}
if (out_wwuIndex < 0)
{
out_wwuIndex = ~out_wwuIndex;
list.Insert(out_wwuIndex, out_wwu);
}
else
list[out_wwuIndex] = out_wwu;
return out_wwu;
}
private static void AddElementToList(string in_currentPathInProj, System.Xml.XmlReader in_reader, AssetType in_type,
System.Collections.Generic.LinkedList<AkWwiseProjectData.PathElement> in_pathAndIcons, int in_wwuIndex, WwiseObjectType in_LeafType = WwiseObjectType.None)
{
switch (in_type.Type)
{
case WwiseObjectType.Folder:
case WwiseObjectType.Bus:
case WwiseObjectType.AuxBus:
case WwiseObjectType.Event:
case WwiseObjectType.Soundbank:
case WwiseObjectType.GameParameter:
case WwiseObjectType.Trigger:
case WwiseObjectType.AcousticTexture:
{
var LeafType = in_LeafType == WwiseObjectType.None ? in_type.Type : in_LeafType;
var name = in_reader.GetAttribute("Name");
var valueToAdd = in_type.Type == WwiseObjectType.Event ? new AkWwiseProjectData.Event() : new AkWwiseProjectData.AkInformation();
valueToAdd.Name = name;
valueToAdd.Guid = new System.Guid(in_reader.GetAttribute("ID"));
valueToAdd.PathAndIcons = new System.Collections.Generic.List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
FlagForInsertion(valueToAdd, in_type.Type);
switch (LeafType)
{
case WwiseObjectType.AuxBus:
case WwiseObjectType.Bus:
case WwiseObjectType.Folder:
valueToAdd.Path = in_currentPathInProj;
break;
default:
valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, name);
valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(name, in_type.Type, valueToAdd.Guid));
break;
}
switch (in_type.Type)
{
case WwiseObjectType.AuxBus:
AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Add(valueToAdd);
break;
case WwiseObjectType.Event:
AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Add(valueToAdd as AkWwiseProjectData.Event);
break;
case WwiseObjectType.Soundbank:
AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Add(valueToAdd);
break;
case WwiseObjectType.GameParameter:
AkWwiseProjectInfo.GetData().RtpcWwu[in_wwuIndex].List.Add(valueToAdd);
break;
case WwiseObjectType.Trigger:
AkWwiseProjectInfo.GetData().TriggerWwu[in_wwuIndex].List.Add(valueToAdd);
break;
case WwiseObjectType.AcousticTexture:
AkWwiseProjectInfo.GetData().AcousticTextureWwu[in_wwuIndex].List.Add(valueToAdd);
break;
}
}
in_reader.Read();
break;
case WwiseObjectType.StateGroup:
case WwiseObjectType.SwitchGroup:
{
var valueToAdd = new AkWwiseProjectData.GroupValue();
if (in_LeafType == WwiseObjectType.Folder)
{
valueToAdd.Name = in_reader.GetAttribute("Name");
valueToAdd.Guid = new System.Guid(in_reader.GetAttribute("ID"));
valueToAdd.PathAndIcons = new System.Collections.Generic.List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
valueToAdd.Path = in_currentPathInProj;
FlagForInsertion(valueToAdd, in_type.Type);
in_reader.Read();
}
else
{
var XmlElement = System.Xml.Linq.XNode.ReadFrom(in_reader) as System.Xml.Linq.XElement;
var ChildrenList = System.Xml.Linq.XName.Get("ChildrenList");
var ChildrenElement = XmlElement.Element(ChildrenList);
if (ChildrenElement != null)
{
var name = XmlElement.Attribute("Name").Value;
valueToAdd.Name = name;
valueToAdd.Guid = new System.Guid(XmlElement.Attribute("ID").Value);
valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, name);
valueToAdd.PathAndIcons = new System.Collections.Generic.List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(name, in_type.Type, valueToAdd.Guid));
FlagForInsertion(valueToAdd, in_type.Type);
var ChildElem = System.Xml.Linq.XName.Get(in_type.ChildElementName);
foreach (var element in ChildrenElement.Elements(ChildElem))
{
if (element.Name != in_type.ChildElementName)
continue;
var elementName = element.Attribute("Name").Value;
var childValue = new AkWwiseProjectData.AkBaseInformation
{
Name = elementName,
Guid = new System.Guid(element.Attribute("ID").Value),
};
childValue.PathAndIcons = new System.Collections.Generic.List<AkWwiseProjectData.PathElement>(valueToAdd.PathAndIcons);
childValue.PathAndIcons.Add(new AkWwiseProjectData.PathElement(elementName, in_type.ChildType, childValue.Guid));
valueToAdd.values.Add(childValue);
FlagForInsertion(childValue, in_type.ChildType);
}
}
else
{
valueToAdd = null;
}
}
if (valueToAdd != null)
{
switch (in_type.Type)
{
case WwiseObjectType.StateGroup:
AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List.Add(valueToAdd);
break;
case WwiseObjectType.SwitchGroup:
AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List.Add(valueToAdd);
break;
}
}
}
break;
default:
UnityEngine.Debug.LogError("WwiseUnity: Unknown asset type in WWU parser");
break;
}
}
private bool CreateWorkUnit(string in_relativePath, string in_wwuType, string in_fullPath)
{
var ParentID = string.Empty;
try
{
using (var reader = System.Xml.XmlReader.Create(in_fullPath))
{
reader.MoveToContent();
//We check if the current work unit has a parent and save its guid if its the case
while (!reader.EOF && reader.ReadState == System.Xml.ReadState.Interactive)
{
if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.Name.Equals("WorkUnit"))
{
if (reader.GetAttribute("PersistMode").Equals("Nested"))
ParentID = reader.GetAttribute("OwnerID");
break;
}
reader.Read();
}
}
}
catch (System.Exception e)
{
UnityEngine.Debug.Log("WwiseUnity: A changed Work unit wasn't found. It must have been deleted " + in_fullPath);
return false;
}
if (!string.IsNullOrEmpty(ParentID))
{
var parentGuid = System.Guid.Empty;
try
{
parentGuid = new System.Guid(ParentID);
}
catch
{
UnityEngine.Debug.LogWarning("WwiseUnity: \"OwnerID\" in <" + in_fullPath + "> cannot be converted to a GUID (" + ParentID + ")");
return false;
}
var list = AkWwiseProjectInfo.GetData().GetWwuListByString(in_wwuType);
var PathAndIcons = new System.Collections.Generic.LinkedList<AkWwiseProjectData.PathElement>();
string PathInProj = string.Empty;
AkWwiseProjectData.WorkUnit wwu = null;
if (parentGuid != System.Guid.Empty)
{
for (var i = 0; i < list.Count; i++)
{
wwu = list[i] as AkWwiseProjectData.WorkUnit;
if (wwu.Guid.Equals(parentGuid))
{
PathInProj = wwu.ParentPath;
PathAndIcons = new System.Collections.Generic.LinkedList<AkWwiseProjectData.PathElement>(wwu.PathAndIcons);
break;
}
else
{
var WwuChildren = wwu.GetChildrenArrayList();
foreach (AkWwiseProjectData.AkInformation child in WwuChildren)
{
if (child.Guid.Equals(parentGuid))
{
PathInProj = child.Path;
PathAndIcons = new System.Collections.Generic.LinkedList<AkWwiseProjectData.PathElement>(child.PathAndIcons);
break;
}
}
}
}
}
if (!string.IsNullOrEmpty(PathInProj))
{
RecurseWorkUnit(AssetType.Create(in_wwuType), new System.IO.FileInfo(in_fullPath), PathInProj,
in_relativePath.Remove(in_relativePath.LastIndexOf(System.IO.Path.DirectorySeparatorChar)), PathAndIcons,
wwu.PhysicalPath);
return true;
}
//Not found. Wait for it to load
return false;
}
//Root Wwu
UpdateWorkUnit(in_fullPath, in_wwuType, in_relativePath);
return true;
}
private void UpdateWorkUnit(string in_wwuFullPath, string in_wwuType, string in_relativePath)
{
var PathAndIcons = new System.Collections.Generic.LinkedList<AkWwiseProjectData.PathElement>();
var currentPathInProj = string.Empty;
//Add physical folders to the hierarchy if the work unit isn't in the root folder
var physicalPath = in_relativePath.Split(System.IO.Path.DirectorySeparatorChar);
for (var i = 0; i < physicalPath.Length -1; i++)
{
PathAndIcons.AddLast(
new AkWwiseProjectData.PathElement(physicalPath[i], WwiseObjectType.PhysicalFolder, System.Guid.Empty));
currentPathInProj = System.IO.Path.Combine(currentPathInProj,physicalPath[i]);
}
//Parse the work unit file
RecurseWorkUnit(AssetType.Create(in_wwuType), new System.IO.FileInfo(in_wwuFullPath), currentPathInProj,
in_relativePath.Remove(in_relativePath.LastIndexOf(System.IO.Path.DirectorySeparatorChar)), PathAndIcons);
}
public class AssetType
{
public string RootDirectoryName { get; set; }
public string XmlElementName;
public string ChildElementName;
public WwiseObjectType Type = WwiseObjectType.None;
public WwiseObjectType ChildType = WwiseObjectType.None;
public static AssetType[] ScannedAssets
{
get { return _ScannedAssets; }
}
public static AssetType Create(string rootDirectoryName)
{
foreach (var asset in ScannedAssets)
if (string.Equals(rootDirectoryName, asset.RootDirectoryName, System.StringComparison.OrdinalIgnoreCase))
return asset;
return null;
}
private AssetType(string RootFolder, string XmlElemName, WwiseObjectType type)
{
RootDirectoryName = RootFolder;
XmlElementName = XmlElemName;
Type = type;
}
private static readonly AssetType[] _ScannedAssets = new AssetType[]
{
new AssetType("Master-Mixer Hierarchy", "AuxBus", WwiseObjectType.AuxBus),
new AssetType("Events", "Event", WwiseObjectType.Event),
new AssetType("SoundBanks", "SoundBank", WwiseObjectType.Soundbank),
new AssetType("States", "StateGroup", WwiseObjectType.StateGroup) { ChildElementName = "State", ChildType = WwiseObjectType.State },
new AssetType("Switches", "SwitchGroup", WwiseObjectType.SwitchGroup) { ChildElementName = "Switch", ChildType = WwiseObjectType.Switch },
new AssetType("Game Parameters", "GameParameter", WwiseObjectType.GameParameter),
new AssetType("Triggers", "Trigger", WwiseObjectType.Trigger),
new AssetType("Virtual Acoustics", "AcousticTexture", WwiseObjectType.AcousticTexture),
};
}
private class FileInfo_CompareByPath : System.Collections.Generic.IComparer<System.IO.FileInfo>
{
int System.Collections.Generic.IComparer<System.IO.FileInfo>.Compare(System.IO.FileInfo wwuA, System.IO.FileInfo wwuB)
{
return wwuA.FullName.CompareTo(wwuB.FullName);
}
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ae60ef50a9c66f644b6c98c8c0373828
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,156 @@
#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
[UnityEditor.InitializeOnLoad]
public class AkWwiseXMLBuilder
{
private static readonly System.DateTime s_LastParsed = System.DateTime.MinValue;
static AkWwiseXMLBuilder()
{
AkWwiseFileWatcher.Instance.PopulateXML += Populate;
UnityEditor.EditorApplication.playModeStateChanged += PlayModeChanged;
}
private static void PlayModeChanged(UnityEditor.PlayModeStateChange mode)
{
if (mode == UnityEditor.PlayModeStateChange.EnteredEditMode)
{
AkWwiseProjectInfo.Populate();
AkWwiseFileWatcher.Instance.StartWatchers();
}
}
public static bool Populate()
{
if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling)
{
return false;
}
try
{
// Try getting the SoundbanksInfo.xml file for Windows or Mac first, then try to find any other available platform.
var logWarnings = AkBasePathGetter.LogWarnings;
AkBasePathGetter.LogWarnings = false;
var FullSoundbankPath = AkBasePathGetter.GetPlatformBasePath();
AkBasePathGetter.LogWarnings = logWarnings;
var filename = System.IO.Path.Combine(FullSoundbankPath, "SoundbanksInfo.xml");
if (!System.IO.File.Exists(filename))
{
FullSoundbankPath = System.IO.Path.Combine(UnityEngine.Application.streamingAssetsPath, AkWwiseEditorSettings.Instance.SoundbankPath);
if (!System.IO.Directory.Exists(FullSoundbankPath))
return false;
var foundFiles = System.IO.Directory.GetFiles(FullSoundbankPath, "SoundbanksInfo.xml", System.IO.SearchOption.AllDirectories);
if (foundFiles.Length == 0)
return false;
filename = foundFiles[0];
}
var time = System.IO.File.GetLastWriteTime(filename);
if (time <= s_LastParsed)
{
return false;
}
var doc = new System.Xml.XmlDocument();
doc.Load(filename);
var bChanged = false;
var soundBanks = doc.GetElementsByTagName("SoundBanks");
for (var i = 0; i < soundBanks.Count; i++)
{
var soundBank = soundBanks[i].SelectNodes("SoundBank");
for (var j = 0; j < soundBank.Count; j++)
{
bChanged = SerialiseSoundBank(soundBank[j]) || bChanged;
}
}
return bChanged;
}
catch
{
return false;
}
}
private static bool SerialiseSoundBank(System.Xml.XmlNode node)
{
var bChanged = false;
var includedEvents = node.SelectNodes("IncludedEvents");
for (var i = 0; i < includedEvents.Count; i++)
{
var events = includedEvents[i].SelectNodes("Event");
for (var j = 0; j < events.Count; j++)
{
bChanged = SerialiseEventData(events[j]) || bChanged;
}
}
return bChanged;
}
private static float GetFloatFromString(string s)
{
return string.Compare(s, "Infinite") == 0 ? UnityEngine.Mathf.Infinity : float.Parse(s);
}
private static bool SerialiseEventData(System.Xml.XmlNode node)
{
var maxAttenuationAttribute = node.Attributes["MaxAttenuation"];
var durationMinAttribute = node.Attributes["DurationMin"];
var durationMaxAttribute = node.Attributes["DurationMax"];
if (maxAttenuationAttribute == null && durationMinAttribute == null && durationMaxAttribute == null)
return false;
var bChanged = false;
var name = node.Attributes["Name"].Value;
foreach (var wwu in AkWwiseProjectInfo.GetData().EventWwu)
{
var eventData = wwu.Find(name);
if (eventData == null)
continue;
if (maxAttenuationAttribute != null)
{
var maxAttenuation = float.Parse(maxAttenuationAttribute.Value);
if (eventData.maxAttenuation != maxAttenuation)
{
eventData.maxAttenuation = maxAttenuation;
bChanged = true;
}
}
if (durationMinAttribute != null)
{
var minDuration = GetFloatFromString(durationMinAttribute.Value);
if (eventData.minDuration != minDuration)
{
eventData.minDuration = minDuration;
bChanged = true;
}
}
if (durationMaxAttribute != null)
{
var maxDuration = GetFloatFromString(durationMaxAttribute.Value);
if (eventData.maxDuration != maxDuration)
{
eventData.maxDuration = maxDuration;
bChanged = true;
}
}
}
return bChanged;
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 580b2a14186e9fa40b56bccfe1424b5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9af5d513b95c7141b7f565ee70485ee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 7109567940b96454c88d1d0bb68d2959
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: b76691fa81022ab4fbc7addfb569cc51
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Wwise/API/Editor/WwiseWindows/TreeViewIcons/blank.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: a11996947b309154dafbacfbd1c8c4c4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: b687c5e428b2cf24aadd432af54dd5c3
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 7523fdad97bf4064e8b44e8fada63249
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: bcab6219a664a4f45a4c5e48d161c69f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 21c434ebf27077748bc1a6b900eaff20
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: d8ed4ae9462ee674f9fe2bc121f7b7ac
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 6a832604659bbbc4e87f498d6706bf71
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 2f158a171bc4d0948b26f08575cb65eb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: d4e4bd07312d61a4b88c325f554556d5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 3e4335402b9e1054ab991d7ad408d706
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 22b2dd55779f8294ebf7fe6879f0ba52
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 1cf82855275b96047a92c4666eee1e3a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Wwise/API/Editor/WwiseWindows/TreeViewIcons/wproj.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: f6ad97d3f15b362499bdfec2e4662176
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: