## PolygonMesh.VertexColors

### Introduced

v3.0

### Description

Returns a ClusterPropertyCollection containing each vertex color ClusterProperty objects installed on this PolygonMesh.

### C# Syntax

    // get accessor

    ClusterPropertyCollection rtn = PolygonMesh.VertexColors;

### Examples

#### JScript Example

    // create scene with sphere

    NewScene( null, false );

    CreatePrim("Sphere", "MeshSurface", null, null);

    // get selected elements from scene

    if ( Selection.count == 0 ) {

    	LogMessage( "Nothing selected", siError );

    } else {

    	var objs = Selection;

    	// get selected meshes from selection list

    	var meshes = SIFilter( objs, "polygon_mesh", true, siQuickSearch );

    	if ( !meshes ) {

    		LogMessage( "No polygon meshes selected", siError );

    	}

    	// add 4 vertex color properties to each mesh

    	for ( var i = 0; i < objs.count; i++ ) {

    		// get current mesh (type : "polyMsh")

    		var obj = objs( i );

    		// get obj material

    		var mat = obj.Material;

    		// if material is not local add one

    		if ( mat.IsA(siSharedPSet) ) {

    			mat = obj.AddMaterial();

    		}

    		// get polygon mesh geometry

    		var polymesh = obj.ActivePrimitive.Geometry;

    		for ( var j = 0; j < 4; j++ ) {

    			polymesh.AddVertexColor();

    		}

    	}

    	// list all vertex colors installed on polygon meshes

    	for ( var i = 0; i < objs.count; i++ ) {

    		// get current mesh (type : "polyMsh")

    		var obj = objs( i );

    		// get polygon mesh geometry

    		var polymesh = obj.ActivePrimitive.Geometry;

    		var vertexcolors = polymesh.VertexColors;

    		LogMessage( vertexcolors.Count );

    		for ( var j = 0; j < vertexcolors.Count; j++ )

    		{

    			var vertexcolor = vertexcolors(j);

    			LogMessage( vertexcolor.fullname );

    		}

    	}

    }

    //

### See Also

PolygonMesh.AddVertexColor PolygonMesh.CurrentVertexColor