Qube! UI Panel Plugins

    The Qube! UI allows you to write your own panels, these are known as Panel Plugins. When you first install the Qube! UI there are two example Panel Plugins, a 'Job Properties' plugin that gives you a nicer to look at version of the built-in Job Properties Panel. Also a 'Test Panel' that demonstrates the use of buttons and retrieving selected values from the various Qube! UI lists.

     

    An example

    To create your own Panel Plugin you need to have access to the plugins/panels directory in the Qube! UI installation folder. We're going to create a panel that will open a selected job's Blender file in a specific version of Blender. Note that if you don't have Blender or Blender jobs then don't worry just replace anything to do with Blender with the application you want to open.

    Using the Pipeline Panel we can add system-wide Pipeline Variables. We're going to add one to keep track of the versions of Blender we have installed on the users' workstations, note that these Pipeline Variables are set for everyone, not just you.

    1. Open the Pipeline Panel.
    2. Add a new Pipeline Variable and name it BlenderVersions in the dialog that appears.
    3. Choose 'stringlist' for the type.
    4. Add a couple of version numbers to the list, I have 2.83 and 2.90 installed so I'll add them.

    It's easiest to start with an existing panel plugin so you can make a copy of either of the two built-in examples, but for now just create a new .py python file and enter the following text:

     

    Save the file in the plugins/panels directory where the QubeUI executable sits on your platform. Make sure that you have write access to the file and open (or restart) the Qube! UI. You should see your new Panel Plugin, drag it somewhere sensible. If you're a Pipeline developer you should also see a pencil button in the top right, this allows you to edit the plugin inline.

     

    Click it now and you should be looking at something like this.

     

    Go to line 19, it should be a comment. Replace the comment with the following code.

    1. Here we access our Pipeline Variable to give us a list of supported Blender versions.
    2. We add the Blender versions to the version selector combo.
    3. We connect a slot, we have yet to write, to the openInBlender button's clicked() signal.

     

    Line 14 should be another comment, we'll replace that with the callback method code below.

    1. Here we get the selected jobs from the Qube! UI as a list of Job objects.
    2. We build the path to Blender using the currently selected blender version.
    3. We use the job object to access the job's package and pull out the Blender scene file.
    4. Finally we launch Blender with the scene file as the argument.

     

    If you don't type anything for around 3 seconds your Panel Plugin should look something like this with our label, combo box and button all visible.

    Save the plugin using the save button (the floppy disk button next to the pencil) and close the editor by clicking the pencil button. Select a Blender job in the a job list and click the "Open in Blender" button, if all went well the scene related to that job should open with the chosen version of Blender.

    • No labels