Material Common Properties, Operators, and Methods

Properties

<material>.name 

All the material subclasses can access the name property and specify it as a constructor parameter.

<material>.effectsChannel 

All the material subclasses can access the effectsChannel property and specify it as a constructor parameter.

<material>.showInViewport 

Accesses the material-level show-in-viewport state, which can also be set on a material constructor call using the showInViewport : parameter.

EXAMPLE

   b=box()
   b.material = standard diffuseMap:(checker()) showInViewport:true

Methods

assignNewName <material> 

Modifies the name of the specified material to make it unique. The name is of the form "Material #1" where the number is incremented as required to make ensure it’s unique.

okMtlForScene <material> 

Tests the material name against other material names in the scene, and returns true if there are no other materials with the same name, false otherwise. Before assigning material to scene, call this to avoid duplicate names.

getMTLMEditFlags ( <material> | <texture> ) setMTLMEditFlags ( <material> | <texture> ) <bitarray> 

Get and set the MEdit options for the specified material or texture as a <bitarray>. If a bit is on, the corresponding option is turned on. The order of the bits is: #{MTL_BEING_EDITED,BACKGROUND,BACKLIGHT,VIDEO_COLOR_CHECK}

The first bit is set if the rollout for the specified material or texture is currently displayed in the active MEdit slot. The state of this bit is ignored in setMTLMEditFlags().

getMTLMeditObjType ( <material> | <texture> ) setMTLMeditObjType ( <material> | <texture> ) <integer> 

Get and set the MEdit sample object type for the specified material or texture. The valid values are: 1 - sphere; 2 - cylinder; 3 - cube; 4 - custom

getMTLMeditTiling ( <material> | <texture> ) setMTLMeditTiling ( <material> | <texture> ) <integer> 

Get and set the MEdit tiling type for the specified material or texture. The valid values are: 1 - 1x1; 2 - 2x2; 3 - 3x3; 4 - 4x4

updateMTLInMedit ( <material> | <texture> ) 

Performs a set of 3ds Max notifications that forces an update of the material or texture throughout 3ds Max, including the MEdit and material browser.

You can get and set Material Editor materials using the getMeditMaterial() and setMeditMaterial() functions. You can also get a material from the Material Editor using the editMaterials virtual array. See Material Editor and MaterialLibrary Values for more information.

The following methods are available in 3ds Max 6 and higher:

<integer> getNumSubMtls <material> 

This method returns the number of sub materials for the material.

<material> getSubMtl <material> <index> 

This method returns the indexed sub material of the material.

setSubMtl <material> <index> <material> 

This method sets the indexed sub material of the material to the specified material.

getSubMtlSlotName <material> <index> [localizedName:<bool>] 

This method returns the slot name of the indexed sub material of the material.

When the localizedName keyword parameter is true (the default), the localized name as it appears in the UI is returned. Otherwise the non-localized name is returned. Available in in 3ds Max 2022 and later

<integer> getNumSubTexmaps (<material> | <texture>) 

This method returns the number of sub textures for the material or texture.

<material> getSubTexmap (<material> | <texture>) <index> 

This method returns the indexed sub texture of the material or texture.

setSubTexmap (<material> | <texture>) <index> <texture> 

This method sets the indexed sub texture of the material or texture to the specified texture.

getSubTexmapSlotName (<material> | <texture>) <index> [localizedName:<bool>] 

This method returns the slot name of the indexed sub texture of the material or texture.

When the localizedName keyword parameter is true (the default), the localized name as it appears in the UI is returned. Otherwise the non-localized name is returned. Available in in 3ds Max 2022 and later

<boolean> isMtlUsedInSceneMtl  <material> skipCustAttributes:<true> includeXrefScenes:<false> topLevelMtlOnly:<false>

Available in 3ds Max 2018 and higher: This function returns true if the specified material or texturemap is used in some way by any material that is assigned to a node in the scene. Specify skipCustAttributes as true to skip over any MAXWrapper objects held in Custom Attributes. Set includeXrefScenes as true to search any Xrefed scenes as well. Specify topLevelMtlOnly as true to only check the diffusemap (maps[1]) of each material.