ClusterNonOverlapEnforcement
 
 
 

ClusterNonOverlapEnforcement

Description

Resolves the ambiguity when clusters overlap in a context of a given property type (e.g.: material). This command is used primarily by ApplyShader.

It either removes the overlap from the selected clusters, from the existing clusters, or simply lets the overlap happen.

Scripting Syntax

oReturn = ClusterNonOverlapEnforcement( InputObjs, Property, ActionWhenLocalMaterialsOverlap );

Return Value

Returns an XSICollection containing the clusters found to be overlapping with the target cluster(s).

Parameters

Parameter Type Description
InputObjs String List of clusters (probably selected) against which all clusters will be tested for overlapping.

Default Value: Current selection

Property String Example of a property the existing clusters must have in order to be tested.
ActionWhenLocalMaterialsOverlap siActionWhenLocalMaterialsOverlap What to do with the clusters found to be overlapping with the target cluster(s).

Default Value: siRemoveFromSelectedClusters

Examples

VBScript Example

' The following example demonstrates how to use ClusterNonOverlapEnforcement to resolve conflicts
' when clusters with a given type of property (eg: material) overlaps.
' The example is not really a good one because ApplyShader already does all this internally
' let's create a grid
NewScene
CreatePrim "Grid", "MeshSurface"
' now lets make the four corners red
ActivateRaycastPolySelTool
SelectGeometryComponents "grid.poly[0]"
AddToSelection "grid.poly[0,1,8,9]", , True
AddToSelection "grid.poly[48,49,56,57]", , True
AddToSelection "grid.poly[6,7,14,15]", , True
AddToSelection "grid.poly[54,55,62,LAST]", , True
set l_Shader = ApplyShader
SetValue "grid.polymsh.cls.Polygon.Material.Phong.diffuse.red", 1
SetValue "grid.polymsh.cls.Polygon.Material.Phong.diffuse.green", 0
SetValue "grid.polymsh.cls.Polygon.Material.Phong.diffuse.blue", 0
SetDisplayMode "Views.ViewA.TopCamera", "shaded"
' to make the remaining polygons green lets simply select
' all the polygons and use ClusterNonOverlapEnforcement with
' siRemoveFromSelectedClusters to not override the corners
SelectAllUsingFilter "Polygon", siCheckComponentVisibility
set l_Cluster = CreateCluster
ClusterNonOverlapEnforcement l_Cluster, "grid.polymsh.cls.Polygon.Material", siRemoveFromSelectedClusters
ApplyShader
SetValue "grid.polymsh.cls.Polygon1.Material.Phong.diffuse.red", 0
SetValue "grid.polymsh.cls.Polygon1.Material.Phong.diffuse.green", 1
SetValue "grid.polymsh.cls.Polygon1.Material.Phong.diffuse.blue", 0
' now to make the 4 polygons blue in the center
' lets use ClusterNonOverlapEnforcement this time with siRemoveFromExistingClusters
SelectGeometryComponents "grid.poly[27,28,35,36]"
set l_Cluster = CreateCluster
ClusterNonOverlapEnforcement l_Cluster, "grid.polymsh.cls.Polygon.Material", siRemoveFromExistingClusters
ApplyShader
SetValue "grid.polymsh.cls.Polygon2.Material.Phong.diffuse.red", 0
SetValue "grid.polymsh.cls.Polygon2.Material.Phong.diffuse.green", 0
SetValue "grid.polymsh.cls.Polygon2.Material.Phong.diffuse.blue", 1
DeselectAll

See Also

ApplyShader