Icons
 
 
 

It is possible for the plug-ins to use icons in their user interfaces (e.g. command panels). These icons are alpha-composited background icons and reside as *.bmp files in the \UI\Icons folder and are loaded during startup. It is also possible for the developers to integrate one or more resource based icons in their plug-in DLL file. In this case, those resource based icons will need to be converted to external icons and be stored as 24-bit image files with associated 24-bit alpha mask image files. The name of these files follow a fairly standard naming convention. As an example, the material editor icons and image files will be used for the following outline. The icon image files for this example can be found in the \UI\Icons folder as:

MeditImages_a.bmp//The 24-bit icon alpha mask

MeditImages_i.bmp//The 24-bit icon images

One difference with ordinary icon formats is that these use an alpha mask instead of an XOR mask. An XOR mask needs to be inverted in order to create a proper alpha mask out of it. The process for this is fairly straightforward; copy the images directly to a file (i.e. myicons_i.bmp), invert the mask file and storing that in the associated file (i.e. myicons_a.bmp). This process will result in icons which are identical to the XOR masked versions. Of course, you can also tweak the alpha mask to give it fuzzy edges and other effects you might like for your icons to help composite with the background color in a seamless and smooth way.

In the plugin code you will need to create image lists for the icons. Once again, taking the material editor as an example, you can create the image list in the following manner:

hMeditImages = ImageList_Create(BUTW, BUTH, ILC_COLOR24 | ILC_MASK, 5, 0);
LoadMAXFileIcon("MeditImages", hMeditImages, kBackground, FALSE);

The first thing we do is to create an image list with 24-bit images and a mask. Next, we need to call LoadMAXFileIcon()to load the images into the image list. See below for more information on this function.

If you want your icons to respond when the user customizes colors, you will need to implement a color change callback to reload the icons. This is not required, but it does enable your UI to integrate well with the color customization system. You need to create a callback as outlined below:

staticvoidColorChangeNotifyProc(void* param, NotifyInfo* pInfo)
{
   ImageList_RemoveAll(hMeditImages);
   LoadMAXFileIcon("MeditImages", hMeditImages, kBackground, FALSE);
}

Then you will need to register it after you load the icons for the first time:

RegisterNotification (ColorChangeNotifyProc, NULL, NOTIFY_COLOR_CHANGE);
	 

This way your buttons will always look correct when the user starts customizing colors.

Dark Icons

When using the dark color scheme for the icons, 3ds Max automatically darkens the bitmap based icons. This might result in poor readability of the icons. In order to increase the readability of the icons in such case, a set of dark icons optimized for the dark color scheme are provided in an icon folder called <3dsMax_Root>\UI\IconsDark. 3ds Max looks into this folder for dark icons first, and falls back to <3dsMax_Root>\UI\Icons if it can't find any dark icons in the former location.

This change may impact the way that your plug-in icons are displayed when 3ds Max uses the dark color theme. The following scenarios illustrate some types of problems you may encounter, and the corresponding solutions.

Your bitmap based icons don't display at all

Make sure your plug-in always loads the icons from <3dsMax_Root>\UI\Icons using class MaxBmpFileIcon and install your icons (the same set) in both <3dsMax_Root>\UI\Icons and <3dsMax_Root>\UI\IconsDark. This class will look for icons in the folder that corresponds to the current color theme used by 3ds Max.

You want to improve the readability of your bitmap based icons

Install a set of icons optimized for the dark color scheme into <3dsMax_Root>\UI\IconsDark and make sure your plug-in uses class MaxBmpFileIcon to retrieve the right set of icons, or load the icons from the location supplied by the IColorManager::GetIconFolder() method.

Your icons are resources in your plug-in DLL

In some cases plug-ins manage icons as Window resources and manually handle the loading of icons instead of using the MaxBmpFileIcon class. To make sure your plug-in starts up with the correct icons (matching Max's color theme) you can call AppFrameColorTheme IColorManager::GetAppFrameColorTheme(). The plug-in can also subscribe to the NOTIFY_APP_FRAME_THEME_CHANGED notification (see maxsdk\include\notify.h) in order to react to changes in the 3ds Max color theme.