Mesh Texture Vertex Methods

The following methods provide basic access to the legacy UVW channel.

Note: When MAXScript was first introduced in 3ds Max 2, there were only two mapping channels, with Channel 1 being the original texture channel of 3ds Max 1. For generalized access to all 100 map channels, you should consider using the methods described in Meshop General Mapping Methods.

Methods:

getNumTVerts <mesh>

Returns number of texture vertices as an integer, equivalent to using <mesh>.numtverts

setNumTVerts <mesh> <number> [ <boolean> ]

Sets the number of texture vertices as specified. If the optional boolean argument is true , the existing topology remains intact. If it is false or not supplied, the topology is lost.

When setting the number of texture vertices using the numTVerts property or setNumTVerts method, the new verts are initialized to [0.,0.,0.]

getTVert <mesh> <tvert_index_integer>

Returns the UVW coordinates of the indexed texture vertex

setTVert <mesh> <tvert_index_integer> ( <point3> | <x> <y> <z> )

Sets the UVW coordinates of the indexed texture vertex as a point3 value, or 3 floats - U,V,W

getTVFace <mesh> <face_index_integer>

setTVFace <mesh> <face_index_integer> <vert_indices_point3>

setTVFace <mesh> <face_index_integer> <tvert_index_integer> <tvert_index_integer> <tvert_index_integer>

The getTVFace() and setTVFace() functions mirror the getFace() and setFace() functions and are used to specify texture mapping topology in terms of texture vertices. You can set up and access texture vertices with the getTVert() , setTVert() , getNumTVerts() , and setNumTVerts() functions described above.

buildTVFaces <mesh> [ <boolean> ]

The buildTVFaces() function only needs to be called on meshes you are adding texture vertices to yourself to create the internal texture face array. Meshes that 3ds Max applies mapping coordinates to maintain the TVFace array automatically. This is not done automatically when you add texture vertices to meshes yourself so you need to call buildTVFaces() explicitly whenever you change the texture vertex count, and before you construct the texture faces. If the optional boolean argument is true , the existing texture mapping remains intact. If it is false or not supplied, the existing texture mapping is lost (all texture faces are rebuilt, with all three vertices of the texture face using texture vertex 1).

numMapsUsed <mesh>

Returns the an upper limit on the number of texture map channels used by the given node. This is at least 1+(highest channel in use). This method is used so a script that does something to all map channels doesn't always have to do it to every channel up to 99 (the highest possible texture map channel), but rather only to this value. This method is not applicable to TriMeshes.

Note:

The mesh class contains a list of texture vertices which are completely independent of the regular vertices in the mesh. There is no correlation between the number of vertices in a mesh and the number of texture vertices. In addition to the texture vertices there are also texture faces. There needs to be one texture face for every regular face in the mesh.

Each texture face has three indices into the texture vertex array. The coordinates of a texture vertex are UVW coordinates, and are accessed as Point3 values. The 3 components are U, V, and W, and each component value is in the range of 0 to 1. An example script for creating planar texture mapping on an object is shown in Working with Editable Meshes.

A detailed explanation of the way texture and color-per-vertex data is used can be found in the topic Understanding Texture Coordinates and Vertex Colors

The texture vertex methods do not support multiple mapping channels. Use the respective General Meshop Mapping Methods instead.