VRED 2021 has broken my GUI script, How can i fix it

VRED 2021 has broken my GUI script, How can i fix it

Anonymous
Not applicable
673 Views
3 Replies
Message 1 of 4

VRED 2021 has broken my GUI script, How can i fix it

Anonymous
Not applicable

Hi, I have a script that displays a GUI for the user to do quick actions that i have predefined in the script using the pyside 2 that comes with VRED.

 

That GUI now refuses to open with no errors in the terminal. Im aware that python3 is now being used, but again, no errors...

 

Any ideas? Alternatively, If i wanted to make a new window like the scene graph that can be docked to the window how would i go about that?

0 Likes
674 Views
3 Replies
Replies (3)
Message 2 of 4

sinje_thiedemann
Autodesk
Autodesk
Hi, where exactly is the script located? Is it a script plugin, in the script preferences, in the Script Editor? If you deactivate the "Convert Python 2 to 3" option in the Script preferences, do you now get errors? Can you share the part of the script that creates and shows the GUI? (Without gui content) Kind regards Sinje
0 Likes
Message 3 of 4

Anonymous
Not applicable

The script is imported as a python file as i did for all versions before 2021,  Deactivating the conversion from 2 to 3 does not help. There are still no errors. The part of the script that make the GUI is below, i have removed the stuff that builds the layout and adds buttons, that can be found by looking up a pyside 2 or q application example. Pretty standard implementation that is not working anymore.

 

 

 

class MasterGUI(QDialog):
    # Build the GUI
    def __init__(self, parent=None):
        super(MasterGUI, self).__init__(parent)
        self.parent = parent
        #self.build_Simple_Gui()
        self.build_gui() #This builds the layout and adds buttons and stuff. Proprietary and possibly confidential

dialog = MasterGUI(vredMainWindow())
dialog.show()

 

      
0 Likes
Message 4 of 4

sinje_thiedemann
Autodesk
Autodesk

Unfortunately I cannot reproduce the issue with that code snippet. I just added the PySide2 import statements and implemented a sample build_gui function, and the dialog shows up on my screen (as seen in the attached screenshot) when I import the py file or run the script.

 

Does the script below work for you?

 

What happens if you disable the build_gui function in your script, do you get an empty dialog? If you still get no dialog then, try deactivating other parts of the whole script (you wrote that the dialog is only a part of the whole script), to narrow down the search for the problem.

 

from PySide2.QtWidgets import QDialog, QLineEdit, QVBoxLayout

class MasterGUI(QDialog):
    # Build the GUI
    def __init__(self, parent=None):
        super(MasterGUI, self).__init__(parent)
        self.parent = parent
        #self.build_Simple_Gui()
        self.build_gui() #This builds the layout and adds buttons and stuff. Proprietary and possibly confidential
    def build_gui(self):
        layout = QVBoxLayout()
        layout.addWidget(QLineEdit("test"))
        # Set dialog layout
        self.setLayout(layout)

dialog = MasterGUI(vredMainWindow())
dialog.show()

 

0 Likes