We can create a project template to generate an empty Metasequoia plugin project with most of the project properties already set.
Once we have created the project template we can select it from the list of templates in the File>Add>New Project dialog.
This means we won’t have to set all the project’s properties manually every time we create a new plugin.
Rather than create one template for all plugin categories as I do here you could make a separate template for each plugin category.
First we need to make a new plugin project that has all the settings we wish to save in the template.
With the mqsdk solution open in Visual Studio and selected in the Solution Explorer window add a new Visual C++ Win32 project.
I used spaces in the project name here but it is better if you do not have spaces in the name. The space caused an error for the Post-Build Event command.
Choose DLL and Empty project in Application Settings.
Set the project’s properties in the Property Pages the same as in previous posts.
Remember to click OK or Apply to save the changes.
Use the Using Visual Studio instructions in the mqsdk_en.html document to create Debug and Release configurations for 64 bit Windows if required.
For All Configurations and All Platforms set Configuration Properties>General>Output Directory to “$(Platform)\$(Configuration)\”.
For All Configurations and All Platforms the Configuration Properties>General>Intermediate Directory to “$(Platform)\$(Configuration)\obj\”.
For All Configurations and All Platforms set Configuration Properties>General>Character Set to “Multi-Byte Character Set”.
For All Configurations and All Platforms set Configuration Properties>C/C++>General > Additional Include Directories to “..” so Visual Studio will search the project’s parent directory for any SDK header files it needs for the project.
For Debug Configuration and All Platforms set Configuration Properties>Debugging> Command to the path to Metaseq.exe.
Unfortunately I found that this setting is not saved in the template and will have to be set for each project created using the template.
For Debug Configuration and All Platforms use Command Prompt commands and Macros to set Configuration Properties>Build Events>Post-Build Event>Command Line to copy the output *.dll to the appropriate folder in Metasequoia\Plugins\.
This project property will need to be changed manually to match each type of plugin we create. If we create a wizard for the template we may be able to set this property from user input.
If creating separate templates for each plugin category the correct folder can be set for each.
Add a new blank *.cpp file to the project and name it “myplugin.cpp”.
Add MQInit.cpp located in the project’s parent directory to the project.
Open myplugin.cpp in the editor and type in the following code which includes all the functions necessary for all categories of plugin.
Replace any information like the author name and Product (author) number to your personal details.
Save all if you haven’t already and click File>Export Template to run the Export Template Wizard.
Select Project Template and select the project in the drop down list.
Name the template, add a description and icon and preview images if you wish.
Uncheck the option to automatically import into Visual Studio but do check the option to open the exported template folder in File Explorer.
Navigate to your custom project template folder which by default is, C:\Users\<username> \Documents\Visual Studio 2013\Templates\ProjectTemplates\.
Create a new folder named “Metasequoia Plugin” inside the Visual C++ Project folder.
Copy the zip file containing the exported project template into the “Metasequoia Plugin” folder you created.
The template now appears in the template list and can be used as a starting point for a new plugin project.
prev | next | first
No comments:
Post a Comment