Hello hivemind, does anyone know about the new “YML build UI resources” for building out the Toolkit app UI files and resources file?
Seems like the build system got updated around Sept 2024, there is mention of it in the release notes of TK Core and several apps but I can’t find any documentation on it. The old “build_resources.sh” files are missing in the latest app releases too.
Additionally, they have removed the traditional QT import statements from the compiled UI files and replaced them with the following (which seems a little janky).
from tank.platform.qt import QtCore
for name, cls in QtCore.dict.items():
if isinstance(cls, type): globals()[name] = cls
from tank.platform.qt import QtGui
for name, cls in QtGui.dict.items():
if isinstance(cls, type): globals()[name] = cls
You have to use PySide2 (PySide6 does not work) which is only compatible with Python 3.10.x, not Python 3.11.9 that ships with SG Desktop
tk-build-qt-resources needs to be run from the directory containing the build_resources.yml file
The legacy build_resources.sh does not work, I had to use the new tk-toolchain “tk-build-qt-resources” function which replaces the import statements:
(the traditional) from tank.platform.qt import QtCore, QtGui
with: from tank.platform.qt import QtCore
for name, cls in QtCore.dict.items():
if isinstance(cls, type): globals()[name] = cls
This is really ugly since it pollutes the namespace but I think this stems from a change in how pyside2-uic.exe compiles the UI files, as it imports all of the class names instead of QtCore & QtGui as it previously did.
Thanks for sharing this!
You’re absolutely right—tk-build-qt-resources is now the correct way to compile UI and resource files, replacing the old build_resources.sh. The new import structure using globals() might seem unconventional, but it was necessary to align with how PySide2 processes compiled UI files.
One key point to emphasize is that PySide6 is not supported, and the build system currently requires PySide2 with Python 3.10. This is important to keep in mind, especially since SG Desktop ships with Python 3.11.9, which can lead to compatibility issues if not handled correctly.