MAXScript Language Reference > 3ds Max Objects > Modifier : MAXWrapper and SpacewarpModifier : MAXWrapper > Modifier and SpacewarpModifier Types > Modifiers > UVW Modifiers > Unwrap_UVW : Modifier >

# Unwrap_UVW Modifier - Topology Editing

| Unwrap_UVW Modifier - Main Topic | Modifier Classes - Quick Navigation

The functions below work on the UVW mesh allowing you to rearrange the topology or add new topology.

Note

Use these methods with care since you can create invalid topology which can cause unpredictable results!

Unwrap has topology similar to meshes but it has been changed to support everything except patches and polygons at the same time. Unwrap has a list of Point3 values which are the texture vertices positions. Then there are texture faces which contain an array of integers which are indices into the texture vertex list. There can be 3 to N number of ints in this array depending on the topology being fed into Unwrap. In addition to this, there are also 2 arrays of integers for the handles and interior handles if the topology is a patch which also points into the texture vertex list. The functions below allow you to manipulate these arrays to do things like break, weld, and perform other topological functions.

## Basic Topology Editing

Methods:

    <void><Unwrap_UVW>.markAsDead <integer>index

This marks a vertex that it is dead, and no longer in use.

Vertices are not actually deleted they are just marked and recycled when needed. That means that when a vertex is added vertices marked as dead will be the first ones checked. If there are no dead vertices, the vertex is appended to the end of the list. Use this function carefully, since marking a vertex in use as dead will cause strange results.

<integer> index - The index of the vertex to mark as dead.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.numberPointsInFace <integer>index

This retrieves the numbers of vertices that a face contains.

A face can contain 3 to N number of points depending on what type of topology Unwrap is working on. For Tri Meshes this is always 3; for patches this can be 3 or 4; and for polygons this can be 3 or greater. Unwrap abstracts all three object types into one generic format.

<integer> index - The index of the face that you are inspecting.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.getVertexIndexFromFace <integer>faceIndex <integer>ithVertex

This retrieves the index of a vertex from a face.

A face contains 0 to N number of vertices, so to retrieve a particular vertex index, you give it the face index and the ith vertex that you want to inspect. For example, if you wanted to look at the 3 vertex on face 1 you would call GetVertexIndexFromFace (1,3).

<integer> FaceIndex - The index of the face that you want to inspect.

<integer> IthVertex - The ith vertex of that you want to retrieve. This value should range from 1 to the number of vertices that the face contains.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.getHandleIndexFromFace <integer>faceIndex <integer>ithVertex

This retrieves the index of a handle, from a face, which contains 0 to N number of handles.

To retrieve a particular handle index, you give it the face index and the ith handle that you want to inspect. For example, if you wanted to look at the 3 handle on face 1 you would call GetHandleIndexFromFace 1 3. This only applies to patch meshes.

<integer> FaceIndex - The index of the face that you want to inspect.

<integer> IthVertex - The ith handle of that you want to retrieve. This value should range from 1 to the twice the number of vertices that the face contains.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.getInteriorIndexFromFace <integer>faceIndex <integer>ithVertex

This retrieves the index of a interior handle from a face.

A face contains 0 to N number of interior handles, so to retrieve a particular interior handle index, you give it the face index and the i-th interior handle that you want to inspect. For example, if you wanted to look at the 3rd interior handle on face 1 you would call GetInteriorIndexFromFace 1 3. This only applies for patch meshes.

<integer> FaceIndex - The index of the face that you want to inspect.

<integer> IthVertex - The ith interior handle of that you want to retrieve. This value should range from 1 to the number of vertices that the face contains.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.getVertexGeomIndexFromFace <integer>faceIndex <integer>ithVertex

This retrieves the index of a geometric vertex from a face.

This is the vertex that is attached to the mesh and not the texture faces. A face contains 0 to N number of vertices, so to retrieve a particular vertex index, you give it the face index and the ith vertex that you want to inspect. For example, if you wanted to look at the 3 vertex on face 1 you would call GetVertexGeomIndexFromFace 1 3.

<integer> FaceIndex - The index of the face that you want to inspect.

<integer> IthVertex - The ith vertex of that you want to retrieve. This value should range from 1 to the number of vertices that the face contains.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.getHandleGeomIndexFromFace <integer>faceIndex <integer>ithVertex

This retrieves the index of a geometric handle from a patch. This the handle that is attached to the patch and not the texture faces. A face contains 0 to N number of handles, so to retrieve a particular handle index, you give it the face index and the ith handle that you want to inspect. For example, if you wanted to look at the 3 handle on face 1 you would call GetHandleGeomIndexFromFace(1,3).

<integer> FaceIndex - The index of the face that you want to inspect.

<integer> IthVertex - The ith handle of that you want to retrieve. This value should range from 1 to twice the number of vertices that the face contains.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.getInteriorGeomIndexFromFace <integer>faceIndex <integer>ithVertex

This retrieves the index of a geometric interior handle from a patch.

This the interior handle that is attached to the patch and not the texture faces. A face contains 0 to N number of interior handles, so to retrieve a particular interior handle index, you give it the face index and the ith interior handle that you want to inspect. For example, if you wanted to look at the 3 interior handle on face 1 you would call GetInteriorGeomIndexFromFace (1,3).

<integer> FaceIndex - The index of the face that you want to inspect.

<integer> IthVertex - The ith interior handle of that you want to retrieve. This value should range from 1 to the number of vertices that the face contains.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <void><Unwrap_UVW>.setFaceVertex <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel

This allows you to manipulate the position of vertex attached to a face.

Basically, it detaches the vertex if multiple faces share that vertex and then moves it to the position specified. So if you want to move the 3 rd vertex of face 1 to (.5,.5,.0) you would do setFaceVertex [.5 .5 .0] 1 3. If you don’t want the vertex broken use SetVertexSPosition.

<point3> pos - The position that you want to move a vertex to.

<integer> faceIndex (integer) - The index of the face that you wish to work on.

<integer> ithVertex (integer) - The ith vertex of the face that you want to change.

<boolean> sel - Whether or not to select the vertex after it is recreated.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <void><Unwrap_UVW>.setFaceHandle <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel

Identical to SetFaceVertex except works on patch handles.

<point3> pos - The position that you want to move a vertex to.

<integer> faceIndex (integer) - The index of the face that you wish to work on.

<integer> ithVertex (integer) - The ith vertex of the face that you want to change.

<boolean> sel - Whether or not to select the vertex after it is recreated.

Exposed via unwrap interface in 3ds Max 4 and higher .

    <void><Unwrap_UVW>.setFaceInterior <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel

Identical to SetFaceVertex except works on patch interior handles.

<point3> pos - The position that you want to move a vertex to.

<integer> faceIndex (integer) - The index of the face that you wish to work on.

<integer> ithVertex (integer) - The ith vertex of the face that you want to change.

<boolean> sel - Whether or not to select the vertex after it is recreated.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <void><Unwrap_UVW>.setFaceVertexIndex <integer>faceIndex <integer>ithVertex <integer>vertexIndex

This allows you to set the index of the ith vertex of a face.

For example, if you wanted to change the index of the 3 rd vertex of face 1 to 100 you would call setFaceVertexIndex 1 3 100.

<integer> faceIndex - Index of the face you want work on.

<integer> ithVertex - The ith vertex that you want to manipulate.

<integer> vertexIndex - The index into the vertex list that you want to set to.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <void><Unwrap_UVW>.setFaceHandleIndex <integer>faceIndex <integer>ithVertex <integer>vertexIndex

Identical to setFaceVertexIndex but works on handles for patches.

<integer> faceIndex - Index of the face you want work on.

<integer> ithVertex - The ith vertex that you want to manipulate.

<integer> vertexIndex - The index into the vertex list that you want to set to.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <void><Unwrap_UVW>.setFaceInteriorIndex <integer>faceIndex <integer>ithVertex <integer>vertexIndex

Identical to setFaceVertexIndex but works on interior handles for patches.

<integer> faceIndex - Index of the face you want work on.

<integer> ithVertex - The ith vertex that you want to manipulate.

<integer> vertexIndex - The index into the vertex list that you want to set to.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <void><Unwrap_UVW>.forceUpdate <boolean>update

This sets a flag to determines how Unwrap will behave when a topology change occurs.

If update is TRUE the mapping gets reset, otherwise unwrap skips mapping the object if it has a different topology. It is sometimes useful to turn this off if you have MeshSmooth or other topology changing modifiers below Unwrap that have different topologies when rendering.

<boolean>update - Determines whether the mapping is reset on topology change.

Exposed via unwrap interface in 3ds Max 4 and higher.

NoteNormally, when the user changes the topology, Unwrap resets the mapping. If the forceUpdate is set to true then the mapping will not be reset, but you can't edit/see any mapping that makes sense. This flag is for advance users that want to lock a mapping and then set the topology back down for maximized viewport speed.

    <void><Unwrap_UVW>.getFaceSelectionFromStack()

Updates the Unwrap_UVW modifier to accept anyface selectioncoming from the modifier stack.

For example, create a sphere, add a MeshSelect modifier, add an Unwrap_UVW modifier. Go to Face Sub-Object level of Unwrap_UVW - there is no selection. Go down to MeshSelect and select some faces. Go back to Unwrap_UVW - there is still no face selection. Call this function and the MeshSelect face selection will be accepted by the Unwrap_UVW modifier.

Exposed via unwrap interface in 3ds Max 4 and higher.

## Number Of ...

Methods:

    <integer><Unwrap_UVW>.NumberVertices()

Returns the number of texture vertices.

Exposed via unwrap interface in 3ds Max 4 and higher.

    <integer><Unwrap_UVW>.numberPolygons()

Returns the number of polygons in the object.

Exposed via unwrap interface in 3ds Max 4 and higher.

## By-Node Topology Methods

The following methods are available in 3ds Max 2008 and higher.

The Unwrap_UVW modifier in 3ds Max 2008 and higher supports multiple scene objects when applied as an instance.

The unwrap6 interface re-exposes some methods which used to be available in the Unwrap_UVW modifier, but this time it provides an additional argument to specify the node to operate on.

Methods:

    <integer><Unwrap_UVW>.numberVerticesByNode <node>node

Returns the number of map vertices in the Unwrap_UVW modifier corresponding to the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <bitArray><Unwrap_UVW>.getSelectedPolygonsByNode <node>node

Returns the number of selected polygons corresponding to the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.selectPolygonsByNode <bitArray>selection <node>node

Selects the polygons corresponding to the given node defined by the bitarray value.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <boolean><Unwrap_UVW>.isPolygonSelectedByNode <integer>index <node>node

Returns true of the indexed polygon of the given node is selected in the Unwrap_UVW modifier, false if not selected.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <integer><Unwrap_UVW>.numberPolygonsByNode <node>node

Returns the number of polygons in the Unwrap_UVW modifier corresponding to the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.markAsDeadByNode <integer>index <node>node

Marks the indexed vertex in the given node as dead.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <integer><Unwrap_UVW>.numberPointsInFaceByNode <integer>index <node>node

Returns the number of points in the indexed face of the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <integer><Unwrap_UVW>.getVertexIndexFromFaceByNode <integer>faceIndex <integer>ithVertex <node>node

Returns the vertex index of the i-th vertex of the indexed face of the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <integer><Unwrap_UVW>.getHandleIndexFromFaceByNode <integer>faceIndex <integer>ithVertex <node>node

Returns the handle index of the i-th vertex of the indexed face of the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <integer><Unwrap_UVW>.getVertexGeomIndexFromFaceByNode <integer>faceIndex <integer>ithVertex <node>node

Returns the index of the geometry vertex corresponding to the i-th vertex of the indexed face of the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <integer><Unwrap_UVW>.getHandleGeomIndexFromFaceByNode <integer>faceIndex <integer>ithVertex <node>node

Returns the handle of the geometry vertex corresponding to the i-th vertex of the indexed face of the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <integer><Unwrap_UVW>.getInteriorGeomIndexFromFaceByNode <integer>faceIndex <integer>ithVertex <node>node

Returns the interior geometry vertex index corresponding to the i-th vertex of the indexed face of the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setFaceVertexByNode <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel <node>node

Sets the position of the i-th vertex of the indexed face in the given node.

If the 4 th parameter is passed as true, the vertex will also be selected.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setFaceHandleByNode <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel <node>node

Sets thehandleposition of the i-th vertex of the indexed face in the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setFaceInteriorByNode <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel <node>node

Sets the interior position of the i-th vertex of the indexed face in the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setFaceVertexIndexByNode <integer>faceIndex <integer>ithVertex <integer>vertexIndex <node>node

Sets the vertex index of the i-th vertex of the indexed face in the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setFaceHandleIndexByNode <integer>faceIndex <integer>ithVertex <integer>vertexIndex <node>node

Sets the handle handle index of the i-th vertex of the indexed face in the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setFaceInteriorIndexByNode <integer>faceIndex <integer>ithVertex <integer>vertexIndex <node>node

Sets the face interior index of the i-th vertex of the indexed face in the given node.

    <void><Unwrap_UVW>.getAreaByNode <bitArray>faceSelection <&float>areaUVW <&float>areaGeom <node>node

    areaUVW is Out parameter
    areaGeom is Out parameter

Gets the map faces area and the geometry faces area of the faces specified by the bitArray in the given node.

The results are written into the two by-reference variables areaUVW and areaGeom .

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.getAreaByNode <bitArray>faceSelection <&float>x <&float>y <&float>width <&float>height <node>node

    x is Out parameter
    y is Out parameter
    width is Out parameter
    height is Out parameter

Gets the upper left corner, the width and the height of the faces specified by the bitArray in the given node.

The results are written into the four by-reference variables x, y, width and height .

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <bitArray><Unwrap_UVW>.getPeltSelectedSeamsByNode <node>node

Returns a bitarray of the selected seams for pelting in the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setPeltSelectedSeamsByNode <bitArray>selection <node>node

Sets the selected seams for pelting in the given node to the given bitArray.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.selectPolygonsUpdateByNode <bitArray>selection <boolean>update <node>node

Selects the faces supplied by the bitArray in the given node.

When update is given as true, updates the selection display. This selection method gives you an option to not update the view if you are doing lots of face processing.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.sketchByNode <int array>indexList <point3 array>positionList <node>node

Sketches UV coordinates of the given node using the supplied index list array and the position list array.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <point3><Unwrap_UVW>.getNormalByNode <integer>faceIndex <node>node

Returns the normal of the indexed face in the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

### Get and Set Vertex Position and Weight

    <point3><Unwrap_UVW>.GetVertexPositionByNode <time>time <integer>index <node>node

Returns the position of the indexed map vertex of the node given by the third argument at the time given by the first argument.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setVertexPositionByNode <time>time <integer>index <point3>pos <node>node

Sets the position of the indexed map vertex of the node given by the fourth argument at the time given by the first argument to the position specified by the third argument.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setVertexPosition2ByNode <time>time <integer>index <point3>pos <boolean>hold <boolean>update <node>node

An extended version of the setVertexPosition method with control over Holding and Updating.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <float><Unwrap_UVW>.getVertexWeightByNode <integer>index <node>node

Returns the Vertex Weight of the specified vertex in the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setVertexWeightByNode <integer>index <float>weight <node>node

Sets the Vertex Weight of the specified vertex in the given node to the value defined by the second argument.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <boolean><Unwrap_UVW>.isWeightModifiedByNode <integer>index <node>node

Returns true if the weight of the indexed vertex in the given node has been modified, false otherwise.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.modifyWeightByNode <integer>index <boolean>modify <node>node

Sets the modified flag of the indexed vertex in the given node to the Boolean value provided by the second argument.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

### Get and Set Selection

    <bitArray><Unwrap_UVW>.getSelectedVerticesByNode <node>node

Returns a bitarray with the map vertices selected in the Unwrap_UVW modifier and corresponding to the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.selectVerticesByNode <bitArray>selection <node>node

Selects the map vertices in the Unwrap_UVW modifier and corresponding to the given node, based on the provided bitarray.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <boolean><Unwrap_UVW>.isVertexSelectedByNode <integer>index <node>node

Returns true if the indexed map vertex is selected, false otherwise.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <bitArray><Unwrap_UVW>.getSelectedFacesByNode <node>node

Returns a bitarray with the faces selected in the Unwrap_UVW modifier and corresponding to the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.selectFacesByNode <bitArray>selection <node>node

Selects the faces in the Unwrap_UVW modifier and corresponding to the given node, based on the provided bitarray.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <boolean><Unwrap_UVW>.isFaceSelectedByNode <integer>index <node>node

Returns true if the indexed face is selected, false otherwise.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <bitArray><Unwrap_UVW>.getSelectedEdgesByNode <node>node

Returns a bitarray with themap edgesselected in the Unwrap_UVW modifier and corresponding to the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.selectEdgesByNode <bitArray>selection <node>node

Selects the map edges in the Unwrap_UVW modifier and corresponding to the given node, based on the provided bitarray.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <boolean><Unwrap_UVW>.isEdgeSelectedByNode <integer>index <node>node

Returns true if the indexed map edge is selected, false otherwise.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <bitArray><Unwrap_UVW>.getSelectedGeomVertsByNode <node>node

Returns a bitarray with the geometry vertices selected in the Unwrap_UVW modifier and corresponding to the given node.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setSelectedGeomVertsByNode <bitArray>selection <node>node

Selects the vertices in the Unwrap_UVW modifier and corresponding to the given node, based on the provided bitarray.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <bitArray><Unwrap_UVW>.getSelectedGeomEdgesByNode <node>node

Selects the geometry edges in the Unwrap_UVW modifier and corresponding to the given node, based on the provided bitarray.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.

    <void><Unwrap_UVW>.setSelectedGeomEdgesByNode <bitArray>selection <node>node

Selects the geometry edges in the Unwrap_UVW modifier and corresponding to the given node, based on the provided bitarray.

Exposed via unwrap6 interface in 3ds Max 2008 and higher.