(new in Rev2.40)
MQStationPlugin class inherits MQBasePlugin class, and provides functions necessary for an implementation of a station plug-in.
You can make a station plug-in with a simple implementation and without taking care of complex message procedures between a plug-in and a main part of Metasequoia by inheriting this MQStationPlugin class and implementing required virtual functions.
In MQStationPlugin class, each plug-in member functions and messages are declared as virtual functions. It is necessary to implement the virtual function in the inherited class.
Class | |
MQStationPlugin | Constructor |
~MQStationPlugin | Destructor |
CreateNewPlugin | Create a new plugin class |
Declared in super class | |
GetPlugInID | Get a plug-in ID |
GetPlugInName | Get a plug-in name |
Plug-in | |
GetPlugInType | Get a plug-in type |
EnumString | Get a string displayed in a menu or on a button |
EnumSubCommand | Enumerate sub commands |
GetSubCommandString | Get a sub command's displayed string |
Initialize | Initialize an application |
Exit | Exit an application |
Message procedure | |
Activate | A message for activating or deactivation a window |
IsActivated | A message for checking an activated state of a plug-in |
OnSubCommand | A message for calling a sub command |
OnSwitchSubCommand | A message for switching a sub command |
OnMinimize | A message for minimizing a window |
OnReceiveUserMessage | A message for receiving a plug-in own message |
OnDraw | A message for drawing |
OnNewDocument | A message for initializing a document |
OnEndDocument | A message for exiting a document |
OnSaveDocument | A message for saving a document |
OnSavePastDocument | A message for saving past state documents, for example crash. |
OnUndo | A message for an undo |
OnRedo | A message for an redo |
OnUpdateUndo | A message for updating an undo state |
OnObjectModified | A message for editing objects |
OnObjectSelected | A message for selecting objects |
OnUpdateObjectList | A message for changing a current object |
OnMaterialModified | A message for modifying parameters of materials |
OnUpdateMaterialList | A message for changing a current material |
OnUpdateScene | A message for updating a scene |
OnChangeEditOption | A message for chainging an edit option |
OnConfigurationChanged | A message for chaining configurations |
OnQueryInterpolate | A message for querying interpolation of a vertex or face attribute value |
OnInterpolateVertexData | A message for interpolating a vertex attribute value |
OnInterpolateApexData | A message for interpolating an apex attribute value |
OnUseClipboard | A message for using a clipboard |
Supplemental functions for the super class | |
OpenSetting | Open 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 |
SendUserMessage | Send a plug-in own message to the other plug-ins |
SetDrawProxyObject | Set a draw proxy object |
GetEditOption | Get edit options |
GetSceneOption | Get display options of the scene |
Supplemental functions | |
WindowClose | Close a window |
BeginCallback | Begin the callback procedure |
ExecuteCallback | Implementation for the callback |
CreateDrawingObject | Add a drawing object in OnDraw() |
CreateDrawingObjectByClone | Add a drawing object by cloning a source object in OnDraw() |
CreateDrawingMaterial | Add a material for a drawing object in OnDraw() |
CreateDrawingText | Add a drawing text in OnDraw() |
DeleteDrawingObject | Delete a drawing object |
DeleteDrawingMaterial | Delete a material for drawing objects |
DeleteDrawingText | Delete a drawing text |
GetCurrentUndoState | Get a current undo state |
ExecuteUndo | Execute an undo |
ExecuteRedo | Execute an redo |
ClearUndoBuffer | Clear an undo buffer |
GetSnappedPos | Get a snapped position |
MQStationPlugin::MQStationPlugin();
This method is a constructor.
virtual MQStationPlugin::~MQStationPlugin();
This method is a destructor. It is defined as a virtual function.
virtual MQBasePlugin *MQStationPlugin::CreateNewPlugin();
Creates a new plugin class for another document.
This function is for Mac only, and it is defined as a pure virtual function.
virtual int MQStationPlugin::GetPlugInType();
This method implements a virtual function declared by MQBasePlugin::GetPlugInType(). No additional implementation is necessary in an inherited class.
virtual const char *MQStationPlugin::EnumString();
It returns a display string in a menu (for Station plug-in) or on a button (for Command plug-in).
This method is declared as a pure virtual function, and it disappears MQEnumString() by implementing in the inherited class.
virtual const char *MQStationPlugin::EnumSubCommand(int index);
It returns a name for a sub command which can be assigned a shortcut key.
This method is repeatedly called with an increment of index from 0. When the return value is NULL, an enumeration will be finished.
This method is declared as a virtual function, and no sub command is registered in MQStationPlugin. Please implement EnumSubCommand(), GetSubCommandString() and OnSubCommand() in an inheriting class if you want to sub command(s).
And when a button is registered by MQWidgetBase::RegisterSubCommandButton(), a shortcut key assigned to the sub command will be shown on the button.
virtual const wchar_t *MQStationPlugin::GetSubCommandString(int index);
It returns a displayed string of the sub command with the specified index.
virtual BOOL MQStationPlugin::Initialize();
This method is called when Metasequoia starts up or after loading the plug-in DLL by the "About plug-ins" dialog.
This method is declared as a pure virtual function, and you must implement in an inherited class. Though what to be implemented is not specified, it generally creates a window displayed when it is called from a menu.
Attention: In Ver2.4.3 or older version, Initialize() is also called multiply after loading the DLL for a bug. It is only called just after loading the DLL in Ver2.4.4 or later version
virtual void MQStationPlugin::Exit();
This method is called when Metasequoia quits or before unloading the plug-in DLL by the "About plug-ins" dialog.
This method is declared as a pure virtual function, and you must implement in an inherited class. Though what to be implemented not specified, it generally releases resources allocated by Initialize().
virtual BOOL MQStationPlugin::Activate(MQDocument doc, BOOL flag);
This method is called to changed the activation state when the menu for this plug-in is clicked.
This method is declared as a pure virtual function, and you must implement in an inherited class. Though what to be implemented is not specified, it generally shows or hides a window created by Initialize().
Regardless of the required active-state, it must return the active-state after calling this function.
virtual BOOL MQStationPlugin::IsActivated(MQDocument doc);
It returns whether this plug-in is active.
This method is declared as a pure virtual function, and you must implement in an inherited class.
Though what to be implemented is not specified, it generally returns TRUE when the window managed in the plug-in is displayed, and returns FALSE when it is hidden.
virtual BOOL MQStationPlugin::OnSubCommand(MQDocument doc, int index);
This method is called when a shortcut key assigned to a sub command returned by EnumSubCommand() is pressed.
This method is declared as a virtual function, and nothing is done in the MQStationPlugin. Please implement a procedure for a sub command in an inheriting class.
virtual BOOL MQStationPlugin::OnSwitchSubCommand(MQDocument doc);
This method is called when a shortcut key assigned to this command is pressed continuously.
This method is declared as a virtual function, and nothing is done in the MQStationPlugin. Please implement a procedure for a sub command in an inheriting class.
It is not necessary to switch a sub command actually, and you can define any procedure in this method.
virtual BOOL MQStationPlugin::OnMinimize(MQDocument doc, BOOL flag);
This method is called when a main window of Metasequoia is minimized.
This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.
virtual int MQStationPlugin::OnReceiveUserMessage(MQDocument doc, DWORD src_product, DWORD src_id, const char *description, void *message);
(new in Rev2.41)
This method is called when a message by MQBasePlugin::SendUserMessage() is sent from the other plug-in.
This method is declared as a virtual function, and it does nothing in a default action. You can exchange data between plug-ins by implementing in an inherited class and a sender plug-in if necessary.
virtual void MQStationPlugin::OnDraw(MQDocument doc, MQScene scene, int width, int height);
This method is called when the drawing a scene.
This method is declared as a virtual function, and it does nothing in a default action. You can draw your own plug-in object in the scene by implementing in the inherited class if necessary.
An object or a material used only while a drawing can be created by CreateDrawingObject() or CreateDrawingMaterial().
virtual void MQStationPlugin::OnNewDocument(MQDocument doc, const char *filename, NEW_DOCUMENT_PARAM& param);
This method is called when a document is initialized.
filename is set only when a MQO file has been loaded, and it is NULL when other format file has been imported.
If a XML element has been registered through OnSaveDocument() when saving a file, the XML element will be set in param.elem.
This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.
struct NEW_DOCUMENT_PARAM { MQXmlElement elem; };
|
virtual void MQStationPlugin::OnEndDocument(MQDocument doc);
This method is called when a document exits.
This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.
When a drawing object or a material created by CreateDrawingObject() or CreateDrawingMaterial() which instant is FALSE remains, please delete it by DeleteDrawingObject() or DeleteDrawingMaterial() in this function.
virtual void MQStationPlugin::OnSaveDocument(MQDocument doc, const char *filename, SAVE_DOCUMENT_PARAM& param);
This method is called just before saving a document to a MQO file.
A XML element is set in param.elem, and plug-in own data can be saved together with a .MQO file by registering the child element. The XML element is saved in an external XML file, and it is linked from a MQO file.
This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.
struct SAVE_DOCUMENT_PARAM { MQXmlElement elem; BOOL bSaveUniqueID; int PastState; };
|
virtual void MQStationPlugin::OnSavePastDocument(MQDocument doc, const char *filename, SAVE_DOCUMENT_PARAM& param);
(new in Rev4.60)
This method is called just before saving past state documents to a MQO file, for example crash.
Plug-in own data can be saved as OnSaveDocument(), normally, corresponding param.PastState data be saved.
For saving other than, this method is called with param.elem is nullptr, to Check whether to save an unique id. in this case, param.bSaveUniqueID can be changed if necessary.。
This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.
virtual BOOL MQStationPlugin::OnUndo(MQDocument doc, int undo_state);
This method is called when an undo is operated.
This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.
In current version, a plug-in own undo operation is not allowed. You can refer data in the document and do with plug-in own data managed. But, do not do with data in the document. Return FALSE always. A return value is reserved for a future version.
virtual BOOL MQStationPlugin::OnRedo(MQDocument doc, int redo_state);
This method is called when a redo is operated.
This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.
In current version, a plug-in own redo operation is not allowed. You can refer data in the document and do with plug-in own data managed. But, do not do with data in the document. Return FALSE always. A return value is reserved for a future version.
virtual void MQStationPlugin::OnUpdateUndo(MQDocument doc, int undo_state, int undo_size);
This method is called when an undo state has been updated.
Do not modify objects moreover in this function.
virtual void MQStationPlugin::OnObjectModified(MQDocument doc);
This method is called when an object is modified.
Do not modify objects moreover in this function.
virtual void MQStationPlugin::OnObjectSelected(MQDocument doc);
This method is called when vertices, lines, faces or UV vertices in objects are selected.
Do not modify objects or the selection moreover in this function.
virtual void MQStationPlugin::OnUpdateObjectList(MQDocument doc);
This method is called when a current object is changed, or an object is added or deleted.
Do not modify objects or the selection moreover in this function.
virtual void MQStationPlugin::OnMaterialModified(MQDocument doc);
This method is called when a parameter in a material is changed.
Do not modify objects or materials moreover in this function.
virtual void MQStationPlugin::OnUpdateMaterialList(MQDocument doc);
This method is called when a current material is changed, or a material is added or deleted.
Do not modify materials moreover in this function.
virtual void MQStationPlugin::OnUpdateScene(MQDocument doc, MQScene scene);
This method is called when a scene information is changed such as a direction of a camera or a zoom rate.
Do not modify the scene moreover in this function.
virtual void MQStationPlugin::OnChangeEditOption(MQDocument doc, EDITOPTION_TYPE trigger);
(new in Rev4.40)
This method is called when an edit option is changed.
virtual void MQStationPlugin::OnConfigurationChanged(MQDocument doc);
(new in Rev4.64)
This method is called when configuration is changed.
virtual bool MQStationPlugin::OnQueryInterpolate(MQDocument doc, MQObject dstobj, MQObject srcobj, INTERPOLATE_TYPE type, INTERPOLATE_REASON reason);
(new in Rev4.72)
Called to check whether or not an interpolation of the plugin's unique attribute value is necessary when the attribute value of the vertex or apex is interpolated.
Please return true only when an interpolation is necessary. OnInterpolateVertexData() and OnInterpolateApexData() will be not called when false is returned.
Depending on the reason for interpolation, dstobj and srcobj may be the same object.
virtual bool MQStationPlugin::OnInterpolateVertexData(MQDocument doc, MQObject obj, int vert, INTERPOLATE_VERTEX_PARAM *valarray, int valnum);
(new in Rev4.72)
Called when the it is necessary to interpolate the plugin's own vertex attribute values. Please implement your own interpolation of attribute values.
virtual bool MQStationPlugin::OnInterpolateApexData(MQDocument doc, MQObject obj, int face, int apex, INTERPOLATE_APEX_PARAM *valarray, int valnum);
(new in Rev4.72)
Called when the it is necessary to interpolate the plugin's own apex attribute values. Please implement your own interpolation of attribute values.
virtual bool MQStationPlugin::OnUseClipboard(MQDocument doc, MQObject obj, CLIPBOARD_METHOD method, CLIPBOARD_PARAM& param);
(new in Rev4.72)
Called when a copy / paste operation using the clipboard is performed. Please return true if it is necessary to store or retrieve the plug-in's own content.
When the method is CLIPBOARD_QUERY_COPY, please return true or false base on SelectedVertexCount, SelectedLineCount or SelectedFaceCount in param or plugin's own selection status.
When the method is CLIPBOARD_COPY, it is necessary to call param.AllocBuffer() and store plugin's own content to the returned buffer. obj has a result of merging selected faces, and you can know which vertex or face is corresponding with the original one by MakeOrgVertexIDTable(), MakeOrgFaceIDTable(), MakeOrgVertexIDToNewIndexMap() or MakeOrgFaceIDToNewIndexMap() in param.
When the method is CLIPBOARD_PASTE, please implement plugin's own paste operation by reading from Buffer and BufferSize in param. obj is a new object created by the paste operation.
void MQStationPlugin::WindowClose();
If you call this method when the window managed by this plug-in is closed, it will be notified to the main part of Metasequoia and the check on a menu will become off.
void MQStationPlugin::BeginCallback(void *option);
Call this function when you want to process the response for Windows messages in a plug-in. After an initialization, ExecuteCallback() will be called and you can do with a process for a MQDocument in the function.
virtual bool MQStationPlugin::ExecuteCallback(MQDocument doc, void *option);
A callback procedure called by BeginCallback() is implemented in this function.
This method is declared as a pure virtual function, and you must implement in an inherited class.
MQObject MQStationPlugin::CreateDrawingObject(MQDocument doc, DRAW_OBJECT_VIISIBILITY visibility, BOOL instant=TRUE);
It adds a drawing object while OnDraw() is called.
The created object must not be deleted by MQObject::DeleteThis() or MQDocument::DeleteObject().
The object created with specifying TRUE for 'instant' will be deleted automatically after drawing is completed. The object created with specifying FALSE for 'instant' must be deleted by DeleteDrawingObject() when is becomes unnecessary or OnEndDocument() is called.
MQObject MQStationPlugin::CreateDrawingObjectByClone(MQDocument doc, MQObject clone_source, DRAW_OBJECT_VISIBILITY visibility, BOOL instant=TRUE);
It adds a drawing object by cloning a source object while OnDraw() is called.
The created object must not be deleted by MQObject::DeleteThis() or MQDocument::DeleteObject().
The object created with specifying TRUE for 'instant' will be deleted automatically after drawing is completed. The object created with specifying FALSE for 'instant' must be deleted by DeleteDrawingObject() when is becomes unnecessary or OnEndDocument() is called.
MQMaterial MQStationPlugin::CreateDrawingMaterial(MQDocument doc, int& index, BOOL instant=TRUE);
It add a material for a drawing object created by CreateDrawingObject() while OnDraw() is called.
The index stored in the 'index' variable is available for MQObject::SetFaceMaterial().
The created material must not be deleted by MQMaterial::DeleteThis().
The material created with specifying TRUE for 'instant' will be deleted automatically when drawing is completed. The material created with specifying FALSE for 'instant' must be deleted by DeleteDrawingMaterial() when it becomes unnecessary or OnEndDocument() is called.
MQDrawingText MQStationPlugin::CreateDrawingText(MQDocument doc, const wchar_t *text, DRAWING_TEXT_PARAM& param, BOOL instant=TRUE);
(new in Rev4.50)
It adds a drawing text while OnDraw() is called.
The text created with specifying TRUE for 'instant' will be deleted automatically after drawing is completed. The object created with specifying FALSE for 'instant' must be deleted by DeleteDrawingText() when is becomes unnecessary or OnEndDocument() is called.
struct DRAWING_TEXT_PARAM { MQPoint ScreenPos; MQColor Color; float FontScale; DRAWING_TEXT_ALIGNMENT HorzAlign; DRAWING_TEXT_ALIGNMENT VertAlign; };
|
void MQStationPlugin::DeleteDrawingObject(MQDocument doc, MQObject obj);
It deletes a object created by CreateDrawingObject() which the 'instant' is FALSE.
void MQStationPlugin::DeleteDrawingMaterial(MQDocument doc, MQMaterial mat);
It deletes a material created by CreateDrawingMaterial() which the 'instant' is FALSE.
void MQStationPlugin::DeleteDrawingText(MQDocument doc, MQDrawingText text);
(new in Rev4.50)
It deletes a text created by CreateDrawingText() which the 'instant' is FALSE.
int MQStationPlugin::GetCurrentUndoState(MQDocument doc);
bool GetCurrentUndoState(MQDocument doc, UNDO_STATE& undo_state)
It gets a counter of an undo state.
(new in Rev4.59)
struct UNDO_STATE { int state; bool can_undo; bool can_redo; };
|
bool MQStationPlugin::ExecuteUndo(MQDocument doc);
(new in Rev4.59)
It executes an undo operation.
bool MQStationPlugin::ExecuteRedo(MQDocument doc);
(new in Rev4.59)
It executes an redo operation.
bool MQStationPlugin::ClearUndoBuffer(MQDocument doc);
(new in Rev4.59)
It clears an undo buffer.
[deprecated]
MQPoint MQStationPlugin::GetSnappedPos(MQScene scene, const MQPoint& p, SNAP_GRID_TYPE type);
(new in Rev4.20)
MQPoint MQStationPlugin::GetSnappedPos(MQScene scene, const MQPoint& p, const EDIT_OPTION& option, const GET_SNAP_PARAM& snap_param);
It gets a snapped position for a grid, a plane, vertices, lines, faces and so on specified in the edit option.
'eye_dir' is usually specified TRUE when a vertices is operated directly or a center of a handle is operated. It is FALSE when a X, Y or Z axis of a handle is operated.
Please change the contents of the edit option if you want to snap to elements that are not specified in the current edit option.
Attention: The deprecated format is still left, but please replace it with the new format to enable to snap elements except a grid.
struct GET_SNAP_PARAM {
BOOL SnapEyeDir; // Snap on the eye direction
BOOL IgnoreSelected; // Ignore selected elements
BOOL IgnoreCurObj; // Ignore current object
};
|