MQBasePlugin class

(new in Rev2.40)

MQBasePlugin class is a base class for all types of plug-ins. It is available as a class library by adding MQBasePlugin.cpp and MQBasePlugin.h to a project. You can make a command plug-in with a simple implementation and without taking care of complex message procedures by returning an inherited class in GetPluginClass().

Several plug-in functions are declared as virtual functions in MQBasePlugin class. It is necessary to implement them in an inherited class.

Class
MQBasePlugin Constructor
~MQBasePlugin Destructor
Plug-in
GetPlugInID Get a plug-in ID
GetPlugInName Get a plug-in name
GetPlugInType Get a type of a plug-in
Supplemental functions
OpenSetting Get a setting file
CloseSetting Close a setting file
GetResourceString Get a resource string
GetSettingValue Get a setting value
GetSystemColor Get a system color
GetResourceCursor Get a default mouse cursor
GetScreenMouseCursor Get a mouse cursor for a screen
SetScreenMouseCursor Set a mouse cursor for a screen
GetLUTCount Get a number of LUTs
GetLUTName Get a LUT's name
GetLUTData Get LUT data
GetSceneOption Get display options of the scene
GetEditOption Get edit options
GetDisplayUnit Get a display unit
GetDisplayUnitString Get display unit's string and scale/td>
GetFilename Get a filename
SaveDocument Save a document
EnumLoadableImages Get loadable image formats
SendUserMessage Send a plugin-in own message to the other plug-ins
SetDrawProxyObject Set a draw proxy object

MQBasePlugin::MQBasePlugin();

It is a constructor.


virtual MQBasePlugin::~MQBasePlugin();

It is a destructor. It is declared as a virtual function.


virtual void MQBasePlugin::GetPlugInID(DWORD *Product, DWORD *ID);

Product
A pointer to receive a product(author) name
ID
A pointer to receive a product ID

It returns a product(author) name and a product ID as a 64-bit value.

The 'Product' and 'ID' can be random values which do not overlap with others.

This method is declared as a pure virtual function. It conceals MQGetPlugInID() by implementing in an inherited class.


virtual const char *MQBasePlugin::GetPlugInName();

Return value
This plug-in's name

It returns a plug-in name to display on the [About plug-ins] dialog.

This method is declared as a pure virtual function. It conceals MQGetPlugInName() by implementing in an inherited class.

 


virtual int MQBasePlugin::GetPlugInType();

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 the selected part
[MQPLUGIN_TYPE_STATION] Station
[MQPLUGIN_TYPE_COMMAND] Command (new in Rev2.41)

It returns a type of the plug-in.

This method is declared as a pure virtual function. It conceals MQGetPlugInType() by implementing in an inherited class.


MQSetting *MQBasePlugin::OpenSetting();

Return value
A setting object

It gets a class to access to a "metaseq.setting.xml" file to save settings of Metasequoia. You can load and save plug-in original settings through the class.

The setting class must be delete by CloseSetting().

(in Rev4.00)

A file to access had been changed from "metaseq.ini" into "metaseq.setting.xml".


void MQBasePlugin::CloseSetting(MQSetting *setting);

setting
A setting object

It closes a setting object opened by OpenSetting().


std::wstring MQBasePlugin::GetResourceString(const char *id);

id
Resource string ID
Return value
String

(new in Rev4.00)

It returns a string defined in command.xml for the current language.


std::wstring MQBasePlugin::GetSettingValue(MQSETTINGVALUE_TYPE type);

type
Setting value type
[MQSETTINGVALUE_LANGUAGE] Language
[MQSETTINGVALUE_ROTATION_HANDLE] Shape of a rotation handle
[MQSETTINGVALUE_HANDLE_SIZE] Size of a handle
[MQSETTINGVALUE_HANDLE_SCALE] Scaling rate of a handle
[MQSETTINGVALUE_NORMALMAP_FLIP] Flip normal map
Return value
A setting value

(new in Rev4.02)

It returns a setting value in the system.


MQColor MQBasePlugin::GetSystemColor(MQSYSTEMCOLOR_TYPE color_type);

color_type
A type of a color
[MQSYSTEMCOLOR_OBJECT] Object
[MQSYSTEMCOLOR_SELECT] Selection
[MQSYSTEMCOLOR_TEMP] Temporal object
[MQSYSTEMCOLOR_HIGHLIGHT] Highlight
[MQSYSTEMCOLOR_UNACTIVE] Unactive
[MQSYSTEMCOLOR_MESH_YZ] YZ plane
[MQSYSTEMCOLOR_MESH_ZX] ZX plane
[MQSYSTEMCOLOR_MESH_XY] XY plane
[MQSYSTEMCOLOR_BLOB_PLUS] Blob +
[MQSYSTEMCOLOR_BLOB_MINUS] Blob -
[MQSYSTEMCOLOR_UV] UV unwrap
[MQSYSTEMCOLOR_AXIS_X] X axis
[MQSYSTEMCOLOR_AXIS_Y] Y axis
[MQSYSTEMCOLOR_AXIS_Z] Z axis
[MQSYSTEMCOLOR_AXIS_W] Center axis
[MQSYSTEMCOLOR_AXIS_ACTIVE] Active axis
[MQSYSTEMCOLOR_PREVIEW_BACK] Preview background
Return value
Color

(new in Rev4.02)

It returns a system color.


HCURSOR MQBasePlugin::GetResourceCursor(MQCURSOR_TYPE cursor_type);

cursor_type
A type of a mouse cursor
[MQCURSOR_SIZEALL] 4 directional arrows
[MQCURSOR_HANDPOINT] Hand point
[MQCURSOR_HELP] Question
[MQCURSOR_NO] Prohibit
[MQCURSOR_WAIT] Sandglass
[MQCURSOR_UPARROW] Up arrow
[MQCURSOR_SIZEWE] The both-directions arrow which points out right and left
[MQCURSOR_SIZENWSE] The both-directions arrow which points out left up and right bottom
[MQCURSOR_SIZENS] The both-directions arrow which points out up and bottom
[MQCURSOR_SIZENESW] The both-directions arrow which points out right up and left bottom
[MQCURSOR_CROSS] Cross
[MQCURSOR_NONE] Invisible
[MQCURSOR_DEFAULT] Default
[MQCURSOR_RECT] Rectangle
[MQCURSOR_ROPE] Rope
[MQCURSOR_MOVE] Move
[MQCURSOR_SCALE] Scale
[MQCURSOR_ROTATE] Rotate
Return value
A cursor handle

(new in Rev2.46)

It gets the specified type of the mouse cursor.

The returned cursor is available for SetScreenMouseCursor() or MQCommandPlugin::SetMouseCursor().


HCURSOR MQBasePlugin::GetScreenMouseCursor();

Return value
A cursor handle

(new in Rev4.30)

It returns a current mouse cursor for a screen.


void MQBasePlugin::SetScreenMouseCursor(HCURSOR cursor);

cursor
A cursor handle

(new in Rev4.30)

It changes a mouse cursor for a screen.

Please specify a cursor that is obtained by GetResourceCursor() or is a resource cursor obtained by LoadCursor() of Win32-API with the DLL instance. The operation is not ensured when a predefined cursor obtained by LoadCursor() with the NULL instance is specified.

Please call MQCommandPlugin::SetMouseCursor() if you want to change a cursor for 3D views.

Please call MQWidgetBase::SetCursor() if you want to change a cursor for a widget.


int MQBasePlugin::GetLUTCount();

Return value
A number of LUTs

(new in Rev4.40)

It returns a number of LUTs (color maps) prepared in the system.


const unsigned char *MQBasePlugin::GetLUTData(int index);

index
An index of LUT
Return value
LUT data

(new in Rev4.40)

It returns a LUT (color map) data prepared in the system.

256 colors by a RGB order; total 768 bytes; are contained in the returned pointer.


const unsigned char *MQBasePlugin::GetDefaultLUTData();

Return value
Defautl LUT data

(new in Rev4.40)

It returns a default LUT (color map) data prepared in the system.

256 colors by a RGB order; total 768 bytes; are contained in the returned pointer.


void MQBasePlugin::GetSceneOption(MQScene scene, SCENE_OPTION& option);

scene
A scene
option
Display options

It gets display options of the scene.

struct SCENE_OPTION {
    BOOL ShowVertex;
    BOOL ShowLine;
    BOOL ShowFace;
    BOOL FrontOnly;
    BOOL ShowBkimg;
};
ShowVertex
Show vertices
ShowLine
Show lines
ShowFace
Show faces
FrontOnly
Show front faces only
ShowBkimg
Show background images

void MQBasePlugin::GetEditOption(EDITOPTION& option);

option
Edit options

It gets edit options. The edit options are stored in 'option'.

struct EDIT_OPTION {
    BOOL EditVertex;                // Enable vertex editing
    BOOL EditLine;                  // Enable line editing
    BOOL EditFace;                  // Enable face editing
    BOOL SelectRect;                // Selection with rectangle
    BOOL SelectRope;                // Selection with rope
    BOOL SnapX;                     // Edit along X axis
    BOOL SnapY;                     // Edit along Y axis
    BOOL SnapZ;                     // Edit along Z axis
    COORDINATE_TYPE CoordinateType; // A type of a coordinate
    SNAP_GRID_TYPE SnapGrid;        // Snap to a grid
    BOOL Symmetry;                  // Symmetry editing
    float SymmetryDistance;         // Distance for symmetry editing
    BOOL CurrentObjectOnly;         // Edit current object only
    SNAP_PLANE_TYPE SnapPlane;      // Snap to a plane (new in Rev 4.20)
    MQPoint SnapPlanePos;           // Position of snapping plane (new in Rev 4.20)
    MQPoint SnapPlaneDir;           // Direction of snapping plane (new in Rev 4.20)
    BOOL SnapVertex;                // Snap to vertices (new in Rev 4.20)
    BOOL SnapLine;                  // Snap to lines (new in Rev 4.20)
    BOOL SnapFace;                  // Snap to faces (new in Rev 4.20)
};
CoordinateType
A type of a coordinate
[COORDINATE_SCREEN] Screen coordinate
[COORDINATE_WORLD] World coordinate
[COORDINATE_LOCAL] Local coordinate
SnapGrid
Snap in each axis (Use & operator for checking because multiple values are set)
[SNAP_GRID_X] Snap in the X axis
[SNAP_GRID_Y] Snap in the Y axis
[SNAP_GRID_Z] Snap in the Z axis

MQDISPLAYUNIT MQBasePlugin::GetDisplayUnit();

Return value
Display unit
[MQDISPLAYUNIT_NONE] None
[MQDISPLAYUNIT_MM] Millimeter
[MQDISPLAYUNIT_CM] Centimeter
[MQDISPLAYUNIT_M] Meter
[MQDISPLAYUNIT_INCH] Inch
[MQDISPLAYUNIT_FEET] Feet

(new in Rev4.59)

It returns a display uint for length.


static const wchar_t *MQBasePlugin::GetDisplayUnitString(MQDISPLAYUNIT unit, double *scale)

unit
Display unit
[MQDISPLAYUNIT_NONE] None
[MQDISPLAYUNIT_MM] Millimeter
[MQDISPLAYUNIT_CM] Centimeter
[MQDISPLAYUNIT_M] Meter
[MQDISPLAYUNIT_INCH] Inch
[MQDISPLAYUNIT_FEET] Feet
scale
Display unit's scale
Return value
Display unit's string

(new in Rev4.60)

It gets Display unit's scale and string.


std::wstring MQBasePlugin::GetFilename(MQDocument doc);

doc
A document
Return value
A filename

(new in Rev4.59)

It returns a filename for the document. An empty string will be returned if no filename is specified.


bool MQBasePlugin::SaveDocument(MQDocument doc, const wchar_t *filename, const SAVE_DOCUMENT_OPTION& option);

doc
A document
filename
A filename
option
Save option
Return value
Succeeded or failed.

(new in Rev4.59)

It saves a document to a file.

If a plug-in ID in the save option is defined, the Export plugin that has the plug-in ID will save a file. Otherwise, a file format to save will be automatically determined by the file extension.

struct SAVE_DOCUMENT_OPTION {
	DWORD ExportProductID;
	DWORD ExportPluginID;
	int ExportIndex;
};
ExportProductID
A product ID for Export plugin
ExportPluginID
A plugin ID for Export plugin
ExportIndex
An index for Export plugin

std::vector<std::wstring> MQBasePlugin::EnumLoadableImages()

Return value
loadable image formats

(new in Rev4.60)

It gets loadable image formats.


int MQBasePlugin::SendUserMessage(MQDocument doc, DWORD target_product, DWORD target_id, const char *description, void *param);

doc
A document
target_product
A product ID to send a message
target_id
A plug-in ID to send a message
description
An arbitrary string described a message type
message
An arbitrary message
Return value
Returned value by the plug-in

(new in Rev2.41)

It sends an arbitrary message to the other station or command plug-in.

You can send an arbitrary data to the target plug-in by storing a pointer in message.

The message will be sent to all plug-in when you set 0 to target_product and 0 to target_id.

The message is received in MQStationPlugin::OnReceiveUserMessage() of the target plug-in.

 

Attention: The return value cannot be received correctly in Ver2.4.4 or older version.


void MQSBasePlugin::SetDrawProxyObject(MQObject obj, MQObject proxy);

obj
An object
proxy
A draw proxy object (can be NULL)

(new in Rev4.30)

A "draw proxy object" is displayed instead of vertices, lines or faces in a normal object. The display is only alternated, and it does not affect each operation.

Usually, obj is specified an object in the document, and proxy is specified an object that is created by MQ_CreateObject() or CreateDrawingObject().

When you specify a draw proxy object that is created by CreateDrawingObject() with TRUE instant in the OnDraw(), the object is displayed only once and it is deleted automatically after calling OnDraw().

When you set FALSE to instant or used an object created by MQ_CreateObject(), the object is continuously displayed until deleting it or specifying another draw proxy object.。