Engine Plugin Parameter Data

Although it is not required to do so, a plugin may declare its own parameter data consisting of integers, doubles, strings, filenames, enumerations, etc. The values of the data can be subsequently edited from within the application. The data is persisted in the scenario files. This is a very powerful and useful capability, especially for debugging code. It also allows a user to run with different parameter settings without having to re-edit (and possibly re-compile and build) the plugin. The sample code provided shows the use of plugin parameter data.

To declare parameter data for use by the application, the plugin must implement the IAgUtPluginConfig interface. This interface has two methods: (i) GetPluginConfig(); and (ii) VerifyPluginConfig(). On the GetPluginConfig() call, the application will pass an IAgAttrBuilder interface as its sole argument. The plugin then uses this interface to declare its own parameter data. It then returns a 'Scope' (a container of the parameter data) back to the application. The VerifyPluginConfig() call is a callback that allows the plugin to validate any user modifications of the data.

When the user chooses a plugin component from the user interface, the component is interrogated to determine whether it supports the IAgUtPluginConfig interface. This requires the plugin to be created as described above (see Plugin Component Lifecycle). The Init() method will not be called however because the computation process has not started. When the user has applied any parameter value changes (and the values has been verified by the plugin), the application will store the values internally. At this point, the plugin may be freed. When the computation process starts, the plugin will again be created and the application will set the previously stored parameter values back into the plugin before its Init() method is called.

Note: Currently, the Site Interface that may be obtained during the computational process is only available during the computation process. Thus, it is not available when the plugin is accessed for its parameter data.

Related Topics:

You may also want to learn more about:

STK 11.2.1 Programming Interface