Meshop General Mapping Methods

 

   

Editable Mesh - Quick Navigation

The following methods provide general access to the Mapping channels, the mapping vertices and faces.

Topic Navigation:  

Number Of Map Channels

Map Channel Support

Number Of Map Vertices And Faces

Color Per Vertex_(Channel_0)

Default Texture Mapping Channel (Channel 1)

Build Map Faces

Apply Mapping

Map Vertices And Faces Access

Get A Using B

Vertex And Face Color And Alpha

Isolated Map Vertices

Delete Map Vertices

Free Map Vertices And Faces

Topic Navigation:

Methods:

Number Of Map Channels

meshop.setNumMaps <Mesh mesh> <int count> keep:<bool1ean=false>

Sets the number of map channels available. The number of map channels can be set from 2 to 100. Map channels 1 and 2 are the Vertex Color and default Texture Map channels. If keep: is false , the old mapping information is discarded. If true , the old mapping information is retained after the resize.

   

meshop.getNumMaps <Mesh mesh>

Returns the number of map channels available as aninteger.

   

Map Channel Support

meshop.setMapSupport <Mesh mesh> <Integer mapChannel> <Boolean support>

Sets whether the specified mapping channel is supported or not. If support is true , and the channel support state is currently false , a new map face array of the same size as the number of faces in the mesh is allocated, but no map vertex array is allocated. If support is false , and the channel support state is currently true , existing map channel face and vertex arrays are deallocated. If support and the current channel support state are both the same, no action is performed. SetNumMaps() is automatically called if the specified map channel is not available.

mapChannel index values are 0-based, with Map channels 0 and 1 being the Vertex Color and default Texture Map channels.

   

meshop.getMapSupport <Mesh mesh> <Integer mapChannel>

Returns whether the specified map channel is supported. This signifies that a map face arrayis present, but not necessarily a map vertex array.

   

Number Of Map Vertices And Faces

meshop.setNumMapVerts <Mesh mesh> <Integer mapChannel> <Integer count> keep:<boolean=FALSE>

Sets the number of vertices for the map channel, initializing the map vertex array. If keep: is false or not specified, the old map vertex information is discarded. If true , the old map vertex information is retained after the resize.

   

meshop.getNumMapVerts <Mesh mesh> <Integer mapChannel>

Returns the number of vertices for the map channel as an <integer>.

   

meshop.setNumMapFaces <Mesh mesh> <Integer mapChannel> <Integer count> keep:<boolean=false> keepCount:<int=0>

Sets the number of faces for the map channel. If keep: is false or not specified, the old map face information is discarded. If true , the old map face information from the number of faces specified by keepCount: is retained after the resize. Dangerous to use with map channels 0 and 1, so miminummapChannelvalue is 2.

   

meshop.getNumMapFaces <Mesh mesh> <Integer mapChannel>

Returns the number of faces for the map channel as an <integer>.

   

Color per vertex channel (Channel 0)

meshop.getNumCPVVerts <Mesh mesh>

Returns the number of Color Per Vertex mapping channel vertices.

   

meshop.setNumCPVVerts <Mesh mesh> <int>

Sets the number of Color Per Vertex mapping channel vertices.

   

Default texture mapping channel (Channel 1)

meshop.getNumTVerts <Mesh mesh>

Returns the number of Default Texture mapping channel vertices.

   

meshop.setNumTVerts <Mesh mesh> <int>

Sets the number of Default Texture mapping channel vertices.

   

Build Map Faces

meshop.buildMapFaces <Mesh mesh> <Integer mapChannel> <Boolean keep>

Sets the number of map faces to the number of mesh faces, retaining existing mapping data if keep is true. Deletes any map vertices that are not used by the map faces.

   

meshop.defaultMapFaces <Mesh mesh> <Integer mapChannel>

Sets the number of map faces to the number of mesh faces, and the number of map vertices to the number of mesh vertices. The map face vertices are set to the same vertex index as the corresponding mesh face vertices (i.e., there will be a 1-to-1 correspondence between map faces/vertices and the mesh faces/vertices). The map vertex UVW coordinates are set to the normalized (0 to 1) position of the corresponding mesh vertex in the mesh's bounding box.

   

Apply Mapping

meshop.makeMapPlanar <Mesh mesh> <Integer mapChannel>

Applies a simple planar mapping to the specified channel. This is done by copying the mesh topology and vertex locations into the map, resizing the face and vertex arrays if necessary.

   

meshop.applyUVWMap <TriMesh mesh> {#planar | #cylindrical | #spherical | #ball | #box> | #face} \
utile:<float=1.0> vtile:<float=1.0> wtile:<float=1.0> uflip:<boolean=false> vflip:<boolean=false> wflip:<boolean=false> cap:<boolean=true> tm:<Matrix3=identity matrix> channel:<int=1>

Applies the specified mapping type to the mapping channel.

utile/vtile/wtile - Number of tiles in the U/V/W directions.

uflip/vflip/wflip - U/V/W are mirrored if true .

cap - used with #cylindrical . If true , then any face normal that is pointing more vertically than horizontally will be mapped using planar coordinates.

tm - defines the mapping space. As each point is mapped, it is multiplied by this matrix, and then it is mapped.

channel - the mapping channel the mapping is applied to, defaults to channel 1.

   

Map Vertices And Faces Access

meshop.setMapVert <Mesh mesh> <Integer mapChannel> <Integer index> <Point3 xyz>

Sets the coordinates of the specified map vertex.

See Accessing the Viewport Vertex Alpha Values for some more details.

   

meshop.getMapVert <Mesh mesh> <Integer mapChannel> <Integer index>

Returns the coordinates of the specified map vertex as a <point3>.

See Accessing the Viewport Vertex Alpha Values for some more details.

   

meshop.setMapFace <Mesh mesh> <Integer mapChannel> <Integer index> <Point3 face>

Sets the map vertices for the specified map face.

   

meshop.getMapFace <Mesh mesh> <Integer mapChannel> <Integer index>

Returns the vertices of the specified map face as a <point3>.

   

Get A Using B

meshop.getMapFacesUsingMapVert <Mesh mesh> <int mapChannel> <mapVertlist>

Returns a bitarray of size=(#map faces for channel inmesh) with bits set for all map faces that use the specified map vertices.

See splitMeshByUVElements script in the FAQ for example usage.

   

meshop.getMapVertsUsingMapFace <Mesh mesh> <int mapChannel> <mapFacelist>

Returns a bitarray of size=(#map vertices for channel inmesh) with bits set for all map vertices that use the specified map faces.

See splitMeshByUVElements script in the FAQ for example usage.

   

Vertex And Face Color And Alpha

meshop.setFaceAlpha <Mesh mesh> <int mapChannel> <facelist> <float alpha>

For the specified map channel, sets the map vertex color to value between 0 (transparent) and 1 (opaque) for the map vertices used by the map faces associated with the specified faces.

   

meshop.setFaceColor <Mesh mesh> <int mapChannel> <facelist> <color color>

For the specified map channel, sets the map vertex color to <color> for the map vertices used by the map faces associated with the specified faces.

   

meshop.setVertAlpha <Mesh mesh> <intmapChannel> <vertlist> <float alpha>

For the specified map channel, sets the map vertex color to a value between 0 (transparent) and 1 (opaque) for the map vertices associated with the specified mesh vertices.

See Accessing the Viewport Vertex Alpha Values for some more details.

   

meshop.setVertColor <Mesh mesh> <int mapChannel> <vertlist> <color color>

For the specified map channel, sets the map vertex color to <color> for the specified map vertices.

   

Isolated Map Vertices

meshop.getIsoMapVerts <Mesh mesh> <Integer mapChannel>

Returns a <bitarray> with a bit set for each isolated map vertex (unreferenced by any map face) for the specified channel.

   

meshop.deleteIsoMapVertsAll <Mesh mesh>

For all mapping channels, deletes all mapping vertices that are not used by a mapping face.

   

Delete Map Vertices

meshop.deleteMapVertSet <Mesh mesh> <Integer mapChannel> {<BitArray set> | <Integer index> | <integer array>}

Deletes the specified map vertices. Returns a <bitarray> with a bit set for each map face that used one of the deleted map vertices. Normally, you should delete or modify the map faces using the map vertices before deleting the map vertices, as after the vertex deletion you can't tell which vertex on a face was a vertex that was deleted.

   

Free Map Vertices And Faces

meshop.freeMapVerts <Mesh mesh> <Integer mapChannel>

Deallocates the map vertex array and sets the number of map vertices to 0.

   

meshop.freeMapFaces <Mesh mesh> <Integer mapChannel>

Deallocates the map face array and sets the number of map faces to 0.

   

meshop.freeMapChannel <Mesh mesh> <int mapChannel>

Deletes the map vertex and face arrays for the specified channel, and sets their count to 0.

   

For more mesh-related methods, see

Editable Mesh - Topics Index

Editable_Mesh : GeometryClass and TriMesh : Value

See Also