• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

substance_painter.ui.delete_ui_element() doesn't remove dock widget only dock widget contents

New Here ,
Sep 26, 2024 Sep 26, 2024

Copy link to clipboard

Copied

When following the hello plugin example from here:

https://helpx.adobe.com/substance-3d-painter-python/api/plugins/hello-plugin.html

 

Updated to use PySide6:

 

from PySide6 import QtWidgets
import substance_painter.ui

plugin_widgets = []


def start_plugin():
    hello_widget = QtWidgets.QTextEdit()
    hello_widget.setText("Hello from python scripting!")
    hello_widget.setReadOnly(True)
    hello_widget.setWindowTitle("Hello Plugin")
    substance_painter.ui.add_dock_widget(hello_widget)
    plugin_widgets.append(hello_widget)


def close_plugin():
    for widget in plugin_widgets:
        substance_painter.ui.delete_ui_element(widget)
    plugin_widgets.clear()


if __name__ == "__main__":
    start_plugin()

 

 

When the plugin is enabled a new dock widget is added as expected. 

 

But when disabling the plugin, only the QTextEdit widget is removed. The outter dock widget is still present, just empty. 

 

With the plugin diabled there is now an orphaned ui element which can't be removed manually or in python. Pressing X on the dock window just hides it, as it is still present in the Window>Views menu and can be showen again from here even with the plugin disabled, just now empty.

 

I would have thought the expected behavour would be to remove the whole thing when disabling the plugin as its added by the plugin. If this isn't the case then I would expect something like substance_painter.ui.remove_dock_widget() to help with this clean up process. 

 

I'm not sure if i've missed something in the docs or this is a bug? Any help would be appreciated. Thanks

 

Using V10.1.0 B3963

Bug Unresolved
TOPICS
Scripting

Views

22

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources