The resource editor API

This chapter lists the structures that support the resource editor plugin API, the functions exported by PhAB that support the API, and the functions you need to provide in your plugin.

Resource editor code is put in a DLL. You can put one, two, or more resource editors into a single DLL. Alternatively, you can put the frugal resource editor for a resource type in one DLL, and the full editor in another. Each DLL is organized as an addon that uses the Addon Interface API.

The DLL must declare the addon interface as:


AOInterface_t interfaces[]=
  { "PhAB Resource Editors", RESPLUGIN_VERSION, &tab },
  { 0,0,0 }

Note that the RESPLUGIN_VERSION is defined as 202.

The tab variable must point to an instance of the ResPlugin_t structure.

Resource Editor API structures

You have to provide all the methods defined in ResPlugin_t, ResPluginFrugalEditor_t, and ResPluginFullEditor_t in the resource editor plugin, otherwise PhAB will not load and use the plugin.

When a new plugin instance is created, it is given a pointer to a structure that is exported from PhAB to the plugin and contains functions that the plugin can call into PhAB. All these functions take at least a PhABHandle_t as an argument.

Functions defined in ResPlugin_t that you must provide in the plugin:

Functions defined in ResPluginCommon_t that you must provide in the plugin:

Functions defined in ResPluginFrugalEditor_t that you must provide in the plugin:

Functions defined in ResPluginFullEditor_t that you must provide in the plugin:

Functions exported from PhAB

The resource editor's window supporting functions

These functions are exported from PhAB in the PhABResExportFull_t structure, which is passed as a pointer when the plugin instance is created. They are convenience functions that a full editor can use in order to ensure a consistent look for the resource editor windows. We recommend that you use these functions to create and manage the editor window, except for the case when your plugin spawns an external application. In that case the external application should provide the window.