Plug-in function

The following functions are necessary to be implemented in a plug-in DLL. The plug-in own operations are written in each function.

o: Required, x: Not necessary


void MQGetPlugInID(DWORD *Product, DWORD *ID);

Product
A pointer to be set a product (author) name
ID
A pointer to be set a product ID

It gets a product (author) name and a product ID in all 64-bit value.

You can choose a random value which is not overlapped with other plug-ins for Product and ID.

This function is called when Metasequoia starts up.

Create Export Import Object Select Station Command
o o o o o o o

const char *MQGetPlugInName(void);

Return value
A plug-in name

It gets a plug-in name displayed in the [About plug-ins] dialog.

This function is called when the dialog is shown.

Create Export Import Object Select Station Command
o o o o o o o

int MQGetPlugInType(void);

Return value
A type of a plug-in
[MQPLUGIN_TYPE_IMPORT] Import
[MQPLUGIN_TYPE_EXPORT] Export
[MQPLUGIN_TYPE_CREATE] Create objects
[MQPLUGIN_TYPE_OBJECT] Modify objects
[MQPLUGIN_TYPE_SELECT] Modify selected parts
[MQPLUGIN_TYPE_STATION] Station (new in Rev2.40)
[MQPLUGIN_TYPE_COMMAND] Command (new in Rev2.41)

It gets a type of a plug-in.

This function is called when Metasequoia starts up.

Create Export Import Object Select Station Command
o o o o o o o

const char *MQEnumFileType(int index);

index
An index of a type of a file
Return value
A name of the file type

It gets a file extension with the specified index. The extension is used in a file dialog.

This function is called when Metasequoia starts up. The 'index' is called sequentially from 0, and the call ends  when this function returns NULL.


Create Export Import Object Select Station Command
x o o x x x x

const char *MQEnumFileExt(int index);

index
An index of a type of a file
Return value
An extension

It gets a file extension with the specified index. The extension is used in a file dialog.

This function is called when Metasequoia starts up. The 'index' is called sequentially from 0, and the call ends  when this function returns NULL.

Create Export Import Object Select Station Command
x o o x x x x

BOOL MQImportFile(int index, const char *filename, MQDocument doc);

BOOL MQImportFileW(int index, const wchar_t *filename, MQDocument doc);

index
An index of a type of a file
filename
A filename (full path)
doc
A document
Return value
Succeeded or failed
[TRUE] Succeeded to import
[FALSE] Failed tot import

It loads data from a file and adds objects to a document.

It must return FALSE when it cannot load the file normally, the file contains unknown format, no valid object exists or an error has been occurred.

An encoding of 'filename' in MQImportFile() is ANSI in Windows, and utf-8 in Mac.

(in Rev4.70)

MQImportFileW() has been added. MQImportFileW() is recommended, but MQImportFile() is also available for the compatibility.

Create Export Import Object Select Station Command
x x o x x x x

BOOL MQExportFile(int index, const char *filename, MQDocument doc);

BOOL MQExportFileW(int index, const wchar_t *filename, MQDocument doc);

index
An index of a type of a file
filename
A filename (full path)
doc
A document
Return value
Succeeded or failed
[TRUE] Succeeded to export
[FALSE] Failed to export

It writes objects in a document to a file.

It must return FALSE when the export was failed for some reason.

An encoding of 'filename' in MQExportFile() is ANSI in Windows, and utf-8 in Mac.

(in Rev4.70)

MQExportFileW() has been added. MQExportFileW() is recommended, but MQExportFile() is also available for the compatibility.

Create Export Import Object Select Station Command
x o x x x x x

const char *MQEnumString(int index);

const wchar_t *MQEnumStringW(int index);

index
An index of a type
Return value
A string

It returns a string of a specific purpose which respond to the plug-in type.

The string is displayed in a menu if the plug-in type is Create, Object, Select or Station. The string is displayed on a button if the plug-in type is Command.

(in Rev4.70)

MQEnumStringW() has been added. MQEnumStringW() is recommended, but MQEnumString() is also available for the compatibility.

Create Export Import Object Select Station Command
o x x o o o o

BOOL MQCreate(int index, MQDocument doc);

index
An index of a type
doc
A document
Return value
Succeeded or failed to create
[TRUE] Succeeded
[FALSE] Failed

An object will be created and registered to the document in this function.

Create Export Import Object Select Station Command
o x x x x x x

BOOL MQModifyObject(int index, MQDocument doc);

index
An index of a type
doc
A document
Return value
Succeeded or failed to modify
[TRUE] Succeeded
[FALSE] Failed

The current object will be modified in this function.

Create Export Import Object Select Station Command
x x x o x x x

BOOL MQModifySelect(int index, MQDocument doc);

index
An index of a type
doc
A document
Return value
Succeeded or failed to modify the selected elements
[TRUE] Succeeded
[FALSE] Failed

The selected vertices, lines and faces will be modified in this function.

Create Export Import Object Select Station Command
x x x x o x x

BOOL MQOnEvent(MQDocument doc, int event_type, void *option);

doc
A document
event_type
A type of an event
[MQEVENT_INITIALIZE] Initialize a plug-in
[MQEVENT_EXIT] Exit a plug-in
[MQEVENT_ACTIVATE] Activate or deactivate
[MQEVENT_IS_ACTIVATED] Return whether a plug-in is activated or deactivated
[MQEVENT_MINIMIZE] Response to minimize a main window
[MQEVENT_DRAW] Draw a scene
[MQEVENT_NEW_DOCUMENT] Initialize a document
[MQEVENT_END_DOCUMENT] Exit a document
[MQEVENT_SAVE_DOCUMENT] Save a document
[MQEVENT_UNDO] Execute an undo
[MQEVENT_REDO] Execute a redo
[MQEVENT_UNDO_UPDATED] Update an undo state
[MQEVENT_OBJECT_MODIFIED] Modify objects
[MQEVENT_OBJECT_SELECTED] Select objects
[MQEVENT_OBJECT_LIST] Change a current object
[MQEVENT_MATERIAL_MODIFIED] Change parameters of materials
[MQEVENT_MATERIAL_LIST] Change a current material
[MQEVENT_SCENE] Change a scene
option
Options
Return value
Whether to do with an operation for the event properly

(new in Rev2.40)

This function is called when some processes has been executed in Metasequoia. A station or command plug-in must do with the event properly.

Create Export Import Object Select Station Command
x x x x x o o