MQImportPlugin class

(new in Rev2.40)

MQImportPlugin class inherits MQBasePlugin class, and provides functions necessary for an implementation of an import plug-in.

You can make a import 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 MQImportPlugin class and implementing required virtual functions.

In MQImportPlugin 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
MQImportPlugin Constructor
~MQImportPlugin Destructor
Declared in super class
GetPlugInID Get a plug-in ID
GetPlugInName Get a plug-in name
Plug-in
GetPlugInType Get a plug-in type
EnumFileType Enumerate file types
EnumFileExt Enumerate file extensions
ImportFile Load a file
SupportBackground Whether to support a background loading
Message procedure
IsBackground A message for activating or deactivation a window
GetImportOptions A message for checking an activated state of a plug-in
IsCanceled A message for minimizing a window
SetProgress A message for receiving a plug-in own message
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

MQImportPlugin::MQImportPlugin();

This method is a constructor.


virtual MQImportPlugin::~MQImportPlugin();

This method is a destructor. It is defined as a virtual function.


virtual int MQImportPlugin::GetPlugInType();

Return value
A plug-in type
[MQPLUGIN_TYPE_IMPORT] Import plug-in

This method implements a virtual function declared by MQBasePlugin::GetPlugInType(). No additional implementation is necessary in an inherited class.


virtual const char *MQImportPlugin::EnumFileType(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.

This method implements a virtual function declared by MQEnumFileType(). No additional implementation is necessary in an inherited class.


virtual const char *MQImportPlugin::EnumFileExt(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.

This method implements a virtual function declared by MQEnumFileExt(). No additional implementation is necessary in an inherited class.


virtual BOOL MQImportPlugin::ImportFile(int index, const char *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 to 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 canceled, or an error has been occurred.

This method implements a virtual function declared by MQImportFile(). No additional implementation is necessary in an inherited class.


virtual BOOL MQImportPlugin::SupportBackground(void);

Return value
Whether to support a background loading
[TRUE] Support
[FALSE] Not support

(new in Rev4.20)

It returns whether to support a background loading or not.

It is necessary to check if the loading is a background process by IsBackground() and to cancel the process by calling IsCanceled() periodically when a background loading is supported.

This method is declared as a virtual function, and it is implemented in an inherited class. If it is not implemented in the inherited class, it returns FALSE by an implementation in a super class.


BOOL MQImportPlugin::IsBackground(void);

Return value
Whether the loading is background or foreground
[TRUE] A background loading in a sub thread
[FALSE] A foreground loading in a main thread

(new in Rev4.20)

It returns whether the loading is background or foreground.

A background loading is processed in a sub thread. It is necessary to support a canceling, not to call GUI procedures; like as showing a dialog, changing a cursor and so on; and to support a multi-threading without global variables.

MQWidget does not a multi-threading and it will occur an error by using in a sub thread. MQ_ShowFileDialog() can support a background process by setting appropriate variables.


void *MQImportPlugin::GetImportOptions(void);

Return value
Import options

(new in Rev4.20)

It returns import options for 'option_args' in variables of MQ_ShowFileDialog().


BOOL MQImportPlugin::IsCanceled(void);

Return value
Whether the loading is canceled or not
[TRUE] Canceled
[FALSE] Not canceled

(new in Rev4.20)

It returns whether the loading is canceled or not during processing.

Please call this member periodically when a background loading is processed. A response for a user will get worse if the interval is long, and a process will be slower by too much call. Please call in a reasonable interval.

It always returns FALSE when the loading is not background.


void MQImportPlugin::SetProgress(float progress);

progress
A progressive status (from 0 to 1)

(new in Rev4.20)

It specifies a current progressive status.

Please call this member periodically when a background loading is processed.