DialogCallback crashes iclone 7 . A bug or a scripting error?


https://forum.reallusion.com/Topic501579.aspx
Print Topic | Close Window

By frank_461853 - 3 Years Ago
in my plugin i copied this from one of the examples on the iclone python site
class DialogCallback(RLPy.RDialogCallback):
    def __init__(self):
        RLPy.RDialogCallback.__init__(self)
    def OnDialogHide(self):
       
        RLPy.RDialogCallback.__hide__(self)
        print("The dialog window is Hidden")
    def OnDialogShow(self):
        
       
        print("The dialog window is Shown")
    def OnDialogClose(self):
        
        RLPy.RDialogCallback.__close__(self)
        print("The dialog window is Closed")
        return True
and this

       dock_window = RLPy.RUi.CreateRDockWidget()
    dock_window.SetWindowTitle("SetStage")
    dock_window.SetAllowedAreas(RLPy.EDockWidgetAreas_RightDockWidgetArea)
    hide_button = QtWidgets.QPushButton(text="Hide", minimumHeight=24)
    hide_button.clicked.connect(lambda: dock_window.Hide())
    #show_button = QtWidgets.QPushButton(text="Show", minimumHeight=24)
    #show_button.clicked.connect(lambda: dock_window.Show())
    main_widget = QtWidgets.QWidget()
    main_widget.setLayout(QtWidgets.QHBoxLayout())
    #main_widget.layout().addWidget(hide_button)
    #main_widget.layout().addWidget(show_button)
    
    Stage_One= QtWidgets.QPushButton(text="1", minimumHeight=24)
    Stage_One.clicked.connect(lambda: set_Lights(1))
    Stage_Two= QtWidgets.QPushButton(text="2", minimumHeight=24)
    Stage_Two.clicked.connect(lambda: set_Lights(2))
    Stage_Three= QtWidgets.QPushButton(text="3", minimumHeight=24)
    Stage_Three.clicked.connect(lambda: set_Lights(3))
    Stage_Four= QtWidgets.QPushButton(text="4", minimumHeight=24)
    Stage_Four.clicked.connect(lambda: set_Lights(4))
    Stage_Five= QtWidgets.QPushButton(text="5", minimumHeight=24)
    Stage_Five.clicked.connect(lambda: set_Lights(5))
    main_widget.layout().addWidget(Stage_One)
    main_widget.layout().addWidget(Stage_Two)
    main_widget.layout().addWidget(Stage_Three)
    main_widget.layout().addWidget(Stage_Four)
    main_widget.layout().addWidget(Stage_Five)
    main_widget.layout().addWidget(hide_button)
    
    dock = wrapInstance(int(dock_window.GetWindow()), QtWidgets.QDockWidget)
    dock.setFixedWidth(300)
    dock.setWidget(main_widget)
    dialog_callback = DialogCallback()
    dialog_register_id = dock_window.RegisterEventCallback(dialog_callback)
    dock_window.Show()
when i run the script the dialog moves and behaves fine. it shows the message "The dialog is shown" in the logging console. however if i click the close button on the dialog or try to dock it, it crashes iclone. is this a bug or is there something wrong with the code?

Thank you
 

By philipjie117 - Last Year
Hey, frank. It may be too late, but I still want to share my attempt with you.
I met the same crash. I found that if delete the code "RLPy.RDialogCallback.__hide__(self)" in OnDialogHide(self) and "RLPy.RDialogCallback.__close__(self)" in OnDialogClose(self), iClone 7 will not crash. The problem seems to be solved.