PluginTools: Register you plugin in asPluginManager

AfterShot Pro Plugins
Post Reply
andreas
Posts: 154
Joined: Thu Jan 12, 2012 1:53 pm
operating_system: Linux
System_Drive: X
32bit or 64bit: 64 Bit
motherboard: Asus in Workstation and Dell XPS Notebook
processor: i7-980 and i7-2720QM
ram: 12GB - 8GB
Video Card: ATI FireGL
sound_card: on board
Hard_Drive_Capacity: 4.5TB Rd10
Monitor/Display Make & Model: Samsung Syncmaster 2343sw
Location: DE - Wermelskirchen
Contact:

PluginTools: Register you plugin in asPluginManager

Post by andreas »

Hi,

for asPluginManager I developed a method for other plugins to provide info about themselves. It is quite easy. You can download the needed files ToolData.h and ToolData.cpp here:
http://schrell.de/cgi-bin/gitweb.cgi?p=PluginTools.git
or with git directly:

Code: Select all

git clone http://schrell.de/PluginTools.git
Given you are developing plugin MyPlugin and have it in a folder PluginBase/MyPlugin, then you can set it up directories like this:

Code: Select all

PluginBase/
PluginBase/SDK
PluginBase/PluginTools
PluginBase/PluginDefaults   (optional if you want to use it, it makes project files life easier)
PluginBase/MyPlugin
In your MyPlugin.pro file include:

Code: Select all

# ToolData support:
DEPENDPATH += ../PluginTools
INCLUDEPATH += ../PluginTools
HEADERS += ToolData.h
SOURCES += ToolData.cpp
Next edit your plugin code and include in your createDependency:

Code: Select all

PluginDependency *MyPlugin::createDependency(const QString &depName)
{

    if (depName == "ToolData") {
        ToolData *toolData = new ToolData();
        if (toolData) {
            toolData->owner = name();
            toolData->group = group();
            toolData->ownerId = m_id;
            toolData->groupId = m_groupId;
            toolData->addEnabledId(m_hub->optionIdForName("myPluginOn",m_id)); // simple case one option
            toolData->addEnabledId(m_hub->optionIdForName("myPluginOn2",m_id), "E2", "Enable option 2", "This is the hint for E2"); // give names for more than one option
            return toolData;
        }
    }

    return NULL;
}
The option name myPluginOn is the name of your enabled option. You can add more options here if there are several enable options in your plugin. As a plugin dev you should know how the other fields are filled. There may be other PluginData srevices served by this method. Add if-blocks for other depNames before the return NULL. The asPluginManager uses the short name as text and longname as tool tip.

How does this talk to asPluginManager? The asPluginManager looks for the plugin directories. Every directory name is looked u p in its config file for the corresponding plugin identifier. On the first hotnessChange it receives (this is the first possible step for this to do), it calls startPluginData() to get the ToolData from you. If you implemented it like shown above, asPM will get the info of your numeric id and you enabled option ids asynchronously (after this hotnessChange). On every following hotnessChange/settingsChange asPM will ask ASP for your enabled options and show their state in the asPM toolbox.

Thats it for the moment. I hope I did not forget something. I will release a new asPluginManager today which can be used for testing.

Further plans:

- Checkboxes in asPluginManager to have a central place to enable/disable registered plugins

Andreas
Last edited by andreas on Tue Jul 10, 2012 6:50 am, edited 4 times in total.
Linux - not Windows
andreas
Posts: 154
Joined: Thu Jan 12, 2012 1:53 pm
operating_system: Linux
System_Drive: X
32bit or 64bit: 64 Bit
motherboard: Asus in Workstation and Dell XPS Notebook
processor: i7-980 and i7-2720QM
ram: 12GB - 8GB
Video Card: ATI FireGL
sound_card: on board
Hard_Drive_Capacity: 4.5TB Rd10
Monitor/Display Make & Model: Samsung Syncmaster 2343sw
Location: DE - Wermelskirchen
Contact:

Re: PluginTools: Register you plugin in asPluginManager

Post by andreas »

PS:

asPGS and asPluginManager both do not have enabledOptions which are connected to image settings. Their options are only global settings. So they provide a ToolData structure but do not add any optionIds.

Andreas
Linux - not Windows
andreas
Posts: 154
Joined: Thu Jan 12, 2012 1:53 pm
operating_system: Linux
System_Drive: X
32bit or 64bit: 64 Bit
motherboard: Asus in Workstation and Dell XPS Notebook
processor: i7-980 and i7-2720QM
ram: 12GB - 8GB
Video Card: ATI FireGL
sound_card: on board
Hard_Drive_Capacity: 4.5TB Rd10
Monitor/Display Make & Model: Samsung Syncmaster 2343sw
Location: DE - Wermelskirchen
Contact:

Re: PluginTools: Register you plugin in asPluginManager

Post by andreas »

Hi,

thanks to an idea of spoilerhead it is now possible to tag the enabledIds with

- short name
- long name
- hint (tooltip)

All three are optional but the short name should be mandatory if you have more than one enabled button in your plugin. These info will be used in asPM to show enabled infos.

ToolData are now version 2. The constructor can migrate from v1 to v2.

Tooldata v2 does not have the hub in the constructor anymore.

Andreas
Linux - not Windows
Post Reply