The Resource file (with an .rc extension) describes the resources the plug-in uses to create a custom graphical interface. An easy way to manage Resource files is to use the Visual Studio Editor tool, which you can use to drag widgets onto a canvas to build the GUI. This section explains how to create a Resource file for a new plug-in.
Before you proceed, ensure that you are familiar with the development tools. Refer to Using the Development Tools for more information.
To create a Resource file:
- Run the following command to create a plug-in. For the purposes of this procedure, select an "effect" type plug-in when prompted:
python "%WWISEROOT%/Scripts/Build/Plugins/wp.py" new
- Run the following commands to change to the plug-in directory and then call
premake:
cd MyPlugin
python "%WWISEROOT%/Scripts/Build/Plugins/wp.py" premake Authoring
- Open the generated solution file (for example,
MyPlugin_Authoring_Windows_vc160.sln
) in Visual Studio 2019.
- In the Resource View, select the project name and in the menu bar, click Project > Add New Item. The Add New Item dialog opens.
- In the left pane, select Resource, then in the center pane select Resource File (.rc) and click Add. A
Resource.rc
file is created and appears under the project name in the Resource View. The file is located in the plug-in's WwisePlugin
subdirectory.
- In the Resource View, right-click the
Resource.rc
file and click Add Resource. In the Add Resource dialog, select Dialog and click New. A dialog resource is created and appears in the editing pane.
- Set the following values in the Properties pane:
- Appearance/Border: None
- Appearance/Clip Children: True
- Appearance/Style: Child
- Misc/Control: True
- Misc/Control Parent: True
- Drag any desired widgets from the Toolbox, located to the left of the editing pane, onto the dialog. When you are finished, click Save.
- From a command prompt in your plug-in directory, run the following two commands in order:
python "%WWISEROOT%/Scripts/Build/Plugins/wp.py" premake Authoring
python "%WWISEROOT%/Scripts/Build/Plugins/wp.py" build -c Release -x x64 -t vc160 Authoring
The first command includes the Resource.rc
file in your project, and the second creates a resource.h
file based on the Resource file.
- In the plug-in's
Win32
subdirectory, open the PluginNamePluginGUI.h
file and add the following code: #pragma once
#include "../MyPlugin.h"
#include "../resource.h"
class MyPluginGUI final
: public AK::Wwise::Plugin::PluginMFCWindows<>
{
public:
MyPluginGUI();
HINSTANCE GetResourceHandle() const override;
bool GetDialog(
AK::Wwise::Plugin::eDialog in_eDialog,
UINT& out_uiDialogID,
AK::Wwise::Plugin::PopulateTableItem*& out_pTable
) const override;
bool WindowProc(
AK::Wwise::Plugin::eDialog in_eDialog,
HWND in_hWnd,
uint32_t in_message,
WPARAM in_wParam,
LPARAM in_lParam,
LRESULT& out_lResult
) override;
private:
HWND m_hwndPropView = nullptr;
};
This code overrides the methods provided by AK::Wwise::Plugin::GUIWindows
and ensures that the plug-in uses the custom interface.
- Add the following code to the
PluginNamePluginGUI.cpp
file: HINSTANCE MyPluginGUI::GetResourceHandle() const
{
AFX_MANAGE_STATE( AfxGetStaticModuleState() );
return AfxGetStaticModuleState()->m_hCurrentResourceHandle;
}
bool MyPluginGUI::GetDialog( AK::Wwise::Plugin::eDialog in_eDialog, UINT & out_uiDialogID, AK::Wwise::Plugin::PopulateTableItem *& out_pTable ) const
{
AKASSERT( in_eDialog == AK::Wwise::Plugin::SettingsDialog );
out_uiDialogID = IDD_DIALOG1;
out_pTable = nullptr;
return true;
}
bool MyPluginGUI::WindowProc( AK::Wwise::Plugin::eDialog in_eDialog, HWND in_hWnd, uint32_t in_message, WPARAM in_wParam, LPARAM in_lParam, LRESULT & out_lResult )
{
switch ( in_message )
{
case WM_INITDIALOG:
m_hwndPropView = in_hWnd;
break;
case WM_DESTROY:
m_hwndPropView = NULL;
break;
}
out_lResult = 0;
return false;
}
- Save your changes and rebuild the plug-in. It is now available in Wwise as an Effect, which you can add to Wwise objects.