MAXScript Tools and Interaction with 3ds Max > Interacting with the 3ds Max User Interface > Material Editor >

# showTextureMap() function

The showTextureMap() function provides control over both material and map level texture showing in the viewport.

The form is:

    showTextureMap <material> [<texmap>|<material>] <boolean>

If the optional <texmap> or <material> is not specified, Show Map in Viewports is set for the argument 1 material to the <boolean> argument.

If the optional <texmap> is specified, it will be searched for in the argument 1 material. It must be a direct subtexture of the supplied argument 1 material. Its show-in-viewport state will be set on or off according to the <boolean> argument.

If the optional material is specified, it will be searched for in the argument 1 material. Its show-in-viewport state will be set on or off according to the <boolean> argument.

EXAMPLE
    showTextureMap$foo.material on
    showTextureMap$foo.material $foo.material.diffusemap off

Note

Mapping coordinates aren't explicitly enabled for all objects at creation time. When a script is run in the Listener, using 'showTextureMap' is indirectly turning mapping coordinates on. This happens during the scene redraw which happens after each line is executed, if needed. If a script is run from a script editor, or if you put parenthesis around a script, no scene redraw is performed until the entire script is run. Since no redraw is performed, no mapping coordinates exist on the object when the script tries to access them. Solutions: explicitly perform a scene redraw [redrawViews()] after 'showTextureMap', or explicitly turn on mapping coordinates for the object.

The following methods introduced in 3ds Max 2008 provide control over the state of the Hardware Mode Show Map In Viewports available as a flyout option to the regular Show Map In Viewports icon:

    enableHardwareMaterial <material> [<texmap>|<material>] <boolean>

This method allows control over the state of the flyout at both material and map level.

When set to true, the flyout will be switched to Hardware mode (magenta icon).

When set to false, the flyout will be switched to Software mode (blue icon)

    showHWTextureMap <material> [<texmap>|<material>] <boolean>

This method provides control over the state of the Show Map In Viewport icon at both material and map level.

When set to true, the icon will be pressed. When set to false, it will be depressed.

The flyout must be in hardware mode when using this method - see the enable Hardware Material method described above. If it is not, the icon will be pressed but no maps will be displayed in the viewport.

EXAMPLE
    s = Sphere() --create a sphere
    s.material = Arch___Design__mi() --assign an A&D Material
    enableHardwareMaterial s.material true --switch SMIV flyout to HW mode
    showHWTextureMap s.material true --press the SMIV icon

#### See Also

- Material Editor

- TextureMap Common Properties, Operators, and Methods

- Accessing The Material Editor Active Slot

- Interface: medit