Created
March 1, 2019 16:54
-
-
Save decasteljau/b7023195c1c78a36c64ff7dbeca3e601 to your computer and use it in GitHub Desktop.
Print all properties - WAAPI Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from waapi import WaapiClient, CannotConnectToWaapiException | |
| from pprint import pprint | |
| try: | |
| # Connecting to Waapi using default URL | |
| with WaapiClient() as client: | |
| # Simple RPC | |
| args = { | |
| "object": "\\Actor-Mixer Hierarchy\\Default Work Unit\\_f", | |
| "property": "3DPosition", | |
| "value":"2" | |
| } | |
| types = client.call("ak.wwise.core.object.getTypes")['return'] | |
| types = sorted(types, key=lambda x: x['name'].lower()) | |
| for t in types: | |
| type_name = t['name'] | |
| type_classid = t['classId']; | |
| print(f'{type_name}({type_classid})') | |
| get_property_names_args = { | |
| "classId": t['classId'] | |
| } | |
| names = client.call("ak.wwise.core.object.getPropertyNames", get_property_names_args)['return'] | |
| infos = [] | |
| for name in names: | |
| get_property_info_args = { | |
| "classId": t['classId'], | |
| "property": name | |
| } | |
| info = client.call("ak.wwise.core.object.getPropertyInfo", get_property_info_args) | |
| infos.append(info) | |
| infos = sorted(infos, key=lambda x: x['display']['index']) | |
| for info in infos: | |
| name = info['name'] | |
| display_name = '' | |
| display_group = '' | |
| if info['display']: | |
| display_name = info['display']['name'] | |
| display_group = info['display']['group'] | |
| property_type = info['type'] | |
| property_range_min = '' | |
| property_range_max = '' | |
| if info['restriction'] and info['restriction']['type'] == 'range': | |
| property_range_min = info['restriction']['min'] | |
| property_range_max = info['restriction']['max'] | |
| print( f'\t{name}, {display_name}, {display_group}, {property_type}, {property_range_min}, {property_range_max}') | |
| except CannotConnectToWaapiException: | |
| print("Could not connect to Waapi: Is Wwise running and Wwise Authoring API enabled?") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment