|
Wwise SDK 2023.1.17
|
命令扩展方便为 Wwise 设计工具定义新的命令。每个命令都与 Wwise 触发的外部程序关联。Programs that are executed can receive a variety of predefined arguments that are derived from the currently selected objects.
可通过不同方式触发扩展命令:
可在多个级别定义扩展命令:
![]() | 备注: 在存在 id 冲突时,只注册所加载的第一个命令。系统会按照上述顺序加载命令。 |
![]() | 备注: 在启动 Wwise 时,加载安装文件夹或用户数据目录中指定的命令扩展。在加载工程时,加载工程文件夹中指定的命令扩展。 |
Additionally, every time a command is executed in Wwise, WAAPI will notify the subscribers with ak.wwise.ui.commands.executed, passing the selected objects and honoring WAAPI return options. Add-on commands can be defined with no program to execute, so you could use the publication event to execute your own code in a WAAPI client.
使用以下字段描述命令:
为了避开电脑专用绝对路径,请将以下预定义目录用在 program 字段中。另外,您也可以将其用在 args 字段中来把路径作为参数传给程序,或者用在 cwd 字段中来定义当前工作目录。
| 变量 | 引用位置 |
|---|---|
| ${CurrentCommandDirectory} | 当前命令所在目录。如上所述,其应为 "Add-ons\\Commands"。 |
| ${WwiseInstallRoot} | Wwise 安装目录。 |
| ${WwiseInstallBin} | Wwise.exe 目录。 |
| ${WwiseInstallAddons} | Windows:"${WwiseInstallRoot}\\Authoring\\Data\\Add-ons" macOS:"/Library/Application Support/Audiokinetic/Wwise <version>/Authoring/Data/Add-ons/Commands" |
| ${WwiseUserAddons} | Windows:"%APPDATA%\\Audiokinetic\\Wwise\\Add-ons" macOS:"$HOME/Library/Application Support/Audiokinetic/Wwise/Add-ons/Commands" |
| ${WwiseProjectRoot} | Wwise 工程目录。 |
| ${WwiseProjectAddons} | "${WwiseProjectRoot}\\Add-ons" |
| ${WwiseProjectOriginals} | "${WwiseProjectRoot}\\Originals" |
| ${WwiseProjectSoundbanks} | 平台特定 Generated SoundBanks 目录。 |
args 字段(程序参数)中可使用零到多个变量。Variables provide a way to access information from the selected objects. For example, you could retrieve an object id and pass it as an argument. Variables also provide a way to access property values from the selected objects, including Custom Properties values. To learn more about Custom Properties, refer to 定义自定义属性.
For a complete list of possible expressions in variables, refer to the Object Expressions and Value Expressions sections in Wwise Authoring Query Language (WAQL) 参考.
在执行多选时,请参阅 startMode 以便了解这些变量如何解析。
Examples:
| Variable | Type | Description |
|---|---|---|
| ${id} | string | The object ID (GUID). |
| ${name} | string | The object name. |
| ${notes} | string | The object notes. |
| ${type} | string | The object type. 有关可用类型的详细信息,请参阅 Wwise 对象参考 。 |
| ${path} | string | 工程根目录下的对象路径。例如:'\\Actor-Mixer Hierarchy\\Default Work Unit\\Sound1' |
| ${filePath} | string | 对象所在文件的路径。该路径可为 Work Unit 文件或工程文件。 |
| ${originalWavFilePath} | string | 原始 WAV 文件的绝对路径。仅适用于 Sound 和 Audio Source 对象。 |
| ${convertedWemFilePath} | string | 转码后 WEM 文件的绝对路径。指定选项中的平台。仅适用于 Sound 和 Audio Source 对象。 |
| ${soundbankBnkFilePath} | string | 所生成的 SoundBank 文件的绝对路径,该文件与 SoundBank 对象关联。仅适用于 SoundBank 对象。 |
| ${workunitIsDirty} | boolean | 若 Work Unit 或工程(wproj 文件)未清理(即修改了而没保存),则返回 True。 |
| ${Volume} | string | Voice Volume。 |
| ${OutputBus.name} | string | Output Bus 名称。 |
若要创建新的命令,请在 定义命令扩展 中列出的某个目录下创建 JSON 文件,并将版本指定为 2。 请注意,很多第三方都可能会在这些目录下创建文件。 In order to reduce the risk of filename conflicts, we recommend using the following convention for the filenames: companyname_productname.json
示例: mycompany_myproduct.json
在向当前 Wwise 进程添加新命令时,可将上述相同的 JSON 命令代码传给 WAAPI ak.wwise.ui.commands.register 。
请注意,系统不会保留通过 ak.wwise.ui.commands.register 添加的命令。一旦 Wwise 进程终止,这些命令马上就会被删除。 所以,下次需要重新注册。
扩展命令可用于执行 WAAPI 脚本或程序。这样方便用户访问 Wwise 功能和工程数据。有关如何使用 WAAPI 的信息,请参阅“ 使用 Wwise Authoring API(WAAPI) ”。
在 Mac 上,使用以下格式执行扩展命令:
. 可直接在 program 中指定应用程序、可执行文件或脚本。
示例: mycompany_myproduct_forMac.json