External Icons

3DS Max Plug-In SDK

External Icons

See Also: Class MaxIcon, Class ICustButton

 

Starting with 3ds max version 4.0 most of the icons used in the software have been externalized, meaning that these alpha-composted background icons now reside as *.bmp files in the \UI\Icons folder and are loaded during startup. Some of the image processing that takes place on these icons will be outlined below.

 

Resource based icons can be converted effectively to external icons and stored as 24-bit image files with associated 24-bit alpha mask image files. The files follow a fairly standard naming convention so for the following outline the material editor icons and image files will be used as an example. These 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 create an image list with 24-bit images and a mask. Secondly, the call to LoadMAXFileIcon() loads 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 make your UI play nicely with the color customization system. You need to create a callback as outlined below;

 

static void ColorChangeNotifyProc(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.

Function:

BOOL LoadMAXFileIcon(TCHAR* pFile, HIMAGELIST hImageList, ColorId color, BOOL disabled);

Remarks:

This method is available in release 4.0 and later only.

This method will load the images into the image list.

Parameters:

TCHAR* pFile

The prefix of the file name for the icon BMP files. The path is not included. The system will look in the UI\Icons directory, and append "_i.bmp" for the image file and "_a.bmp" for the alpha mask file.

HIMAGELIST hImageList

The image list that the icons will be loaded into. It appends the images at the end of the list.

ColorId color

The id of the background color used to composite. All the available "ColorId" values are defined in MAXSDK\INCLUDE\iColorMan.h. Normally you will use "kBackground" which is the color id for the background color for all MAX controls.

BOOL disabled

A boolean that tells the system whether to produce the disabled or enabled versions of the icons. This controls what sort of image processing is done on the icons. We store a set of scale values for the saturation, value and transparency for both enabled and disabled icons. This flag determines which set of values we use when loading the icons. If your original image list contains both enabled and disabled versions of its icons, then you can just pass "FALSE" for this parameter and use the image list as you did before. If you want the system to automatically create the disabled versions of your icons, then you can call this with "TRUE".

Return Value:

TRUE if successful, otherwise FALSE.