Initializing the project
| Note: The Python Waapi-Client is intended for use with Python 3.7+. |
Run the following command from any directory to install dependencies:
# Windows
py -3 -m pip install waapi-client
# macOS, Linux
python3 -m pip install waapi-client
Project Code
This file contains the following code, which allows you to connect to the Wwise Authoring API.
from waapi import WaapiClient, CannotConnectToWaapiException
from pprint import pprint
try:
client = WaapiClient()
except CannotConnectToWaapiException:
print("Could not connect to Waapi: Is Wwise running and Wwise Authoring API enabled?")
else:
def on_name_changed(*args, **kwargs):
obj_type = kwargs.get("object", {}).get("type")
old_name = kwargs.get("oldName")
new_name = kwargs.get("newName")
print("Object '{}' (of type '{}') was renamed to '{}'\n".format(old_name, obj_type, new_name))
client.disconnect()
handler = client.subscribe("ak.wwise.core.object.nameChanged", on_name_changed, {"return": ["type"]})
print("Subscribed 'ak.wwise.core.object.nameChanged', rename an object in Wwise")
Running the project
With a project open in Wwise, run the script in a terminal with the following command:
# Windows
py subscribe.py
# macOS, Linux
python3 subscribe.py
You should observe in the output something like:
Getting Wwise instance information:
Subscribed 'ak.wwise.core.object.nameChanged', rename an object in Wwise
Proceed to rename an object in Wwise. You should then observe something like:
Object 'MySound' (of type 'Sound') was renamed to 'MyOtherSound'