Pixyz Studio features a Plugin Editor, which makes it easy to create, edit and manage plugins.


From the Plugin Editor panel, a user can easily create a new blank plugin, understand and manage all the files and dependencies of a plugin.

Actions like adding a function, a parameter/type or a module dependency to a plugin, are available using direct commands, and do not require coding them directly in the plugin's files.

In that regard, using the Plugin Editor should be the preferred way for beginners wishing to start developing a plugin. 


IMPORTANT        The Plugin Editor is not an IDE, and is not meant for advanced plugin editing. The best practice when building complex plugins is to load your plugins files from their folder location inside your preferred IDE, edit and save them. Then reload and run them in Studio for testing. And finally publish them to be deployed in Pixyz Scenario Processor. 
If you do not mean to use Studio at all but only use your IDE, for plugin editing, and Pixyz Scenario Processor to run them, a standalone Windows executable is available to publish a plugin as a .pxzext file (more information here).


Opening the Plugin Editor

By default the Plugin Editor panel is not displayed in the User Interface.


WARNING        The Plugin Editor panel is different from the Scripting Editor.The Plugin Editor does include its own scripting window though!


To display it, 2 possibilities:


The panel is placed on top of the UI, but you can dock it wherever you see fit:



Creating a New plugin

See Creating a Plugin.


Editing a plugin with the Plugin Editor

To start editing a plugin, 2 possibilities:

  • From the Manage Plugins window, select the plugin you wish to edit, and click the "Edit" button. This opens the Plugin Editor and makes the plugin you picked the Active plugin.
  • Open the Plugin Editor and use the drop-down list to select the Active plugin to edit


Once a plugin is active, simply go to the Plugin tree to go through its files. Select a file to load in the scripting area in the center of the window, in order to edit it.


WARNING        When editing or copy-pasting Python scripts, make sure to be consistent in how you indent the code: use either double spaces (..) or tab (→), but do not mix them. We advise you to show non-printable characters by clicking on the corresponding icon from the scripting editor top bar


Reloading a plugin

A modified plugin needs to be reloaded in Pixyz Studio in order to be fully updated and run.

To do so, 2 possibilities:


A few important points about plugin reloading:

  • When using the "Reload Plugins" action, all plugins installed in the computer are reloaded, which can take some time and freeze the interface if a lot of plugins are installed
  • Files composing a plugin can be edited outside of Pixyz (but their locations need to remain the same). If a file was edited outside Pixyz Studio, use the "Reload Plugins" action to update the plugin in the current Pixyz Studio session
  • When Pixyz Studio is launched, all plugins are reloaded at the software initialization stage
  • When plugins are reloaded, the Output panel logs the reloading status for each plugin installed, and potential errors detected in a plugin


Saving changes

Every time a Python script or XML file is changed, it can be saved from the Editing window of the Plugin Editor by clicking the "Save" button. Anyway reloading a plugin automatically saves all the files used by the plugin.


Adding a parameter/type

To add a parameter to a function, 2 possibilities:

  • Directly edit the XML file (advanced users)

WARNING        When editing the XML file, a warning is issued, reminding that improper editing may cause the plugin to behave incorrectly!



Typical error: if you add a new type from a new module directly in the XML file, without also adding a dependency to this module, then the plugin will not load anymore! You will need to fix it outside Studio before reloading it again.


  • From the Plugin tree, right-click the function for which you wish to add a parameter. A panel is displayed to set the parameter name and type. Choose a type in the list of  available types:

    

TIP 1        To know all the parameter types existing in Pixyz Python API, check out the API Reference ("Types" section)

        

TIP 2        To add a default value to a parameter, modify the XML file by adding a "default" tag and the desired value. Example:

    



Creating dependencies

In order to avoid runtime or deployment errors later when using a plugin, it is necessary to link the correct dependencies.

When using a function or a parameter of a specific type, from a specific Pixyz module ("IO", "Algo", "Scene",...), it is always best to add a dependency to this module. 

When adding a new function, the dependency to its module is not automatically added. It is best to add, by right-clicking the "Dependencies" folder in the Plugin Tree, and choosing "Add Dependency to 'MyPlugin'":



When adding a new parameter with the "Add Parameter to 'MyFunction'" action in the Plugin Editor, the dependency to its Pixyz module is added automatically.

When adding a new parameter directly in the script and XML files, the dependency to its Pixyz module is not added, and should be added before reloading the plugin to avoid errors.


NOTE                A quick way to add all Pixyz dependencies at once is to use the command from pxz import * at the beginning of your script, although it is not recommended


Running/executing a plugin in Pixyz Studio

See Running a Plugin


Publishing a plugin

See Publishing a Plugin


How-to video

The video below shows how you can transform an existing Data Preparation script, into a Scenario plugin that applies the same Data Preparation recipe to multiple files using Pixyz Scenario Processor batching capabilities (once published).