Publish dialog popup

Hey all! Any help here would be great. Looking to add a popup dialog to a publish hook I have made in maya. I could use the maya commands to do this however in the case of publishing outside of maya that might breakdown and using the shotgun ui api would probably be a safer bet. How would I go about doing this?
The overall idea is this. I have a publish hook that publishes fbx files to be checked into perforce. Depending on project global settings the user is presented with a dialog for checking the fbx into any number of different development branches in perforce. So I need a dialog at fbx publish time that presents the user with all the development branch check in options. Also I would need the option to apply these user defined settings to all subsequent publishes in the case of publishing multiple files. I have all the info for checking everything into perforce and all the options for dev branches in place, at this point I just need to set up the dialog window. Hope that makes sense. Thanks for the help!

3 Likes

Hi Joesph

Shotgun doesn’t have a UI API as such, it uses PySide (QT) to produce it’s GUIs.
I would recommend checking out PySide examples/tutorials for info on that aspect.

You can create a popup QT widget from within your hook, that should be no problem. However, with the Publish app, there is also the ability to embed a custom QT widget into the right-hand side panel when you select the plugin.

There are three methods on a plugin that need to be overridden in order to implement the custom UI.

create_settings_widget() - Where you define and pass back your widget.

get_ui_settings() - Where you need to implement the behaviour to extract settings from your UI so that they can be used in the publish method.

set_ui_settings() - Where you set your UI’s state based upon the passed settings.

The get and set methods work together, in that when the item/plugin tree selection changes, the get will be called on your plugin to extract the values. When you select your plugin again it will call the set method pass the settings you set previously so you can populate the UI again with the same settings.

7 Likes

Philip thank you so much! Actually that answered another question I had about custom guis. And the custom embedding should work perfectly!

2 Likes

Hey Philip just wanted to let you know this worked like a charm both for gui writing (I am quite familiar with pyside so no issues there) and for the publish options so thank you once again!

5 Likes