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

Question regarding java/python docking windows and modifying a java docking window through python

New Here ,
Feb 28, 2022 Feb 28, 2022

Copy link to clipboard

Copied


substance painter version 2021.1.0(7.1.0)build 804

 

Hi I have a docking window that I created in substance painter with java code and I want to access it's text field through another python script.

There is some difference into how python is reading the docking windows that python code creates compareds to the docking window from java scripts. for example the docking window I created through a general gui script that is doing the interface gives me the title of the docking window as the object name and I can access to the Text field 

main_window=substance_painter.ui.get_main_window()
for child in main_window.children():
print ("these are all dock windows"+child.objectName())
if child.objectName() == 'Hello Plugin2':
for subchild in child.children():
if subchild.__class__==QtWidgets.QTextEdit:
bla = subchild.toPlainText()


with this sort of code I get a bunch of gui windows.
I find my python one
[Python] these are all dock windows Hello Plugin2
and I find this:
[Python] these are all dock windows file:///C:/Users/ana.rankovic/Documents/Allegorithmic/Substance Painter/plugins/getLastImportedMeshInfo/dockingwindow.qml 0

to possibly stand in place for my java docking window that has a title GETLASTIMPORTEDMESHINFO-GETPATHWINDOW, that because it makes a combination of the folder structure in java plugin folder plus the
objectName: "GetPathWindow" definition that I gave it to the definition qml file.

Further more if I expand these (both the python and the java docking window to se the children's objects) i get a similar structure, however in the java one the TextEdit is virtually unaccessible:


Hello Plugin2 : expanded with children of nodes:

[Python] <class 'PySide2.QtWidgets.QAbstractButton'>
[Python] name of SUBCHILD <built-in method objectName of PySide2.QtWidgets.QAbstractButton object at 0x0000024600275E08>
[Python] <class 'PySide2.QtWidgets.QAbstractButton'>
[Python] name of SUBCHILD <built-in method objectName of PySide2.QtWidgets.QAbstractButton object at 0x0000024600275E48>
[Python] <class 'PySide2.QtWidgets.QAction'>
[Python] name of SUBCHILD <built-in method objectName of PySide2.QtWidgets.QAction object at 0x0000024600275E88>
[Python] <class 'PySide2.QtWidgets.QWidget'>
[Python] name of SUBCHILD <built-in method objectName of PySide2.QtWidgets.QWidget object at 0x0000024600275EC8>
[Python] <class 'PySide2.QtCore.QObject'>
[Python] name of SUBCHILD <built-in method objectName of PySide2.QtCore.QObject object at 0x0000024600275F08>
[Python] <class 'PySide2.QtWidgets.QTextEdit'>
[Python] name of SUBCHILD Project info

 

however if I expand the java docking window which I suspect carries the objectName file:///C:/Users/ana.rankovic/Documents/Allegorithmic/Substance Painter/plugins/getLastImportedMeshInfo/dockingwindow.qml 0

this one is a bit more expanded:

[Python] class of child<class 'PySide2.QtWidgets.QLayout'>
[Python] objName of child
[Python] class of child<class 'PySide2.QtWidgets.QAbstractButton'>
[Python] objName of childqt_dockwidget_floatbutton
[Python] class of child<class 'PySide2.QtWidgets.QAbstractButton'>
[Python] objName of childqt_dockwidget_closebutton
[Python] class of child<class 'PySide2.QtWidgets.QAction'>
[Python] objName of child
[Python] class of child<class 'PySide2.QtWidgets.QWidget'>
[Python] objName of child
[Python] clas of subchild<class 'PySide2.QtWidgets.QHBoxLayout'>
[Python] objName of subchild
[Python] clas of subchild<class 'PySide2.QtWidgets.QLabel'>
[Python] objName of subchild
[Python] clas of subchild<class 'PySide2.QtWidgets.QToolButton'>
[Python] objName of subchildundockButton
[Python] subsubsubchild class<class 'PySide2.QtWidgets.QAction'>
[Python] subsubsubchild objName
[Python] clas of subchild<class 'PySide2.QtWidgets.QToolButton'>
[Python] objName of subchildcloseButton
[Python] subsubsubchild class<class 'PySide2.QtWidgets.QAction'>
[Python] subsubsubchild objName
[Python] class of child<class 'PySide2.QtCore.QObject'>
[Python] objName of child
[Python] class of child<class 'PySide2.QtWidgets.QWidget'>
[Python] objName of childfile:///C:/Users/ana.rankovic/Documents/Allegorithmic/Substance Painter/plugins/getLastImportedMeshInfo/dockingwindow.qml 0
[Python] clas of subchild<class 'PySide2.QtCore.QObject'>
[Python] objName of subchild
[Python] clas of subchild<class 'PySide2.QtCore.QObject'>
[Python] objName of subchild

but you can see the parallel. It has two docking buttons an action a widget an object and a widget, which in the first case the python docking window
is my text Edit and in this one the java docking window is a widget named again, by the path to the qml file and with two children nodes who are of type object (that I suspect represent the button and the Text Edit field in my window)
and this doesn't allow me to further query that are of class object to see if they are of subclass Button or textEdit neither can I query their names or use the methods to modify
Is there any way I could accesss the text field of the java Docking window to modify it through my script and also close it for user modification through the keyboard?

TOPICS
Scripting

Views

37

Likes

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