We have a proposal for a plugin versioning API for FxPlug. This would allow plugins to know which version of their plugin was used to create an instance. For example, if the user created a document and applied WhizBangFilter version 1, we would save that "Version 1" information in the project file. If they then upgrade to WhizBangFilter version 2 and opened up the old project, we would tell the WhizBangFilter that this particular instance was created with version 1 of the filter. That would give the filter the option of:
1) Only displaying those parameters that existed in version 1 and rendering as if it were version 1
2) Appending new parameters, but with default values that didn't change the output and rendering as version 2
3) Adding a popup menu item for the user to choose which version they want the plugin to act like
4) Any other crazy thing you might want to do with version information
This is a great idea. I like that feature and it is quite useful too.
Just the addParameters code snippet should look a little different. In you example only someone with a newer version of FxPlug SDK would be able to see the new features of the plugin. (Yes, I know. It was just a quick example from you.)
I have an initial implementation that I'm testing with. It currently contains a single API method:
- (int)versionAtCreation;
In this scenario, you'd add a property to the dictionary returned by your plugin's -properties; method that contained the version. So it might look like this:
- (NSDictionary*)properties
{
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], kFxPropertyKey_PixelIndependent,
[NSNumber numberWithBool:NO], kFxPropertyKey_MayRemapTime,
[NSNumber numberWithInt:<your version number here>], kFxPropertyKey_PluginVersion,
nil];
}
Then in your -addParameters method, you could do something like this:
-(BOOL) addParameters
{
id parmsApi;
parmsApi =[_apiManager apiForProtocol:@protocol (FxParameterCreationAPI)];
if (NULL != parmsApi)
{
[parmsApi addFloatSliderWithName:@"Whizziness"
parmId: kWhizzinessID
defaultValue: 2.0
parameterMin: 0.0
parameterMax: 32.0
sliderMin: 0.0
sliderMax: 32.0
delta: 1.0
parmFlags: kFxParameterFlag_DEFAULT];
id versAPI = [_apiManager apiForProtocol:@protocol (FxVersioningAPI)];
if (versAPI != nil)
{
int version = [versAPI versionAtCreation];
if (version > 1)
{
[parmsApi addToggleButtonWithName:@"Cool new version 2 toggle"
parmId:kSuperDuperToggleButtonID
defaultValue:1
parmFlags:kFxParameterFlag_DEFAULT];
}
}
}
return true;
}
You could also access it during render, if you want to preserve older rendering functionality. (I've tried to make it so you can access it during any method.)
You know that Motion and FCP behaves strange when you try to retrieve a parameter that does not exit. So it is most important to be able to ask for the version during render to avoid crashes.