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
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.)
Does this sound useful? Should we also include a method so you can tell us if you've updated their plugin to a newer version? For example, something like -setPluginVersion:(int)version, or something like that? Is there anything we aren't thinking of here that you'd need or any problems you see with this?
Thanks, |