-
Notifications
You must be signed in to change notification settings - Fork 6
Writing Plugin Handlers
When writing a plugin processor, there are some required variables and functions that need to be included in order for the processor to able to function.
You can copy pluginprocessors > _template.py for a template for plugin processors.
This is the list of plugins that the processor can handle. For example, if my processor could handle events for the plugin Soundgoodizer, I would write PLUGINS = ["Soundgoodizer"]. You can include as many plugins as you like in this list.
If you need to determine between different plugins, you can use internal.window.active_plugin. For example:
if internal.window.active_plugin == "Soundgoodizer":
# Do soundgoodizer stuff
pass
elif internal.window.active_plugin == "Sausage Fattener":
# Do sausage fattener stuff
passThis function processes events when a plugin in the PLUGINS list is active. It receives a ParsedEvent as a parameter. You should do all of your processing of events in this function, or in subfunctions called by it.
This function is called to redraw lights when a plugin in the PLUGINS list is active. It receives a LightMap as a parameter. You should do all your redrawing in this function, or in subfunctions called by it.
This function is called when a plugin in the PLUGINS list becomes the top-most plugin. Use it to set things such as extended modes, or to set internal variables used by your script.
This function is called when a plugin in the PLUGINS list stops being the top-most plugin. Use it to do things such as revert extended modes, or to reset internal variables used by your script.
This function is called when a plugin in the PLUGINS list becomes the top-most window (including FL Studio windows). This implies (but doesn't guarantee) that the plugin's configuration window is open.
This function is called when a plugin in the PLUGINS list stops being the top-most window (including FL Studio windows).
To add your plugin processor to the script, open pluginprocessors > processplugins.py and add the name of your file (without the .py) to the imports list. Make sure the file is located within the pluginprocessors directory.