Use a high resolution custom icon for a shelf item

When you run Maya on a high resolution display device, like Ultra HD or 4K monitors, Maya's interface automatically uses high resolution images for icons, cursors, and other images. The supported resolutions are 100%, 150%, and 200%.

By default, Maya uses the 100% image, but if you are running Maya on a display with a higher resolution, Maya automatically uses a higher resolution image (150% or 200%). For custom images, you can also take advantage of this feature by providing your own custom images used in Maya.

  1. Name your images using the naming convention as follows:
    • name_100.png: This is the resolution used by default, for example, 32x32 for the Shelf.
    • name_150.png: This file is at 150% of the default resolution; that is 48x48 in this example.
    • name_200.png: This file is at 200% of the default resolution; that is 64x64 in this example.
  2. Do one of the following:
    • Save your image files (for icons and other images) in the ..\prefs\icons folder of your Maya installation directory.
      Note: If you select this option, use name.png for the file name of your default image (instead of name_100.png).
    • Create a .qrc file to specify all three image files, and use the alias tag to remove the _100 suffix from the file name of the default image.; for example, as follows:
      <!DOCTYPE RCC><RCC version="1.0">
      	<qresource>
      		<file alias="cone.png">cone_100.png</file>
      		<file>cone_150.png</file>
      		<file>cone_200.png</file>
      	</qresource>
      </RCC>
      Note: Cursors must be compiled into the .qrc file to be loaded.
  3. Specify the file name of the default image (100% resolution) when you add your command or script to the Maya interface.

    The following examples demonstrate how to add a command or a script to the shelf using the shelfButton command and specify the default image using the image1 flag:

    shelfButton
    -label “Cone”
    -command "CreateNURBSCone"
    -image1 "cone.png";
    shelfButton
    -label “Resource Browser”
    -sourceType "python" 
    -command "import maya.app.general.resourceBrowser as resourceBrowser\nresBrowser = resourceBrowser.resourceBrowser()\npath = resBrowser.run\n"
    -image1 "commandButton.png";

Related topic