pythonpyqtpyside2qtwidgetsnuke

How can I add a pane to nuke and use it inside the GUI?


I am trying to create a nuke pane that I can call the same way the embedded panes are called. So far, I am able to see it in the 'custom windows' menu, but when I press on the button, the panel shows up empty.

enter image description here

I know the code is working because when I copy/paste it in the script editor, it works as desired, but I am probably missing some function that calls for my pane to be populated.

I am using QtWidgets, and this is my reduced code:

class NukePanel_AssetManager(QtWidgets.QWidget):
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        self.setLayout(QtWidgets.QVBoxLayout())
        myTable    = QtWidgets.QTableWidget()
        # all my functions and the things I am creating #
        self.layout().addWidget(myTable)

pane = nuke.getPaneFor('Properties.1')
panels.registerWidgetAsPanel('NukePanel_AssetManager', 'Asset Manager', 'uk.co.thefoundry.NukePanel_AssetManager', True).addToPane(pane)

What am I missing?


Solution

  • This solved it!!

    import nukescripts
    import myPanelScript
    
    
    pathToClass='myPanelScript.NukePanel_AssetManager' #the full python path to your panel
    HRName='Asset Manager' #the Human-readable name you want for your panel
    regName='NukePanel.AssetManager' #the internal registered name for this panel (used for saving and loading layouts)
    
    nukescripts.panels.registerWidgetAsPanel(pathToClass, HRName, regName, True).addToPane(nuke.getPaneFor('Properties.1'))
    

    Thank you all for your answers, as this would have not been possible for me without your inputs!!