• No results found

Updating a 1.0 Action Plugin to the 2.0 SDK

In document Indigo Rose Plugin SDK_2.0 (Page 51-56)

Updating your Action plugin to version 2.0 of the Plugin SDK requires four major steps:

1. Moving from Lua 5.0 to Lua 5.1

2. Using the new plugin helper files and exporting the irPlg_GetSDKVersion function

3. Renaming the irPlg_IsValidLicense function to irPlg_ValidateLicense 4. Rebuilding your project

The following section outlines these steps assuming that your plu gin was written in C++

and compiled using Visual Studio.

Moving from Lua 5.0 to Lua 5.1

The steps required to move from lua 5.0 to lua 5.1 are as follows:

1. Remove the existing lua.h, lualib.h, lauxlib.h from your project.

2. Remove lua.lib and luaD.lib files from your project.

3. Add the Plugin SDK 2.0 include and lib directories to your Visual C++

directories. In Visual Studio 6.0 this can be done on the Directories tab of the Options dialog (Tools | Options from the main menu). In Visual Studio 2008 this is done by selection VC++ Directories under the Project and Solutions node of the Options dialog. Now select “Include files” in the “Show directories for” combo  box and add the path to the include directory where you installed the plugin SDK,

something like: “C:\Program Files (x86)\Indigo Rose Plugin SDK 2.0\include”

 Next select “Library Files” in the “Show directories for” combo box and add the  path to the lib directory where you installed the plugin SDK, something similar to:

“C:\Program Files (x86)\Indigo Rose Plugin SDK 2.0\lib”

4. In the header file (e.g. StdAfx.h) where you previously included the lua *.h files replace the old includes with the new include:

Old Code:

extern "C" {

#include "lua.h"

#include "lualib.h"

#include "lauxlib.h"

}

 New Code:

#include "lua.hpp"

5. Make sure that the old lua library files are no longer linked to your project, and make sure that the new lua library file (lua5.1.lib) is linked to your project.

In Visual Studio 6.0 this is done on the Link tab of the Project Settings dialog. In Visual Studio 2008 this is done via the Projects property pages, under

Configuration Properties | Linker | Input. In all available configurations remove the old lua libraries and add lua5.1.lib:

Becomes:

In Visual Studio 2008 the results should be similar to the following:

6. Congratulations, your plugin now uses Lua 5.1!

Including the new PluginHelper files

Version 2.0 of the Indigo Rose Plugin SDK comes with new versions of the

IRPluginHelper.cpp and IRPluginHelper.h files that you will want to use instead of the version 1.0 files. There are two ways that you can do this, the first is to use the method that version 1.0 of the SDK used, which is to add both files directly to your project, the second is to use one of the IRPluginHelperFunctions*.lib files provided with the SDK.

Adding the helper files to your project:

If the two helper files were already included in your 1.0 based plugin you can simply copy the files from the Plugin SDK’s src directory to your project’s source directory, replacing the 1.0 files. If they were not in your 1.0 project and you still want to use this method you will need to copy the files over as explained above, add them to your project, and then include the IRPluginHelper.h file when you want to use it.

Using the IRPluginHelperFunctions*.lib files

If you want to use the IRPluginHelperFunctions*.lib files then you will need to ensure that the SDK’s include and lib files have been added to your directories as directed above in the converting to Lua 5.1 section. Next you need to remove IRPluginHelper.cpp and IRPluginHelper.h from your project if they exist and add the following to your stdafx.h:

#define USE_PLUGIN_LIB

You should take care to ensure that USE_PLUGIN_LIB is defined before

IRPluginHelperFunctions.h is included in your project. Defining USE_P LUGIN_LIB first will tell IRPluginHelperFunctions.h to add the correct IRPluginHelperFunctions*.lib file to your project.

Of course you do not need to use USE_PLUGIN_LIB and you can manually add the correct lib files to your project. If the correct lib file does no t exist for the version of Visual Studio, or the compiler that you are using, you will have to add the helper files directly to your project as explained above.

Exporting the New irPlg_GetSDKVersion Function

Once the 2.0 helper files have been added to your project you need to export the irPlg_GetSDKVersion function from your DLL. To do this, a dd the following line to your *.def file:

irPlg_GetSDKVersion

Renaming irPlg_IsValidLicense

Version 2.0 of the Indigo Rose Plugin SDK uses a different function in order to v alidate your license, therefore in order for your plugin to be recognized you need to rename your old irPlg_IsValidLicense function to irPlg_ValidateLicense. The function needs to be renamed internally and where the function is exported.

For example in the IRClipboard project the changes need to be made in two locations.

First in IRClipboard.cpp file changing the line:

bool irPlg_IsValidLicense(char* lpszLicenseInfo)

to:

bool irPlg_ValidateLicense(char* lpszLicenseInfo)

Finally the change needs to be made in the IRClipboard.def file where the function is exported changing the line:

irPlg_IsValidLicense

to

irPlg_ValidateLicense

Rebuild your Project

 Now that your plugin has been updated you need to rebuild your project and regenerate your *.lmd file. After this has been done you should be able to move your new *.lmd file into its Plugins\Actions\ directory and have it available the nex t time AutoPlay Media Studio starts.

In document Indigo Rose Plugin SDK_2.0 (Page 51-56)

Related documents