(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 |
InsertDocument | Insert 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 |
UpdateUndo | Update an undo buffer |
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);
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();
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();
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();
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);
It closes a setting object opened by OpenSetting().
std::wstring MQBasePlugin::GetResourceString(const char *id);
(new in Rev4.00)
It returns a string defined in command.xml for the current language.
std::wstring MQBasePlugin::GetSettingValue(MQSETTINGVALUE_TYPE type);
(new in Rev4.02)
It returns a setting value in the system.
MQColor MQBasePlugin::GetSystemColor(MQSYSTEMCOLOR_TYPE color_type);
(new in Rev4.02)
It returns a system color.
HCURSOR MQBasePlugin::GetResourceCursor(MQCURSOR_TYPE cursor_type);
(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();
(new in Rev4.30)
It returns a current mouse cursor for a screen.
void MQBasePlugin::SetScreenMouseCursor(HCURSOR cursor);
(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();
(new in Rev4.40)
It returns a number of LUTs (color maps) prepared in the system.
const unsigned char *MQBasePlugin::GetLUTData(int index);
(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();
(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);
It gets display options of the scene.
struct SCENE_OPTION { BOOL ShowVertex; BOOL ShowLine; BOOL ShowFace; BOOL FrontOnly; BOOL ShowBkimg; };
|
void MQBasePlugin::GetEditOption(EDITOPTION& option);
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) };
|
MQDISPLAYUNIT MQBasePlugin::GetDisplayUnit();
(new in Rev4.59)
It returns a display uint for length.
static const wchar_t *MQBasePlugin::GetDisplayUnitString(MQDISPLAYUNIT unit, double *scale)
(new in Rev4.60)
It gets Display unit's scale and string.
std::wstring MQBasePlugin::GetFilename(MQDocument doc);
(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);
(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; };
|
bool MQBasePlugin::InsertDocument(MQDocument doc, const wchar_t *filename, const OPEN_DOCUMENT_OPTION& option);
(new in Rev4.71)
It loads a file, and insert objects and materials.
If a plug-in ID in the option is defined, the Import plugin that has the plug-in ID will open a file. Otherwise, a file format to open will be automatically determined by the file extension.
struct OPEN_DOCUMENT_OPTION { DWORD ImportProductID; DWORD ImportPluginID; int ImportIndex; MERGE_MODE MergeMode; };
|
std::vector<std::wstring> MQBasePlugin::EnumLoadableImages()
(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);
(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, bool sync_select = false);
(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.。
When you specifies true to 'sync_select', the selection of vertices, lines and faces is synchronized from an original object. A number of vertices and faces must be same.
void MQBasePlugin::UpdateUndo();
void MQBasePlugin::UpdateUndo(const wchar_t *str);
It updates an undo buffer.
The undo will be automatically updated when you change standard data such as objects or materials. But if you change the plug-in's own data, you can explicitly update the undo by calling this function.
Actually, this function only reserves an updating of an undo buffer. It is done with after exiting an event procedure in a plugin and returning a procedure to the main part of Metasequoia.
(new in Rev4.30)
str specifies a displayed string in a menu and so on.
Attention: In Ver2.4.3 or older version, it does not make any change by calling UpdateUndo() in ExecuteCallback().