...

Chasys Draw IES Help:


SDK - Layer Attachments - APPL
 

Using the APPL meta-type

The APPL attachment allows plug-ins that generate content based in a set of input parameters to offer re-editability by saving those parameters to the layer and having Chasys Draw IES automatically invoke the relevant plug-in when the layer is double-clicked with the Hand tool. The metadata consists of a host-defined header followed by plug-in-defined data of arbitrary length:

struct meta_tag_APPL
{
    wchar_t        name[32];
    wchar_t        file[32];
    char           unused_1[256-128-1];
    unsigned char  type;
};

The plug-in requests metadata of size sizeof(meta_tag_APPL)+size_of_plugin_data. The plug-in then proceeds to fill the header with the type, a name (e.g. “Draw Ball”) and its filename minus the path as the file (e.g. “efx_DrawBall.dll”). The plug-in may then use the extra space to store its parameters, which it will use to re-render the image (e.g. a colored ball) when the host invokes it.

It's not mandatory that you use a magic number in your data structure, but it's highly advisable.

 

Sample Code

Here's some sample code that illustrates the use of APPL metadata:
TAGS: Chasys Draw IES Source Code, Attachment, Metadata, APPL

#define MY_APPL_MAGIC (*((LPDWORD)("Ball")));

meta_tag_APPL* appl;
my_params_tag* opts;

data->meta_query("APPL",sizeof(meta_tag_APPL)+sizeof(my_params_tag));
appl=(
meta_tag_APPL*)data->meta_data;
opts=(
my_params_tag*)(data->meta_data+sizeof(meta_tag_APPL));

... ...

appl->type=META_APPL_TYPE_RUN_EFX;
GetModuleFileName(api_inst,str,MAX_PATH);
wcscpy(appl->name,L"Draw Ball");
wcscpy(appl->file,PathToFilename(str));

opts->magic=MY_APPL_MAGIC;
opts->radius=parameters.radius;
opts->style1=parameters.style1;
opts->style2=parameters.style2;
opts->color1=parameters.color1;
opts->color2=parameters.color2;