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.
- Open the Pipeline Panel.
- Add a new Pipeline Variable and name it BlenderVersions in the dialog that appears.
- Choose 'stringlist' for the type.
- 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.
- Here we access our Pipeline Variable to give us a list of supported Blender versions.
- We add the Blender versions to the version selector combo.
- 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.
- Here we get the selected jobs from the Qube! UI as a list of Job objects.
- We build the path to Blender using the currently selected blender version.
- We use the job object to access the job's package and pull out the Blender scene file.
- 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.