Page 1 of 1

Fusion 8 - is PyQt5 GUI tools possible?

PostPosted: Thu Jun 23, 2016 10:40 pm
by Mike Aquino
Hi all,

In some of my R&D for integrating Fusion 8 into a production pipeline and providing custom tools for comp artist workflow, I have looked into building PyQt GUI dialogs that open from python scripts run from the Fusion 8 "Script" menu.

Is this possible? I looks like Fusion is based on Qt5, so I installed PyQt5 for my Python 2.7 install, and then created this python script to run from the Fusion 8 "Script" menu:

Code: Select all
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class MyDialog(QDialog):

    def __init__(self, parent=None):
        super(MyDialog, self).__init__( parent )
        self.initUI()

    def initUI(self):
        self.setFixedSize(200, 100)
        self.setWindowTitle('My Dialog')
        label = QLabel('Hello')
        layout = QVBoxLayout()
        layout.addWidget(label)
        layout.setAlignment(Qt.AlignCenter)
        self.setLayout(layout)

f8_qapp = QApplication.instance()

f8_wdg_list = f8_qapp.allWidgets()
f8_main_window = None

for f8_wdg in f8_wdg_list:
    if f8_wdg.windowTitle() == "Preferences":
        f8_main_window = f8_wdg.parent()  # "Preferences" widget has a QMainWindow parent

f8_my_dialog = MyDialog( f8_main_window )
f8_my_dialog.show()



... this script runs once with no errors ... but nothing shows up. If you attempt to run it again, Fusion 8 will hang.

Any assistance or insight on this would be really very appreciated ... many thanks!

Re: Fusion 8 - is PyQt5 GUI tools possible?

PostPosted: Mon Jun 27, 2016 2:45 pm
by Mike Aquino
I suspect that this isn't possible. I got used to being able to leverage already existing PySide or PyQt UI code in the pipeline for doing interactive tools within Maya. I was hoping that Fusion 8 would provide a similar ability.

I'm shelving the pursuit of this approach, and I've been diving into using the built-in "composition.AskUser(...)" functionality for user dialogs. It's not ideal solution (as it is very limiting in what you can do and present in UI dialogs), but I think it will be sufficient for getting in-Fusion pipeline tools started.

Re: Fusion 8 - is PyQt5 GUI tools possible?

PostPosted: Mon Jun 27, 2016 9:25 pm
by michael vorberg
i have a PyQt4 script and i'm able to run it once, the second time i start i fusion8 crashes to desktop without any error message. in fusion 7.7 there is no problem

Re: Fusion 8 - is PyQt5 GUI tools possible?

PostPosted: Mon Jun 27, 2016 11:01 pm
by Chris Wells
It's cheap but most times I have two scripts. the one inside fusion launches another script that then runs outside of fusion and talks to fusion from outside. letting it use whatever gui I want.

haven't tried it in 8 but it should still work

Re: Fusion 8 - is PyQt5 GUI tools possible?

PostPosted: Tue Jun 28, 2016 5:24 pm
by michael vorberg
You need fusion studio for external scripting

Re: Fusion 8 - is PyQt5 GUI tools possible?

PostPosted: Mon Jul 04, 2016 10:12 pm
by Mike Aquino
Many thanks for the feedback and insight!

My client has obtained Fusion Studio licenses and I'm now able to communicate with a Fusion instance using external scripting.

So, I'm now taking the approach of doing my own external PyQt GUI and then using the "BlackmagicFusion" module to execute actions in the interactive Fusion instance that is running.

Not as ideal as adding custom PyQt GUI directly in Fusion 8, but it's very workable.

Re: Fusion 8 - is PyQt5 GUI tools possible?

PostPosted: Sat Dec 10, 2016 1:19 am
by Carlos Anguiano
We should request to black magic that provide a working PySide, PySide2 lib...
this wold allow us, read our selfs of Nuke and the cost associated with.

Is BMD receptive to user request? seems this is a pretty basic request that makes a big difference for pipeline integration as far as universal asset management tools :)