Name
hw_AddLoaderAdapter -- add a loader or an adapter (V6.0)
Synopsis
int error = hw_AddLoaderAdapter(hwPluginBase *self, ULONG type);
Function
This function can be used to manually activate a file loader or adapter plugin. The following types are currently supported:

HWPLUG_CAPS_IMAGE:
Image loader plugins. You only need to call hw_AddLoaderAdapter() on them if automatic initialization has been disabled by setting the HWEXT_IMAGE_NOAUTOINIT extension bit.

HWPLUG_CAPS_ANIM:
Anim loader plugins. You only need to call hw_AddLoaderAdapter() on them if automatic initialization has been disabled by setting the HWEXT_ANIM_NOAUTOINIT extension bit.

HWPLUG_CAPS_SOUND:
Sound loader plugins. You only need to call hw_AddLoaderAdapter() on them if automatic initialization has been disabled by setting the HWEXT_SOUND_NOAUTOINIT extension bit.

HWPLUG_CAPS_VIDEO:
Video loader plugins. You only need to call hw_AddLoaderAdapter() on them if automatic initialization has been disabled by setting the HWEXT_VIDEO_NOAUTOINIT extension bit.

HWPLUG_CAPS_FILEADAPTER:
File adapter plugins. These are not initialized automatically. So you will have to call hw_AddLoaderAdapter() on them or they will only be available when the user directly addresses them using the Adapter tag.

HWPLUG_CAPS_DIRADAPTER:
Directory adapter plugins. These are not initialized automatically. So you will have to call hw_AddLoaderAdapter() on them or they will only be available when the user directly addresses them using the Adapter tag.

HWPLUG_CAPS_NETWORKADAPTER:
Network adapter plugins. These are not initialized automatically. So you will have to call hw_AddLoaderAdapter() on them or they will only be available when the user directly addresses them using the Adapter tag. (V8.0)

HWPLUG_CAPS_ICON:
Icon loader plugins. You only need to call hw_AddLoaderAdapter() on them if automatic initialization has been disabled by setting the HWEXT_ICON_NOAUTOINIT extension bit. (V9.0)

HWPLUG_CAPS_FONT:
Font loader plugins. You only need to call hw_AddLoaderAdapter() on them if automatic initialization has been disabled by setting the HWEXT_FONT_NOAUTOINIT extension bit. (V10.0)

HWPLUG_CAPS_FILESYSADAPTER:
Filesystem adapter plugins. These are not initialized automatically. So you will have to call hw_AddLoaderAdapter() on them or they will only be available when the user directly addresses them using the Adapter tag. (V10.0)

Please note that this function cannot be used to activate display, timer, requester, and audio adapters. These all have custom functions that are used for their activation, e.g. hw_SetDisplayAdapter() for display adapters.

This function should be called from inside your RequirePlugin() implementation. If this function succeeds, Hollywood will call your loader or adapter whenever it needs to open an object of the respective type and your plugin can then choose which objects it would like to handle. In the first parameter, you have to pass a pointer to the hwPluginBase that Hollywood has passed to your plugin's InitPlugin() function. The second parameter has to specify the type of the loader or adapter to add (see above for supported types). Note that this must not be a combination of types, but only a single loader or adapter type can be activated per call.

Loaders and adapters may be added and removed any time you want. They are not a one time setting, though traditionally you will want to install your loaders and adapters when your RequirePlugin() is called as a result of the user running @REQUIRE on your plugin. But this is not a must. You may also choose to add and remove loaders and adapters at any later time. When Hollywood opens an object, the loaders and adapters will be asked whether they want to handle this object in the order they were added into the system. First come, first served.

It is not necessary to remove the loader or adapter using hw_RemoveLoaderAdapter() when your plugin is closed. Hollywood will do this automatically for you.

Please note that even if this function hasn't been called, Hollywood can still call your loaders and adapters. This will happen if the user directly addresses a loader or an adapter in the script. Consider the following example:

 
LoadBrush(1, "a.tiff.pp", {Loader = "tiff", Adapter = "powerpacker"})

This Hollywood code will call into the file adapter of powerpacker.hwp and into the image loader of tiff.hwp directly, no matter if they have been activated or not. If loaders and adapters are addressed directly, Hollywood will always call them if the respective plugins are not disabled. Thus, it is advised that you call hw_ConfigureLoaderAdapter() in your InitPlugin() implementation because RequirePlugin() might not even be called if the user addresses the loader or adapter directly. See hw_ConfigureLoaderAdapter for details.

Starting with Hollywood 7.1 hw_ConfigureLoaderAdapter() allows you to forbid Hollywood calling into plugins that haven't been required. This can be done by setting one of the HWCLAXXX_MUSTREQUIRE flags. See hw_ConfigureLoaderAdapter for details.

Designer compatibility
Unsupported

Inputs
self
hwPluginBase pointer passed to InitPlugin()
type
type of the loader or adapter to add (see above)
Results
error
error code or 0 for success

Show TOC