This Python tool for Maya will let you browse all the image resources Maya has already loaded from QResource bundles.
These internal resources make it easy to add images to buttons and other UI elements without authoring or packaging images in your tools and scripts.
There is the added benefit of having your application look native to Maya and feel familiar with users.
This is an example of using a built in Maya icon as a QPixmap in your code:
px_open = QtGui.QPixmap(":/fileOpen.png")
-
Place the entire directory
qt_img_resource_browser
in your Maya scripts directory or a directory that Maya can load Python scripts from.├- maya ├- scripts ├- qt_img_resource_browser ├- app.py ├- interface.py ├- etc . . .
-
Restart Maya.
-
Launch the window with this python command:
# Python import qt_img_resource_browser.interface as interface interface.load()
- Add a shortcut to the shelf from the "Utils" main menu.
- Open the Github page from the "Help" main menu.
- The number of images in the list is displayed in the title bar.
- A preview of the image
- The path for the image
- The extension of the image
- The pixel dimensions of the image
- Copy the path with quotes to the clipboard
- Save the image file as a .png
By default some paths are excluded from the list. You can edit the config.json
file to modify these exclusions.
This tool uses the Qt.py shim to enable compatibility with PySide or PySide2.
I can only test on Windows 10 at the moment. I won't be able to reproduce any issues running on another platform.
Please note that some images included in later versions of Maya may not be present in earlier versions.
- Loading the window is slow initially due to thousands of widgets.