NewScene(null);
// Create a 1X1 grid. Such geometry only have 4 sampled points: 0,1,2,3.
oGrid = CreatePrim("Grid", "MeshSurface", null, null);
SetValue("grid.polymsh.geom.subdivu", 1, null);
SetValue("grid.polymsh.geom.subdivv", 1, null);
// Add a sampled point cluster covering all sampled points. By passing an
// explicit array, it will create a cluster which is not always complete.
oCluster = oGrid.ActivePrimitive.Geometry.AddCluster( siSampledPointCluster,"NonCompleteCluster",Array(0,1,2,3));
logmessage("Is cluster " + oCluster + " complete? " + (oCluster.IsAlwaysComplete() ? "yes" : "no"));
// Add a sampled point cluster covering all sampled points. By passing no
// explicit array, it will create a cluster which is always complete.
oCompleteCluster = oGrid.ActivePrimitive.Geometry.AddCluster( siSampledPointCluster,"CompleteCluster" );
logmessage("Is cluster " + oCompleteCluster + " complete? " + (oCompleteCluster.IsAlwaysComplete() ? "yes" : "no"));
try
{
oProperty = oCluster.AddProperty("Texture Projection", false, "UV Property");
}
catch( e )
{
logmessage("Error; can't add a UV cluster property on cluster" + oCluster);
}
oProperty = oCompleteCluster.AddProperty("Texture Projection", false, "UV Property");
logmessage("UV cluster property " + oProperty + " was added to complete cluster " + oCompleteCluster);
// The output of this script is:
//
//INFO : Is cluster grid.polymsh.cls.NonCompleteCluster complete? no
//INFO : Is cluster grid.polymsh.cls.CompleteCluster complete? yes
//ERROR : 2000 - The cluster property could not cannot be added. This type of cluster property requires the parent cluster to be always complete. See "AddProperty" method reference for more information about this.
//INFO : Error; can't add a UV cluster property on clustergrid.polymsh.cls.NonCompleteCluster
//INFO : UV cluster property grid.polymsh.cls.CompleteCluster.UV_Property was added to complete cluster grid.polymsh.cls.CompleteCluster
|