Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Writing Plugin Handlers

HDSQ edited this page Jan 24, 2021 · 2 revisions

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.

Script requirements

PLUGINS

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.

Getting the active plugin name

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
    pass

process()

This 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.

redraw()

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.

topPluginStart()

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.

topPluginEnd()

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.

activeStart()

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.

activeEnd()

This function is called when a plugin in the PLUGINS list stops being the top-most window (including FL Studio windows).

Adding your processor to the script

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.

Clone this wiki locally