Getting and Setting User Preferences

3DS Max Plug-In SDK

Getting and Setting User Preferences

See Also: Class Interface, Class ViewExp, Class Point3.

Overview

This section provides an overview of the global functions, classes and methods used to retrieve and set the user preferences of MAX. Many of these are from the various pages of the Customize / Preferences... dialog.

User Interface Colors

A 3ds max user may set various colors in the user interface via the settings in the Customize… Preferences… Color tab dialog. A developer may access and set these settings using the following global functions:

Prototype:

Point3 GetUIColor(int which);

Remarks:

This function is available in release 2.0 and later only.

Returns the specified color value for drawing various items in the 3ds max viewports.

Parameters:

int which

Specifies which color to retrieve. See List of Viewport Drawing Color Indices.

Prototype:

void SetUIColor(int which, Point3 *clr);

Remarks:

This function is available in release 2.0 and later only.

Sets the specified color value for drawing various items in the 3ds max viewports.

Parameters:

int which,

Specifies which color to set. See List of Viewport Drawing Color Indices.

Point3 *clr

The color value to set.

Prototype:

Point3 GetDefaultUIColor(int which);

Remarks:

This function is available in release 2.0 and later only.

Returns the default color used for drawing various items in the 3ds max user interface. The values returned are not affected by the user's color selections or those set by SetUIColor().

Parameters:

int which

Specifies which color to retrieve. See List of Viewport Drawing Color Indices.

 

Note the following #defines for getting the selection color, sub-object selection color and the frozen object color.

#define GetSelColor() GetUIColor(COLOR_SELECTION)

#define GetSubSelColor() GetUIColor(COLOR_SUBSELECTION)

#define GetFreezeColor() GetUIColor(COLOR_FREEZE)

#define SMALL_VERTEX_DOTS 0

#define LARGE_VERTEX_DOTS 1

 

Function:

void setUseVertexDots(int b);

Remarks:

This method is available in release 3.0 and later only.

Sets the Use Vertex Dots preference to on or off. This corresponds to the 'Show Vertices As Dots' in the 3ds max user interface.

Parameters:

int b

Nonzero for on; zero for off.

Function:

int getUseVertexDots();

Remarks:

This method is available in release 3.0 and later only.

Returns the Use Vertex Dots preference -- nonzero for on; zero for off.

Function:

void setVertexDotType(int t);

Remarks:

This method is available in release 3.0 and later only.

Sets the Vertex Small Dots / Large Dots preference. This corresponds to the 'Show Vertices As Dots' Small Dots / Large Dots radio buttons in the 3ds max user interface.

Parameters:

int t

One of the following values:

SMALL_VERTEX_DOTS

LARGE_VERTEX_DOTS

Function:

int getVertexDotType();

Remarks:

This method is available in release 3.0 and later only.

Returns the Vertex Small Dots / Large Dots preference. One of the following values:

SMALL_VERTEX_DOTS

LARGE_VERTEX_DOTS

Access to the MAX Viewport settings:

Access to the user settings includes the 3ds max toolbars, snap settings, crossing setting, animate button, 3ds max window handle, sub-object selection color, axis constraints, coordinate centers, and reference coordinate system setting.

See Class Interface - Access to User Interface Properties and Controls. The above settings and more are accessed using these methods.

Some of the viewport settings are global in nature -- that is they affect all the viewports. These methods are in class Interface. Examples are getBkgImageName(), GetGridSpacing(), etc.

Other viewport settings are specific to a viewport. These are available in class ViewExp. Examples are getBkgImageDsp(), getSFDisplay(), etc.

Access to the MAX gamma settings:

The Class GammaMgr allows access to the user specified gamma settings for display gamma, file input and output gamma.

System Settings

There is also another API that allows a plug-in to query various system settings.

int GetSystemSetting(int id);

This method will return nonzero if the setting whose id is passed is on; otherwise zero.

You may pass the following values:

SYSSET_ENABLE_EDITABLEMESH

Used to verify if TriObjects created will be the standard ones or the editable variety. Nonzero is returned if editable meshes will be created; otherwise zero for standard TriObjects.

SYSSET_CLEAR_UNDO

For release 1.1 and later if this ID is passed to this method the undo buffer is flushed.

SYSSET_EDITABLEMESH_ENABLE_KEYBOARD_ACCEL 

This option is available in release 2.0 and later only.

Determines if keyboard accelerators are enabled for the editable mesh. Nonzero if so; otherwise zero.

SYSSET_ENABLE_EDITMESHMOD

This option is available in release 2.0 and later only.

Determines if the edit mesh modifier is enabled. Nonzero if so; otherwise zero.