Last active
November 24, 2017 13:21
-
-
Save decasteljau/00aa842b6985aefc2e3772c7aad00ce8 to your computer and use it in GitHub Desktop.
This file contains 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
using namespace AK::WwiseAuthoringAPI; | |
void PrintApiError(const char* in_functionName, AkJson in_json) | |
{ | |
std::cout << "Failed to call '" << in_functionName << "' with error: " << std::string(RapidJsonUtils::GetAkJsonString(in_json)) << std::endl; | |
} | |
void HelloWorld() | |
{ | |
Client client; | |
// Connect to Wwise Authoring on localhost. | |
if (!client.Connect("127.0.0.1", 8080)) | |
{ | |
std::cout << "Could not connect to Wwise Authoring on localhost." << std::endl; | |
return; | |
} | |
AkJson selectedResult; | |
if (!client.Call(ak::wwise::ui::getSelectedObjects, AkJson::Map{}, AkJson::Map{}, selectedResult)) | |
{ | |
PrintApiError(ak::wwise::ui::getSelectedObjects, selectedResult); | |
return; | |
} | |
if (selectedResult["objects"].GetArray().size() >= 1) | |
{ | |
AkJson args(AkJson::Map | |
{ | |
{ "command", AkVariant("FindInProjectExplorerNoSyncGroup") }, | |
{ "objects", AkJson::Array{ | |
selectedResult["objects"].GetArray()[0]["id"] } } | |
}); | |
AkJson executeResult; | |
if (!client.Call(ak::wwise::ui::commands::execute, args, AkJson(AkJson::Map()), executeResult)) | |
{ | |
PrintApiError(ak::wwise::ui::commands::execute, executeResult); | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment