2.18 Designer compatibility

Hollywood Designer, the WYSIWYG editor for Hollywood scripts, also supports Hollywood plugins. However, it supports only a fraction of Hollywood's plugin API. Thus, you need to be very careful when calling plugin API functions because they might not be available when Hollywood Designer has opened your plugin.

The first version of Hollywood Designer that supports Hollywood plugins is version 4.0. Hollywood Designer supports the following plugin types:

HWPLUG_CAPS_IMAGE
Plugin provides a loader for additional image formats. See Image plugins for details.

HWPLUG_CAPS_ANIM
Plugin provides a loader for additional animation formats. See Animation plugins for details.

HWPLUG_CAPS_VIDEO
Plugin provides a loader for additional video formats. See Video plugins for details.

HWPLUG_CAPS_SAVEIMAGE
Plugin provides a saver for additional image formats. See Image saver plugins for details.

All the other plugin types are currently unsupported. Thus, you don't have to be careful about which plugin API functions you call if your plugin is of a type that Designer doesn't support anyway. Be careful about the InitPlugin() and ClosePlugin() functions, though. These will be called for all plugins so you must be very careful about the plugin API functions you call from these functions.

Let's suppose you are going to write a plugin that adds an image loader and a file adapter. In that case you would set hwPluginBase.CapsMask to HWPLUG_CAPS_IMAGE|HWPLUG_CAPS_FILEADAPTER. File adapters usually call hw_ConfigureLoaderAdapter() from their InitPlugin() implementation. hw_ConfigureLoaderAdapter(), however, is not supported by Designer because Designer doesn't support file adapters. That's why you have to check if Hollywood or Hollywood Designer has opened your plugin before you call hw_ConfigureLoaderAdapter(). You can check for Hollywood Designer by looking at the first function of LuaBase and see if it is NULL. If it is, you can be sure that you are being called by Hollywood Designer. Your implementation of InitPlugin() could then look like this:

 
HW_EXPORT int InitPlugin(hwPluginBase *self, hwPluginAPI *cl, STRPTR p)
{
    int isdesigner = (cl && cl->LuaBase->lua_gettop == NULL);

    self->CapsMask = HWPLUG_CAPS_IMAGE|HWPLUG_CAPS_FILEADAPTER;
    self->hwVersion = 1;
    self->hwRevision = 0;
    ...

    if(cl) {
        if(!isdesigner) cl->SysBase->hw_ConfigureLoaderAdapter(...);
    }

    return TRUE;
}

The code above will only call hw_ConfigureLoaderAdapter() if InitPlugin() has been called by Hollywood. If you don't do this check, Hollywood Designer will crash on every startup because your plugin tries to jump to a function that is NULL. So make sure your InitPlugin() implementation is compatible with Hollywood Designer.

To find out which plugin APIs are supported by Hollywood Designer, look at the "Designer compatibility" section that is part of every function's documentation.

To find out which version of Hollywood Designer is calling you, you must use the HWMCP_GETDESIGNERVERSION tag with the hw_MasterControl() function. It is not sufficient to look at the hwVersion and hwRevision members of the hwPluginBase that is passed to your InitPlugin() implementation because these just contain the version of the Hollywood plugin API provided by the Designer version that is calling your plugin. For example, Designer 4.0 will identify itself as Hollywood 5.0 whereas Designer 5.0 will identify itself as Hollywood 8.0. To get the real Designer version numbers, use HWMCP_GETDESIGNERVERSION. See hw_MasterControl for details.


Show TOC