Property.Singleton operator

Description

Returns True if only one object of this type is allowed on its parent

C# Syntax

// get accessor
Boolean rtn = Property.Singleton;

Examples

1. VBScript Example

'VBScript example showing how the Material Property is a singleton 
set oRoot = application.activeproject.activescene.root
set oGroup = oRoot.addgroup()
set oMaterial = oGroup.AddMaterial("Phong")
if oMaterial.Singleton then
	logmessage "Only one material is allowed per object"
else
	logmessage "Multiple materials are allowed on an object"
end if
'Output of this script:
'INFO : "Only one material is allowed per object"

2. VBScript Example

'VBScript example showing Singleton and Branch values properties of an object
newscene ,false
set oSphere = ActiveSceneRoot.AddGeometry( "Sphere","MeshSurface")
'There are already default properties on any X3DObject, and we can also 
'add another
oSphere.AddProperty "CustomProperty",, "MyCustomParam"
logmessage "Properties of " & oSphere
for each oProp in oSphere.Properties
	logmessage vbTab & oProp.Name & vbLf & _
		vbTab & vbTab & "Singleton: " & oProp.Singleton & vbLf & _
		vbTab & vbTab & "Branch: " & oProp.Branch
next
'Output of this script:
'INFO : "Property info on sphere"
'INFO : "	Kinematics
'		Singleton: False
'		Branch: False"
'INFO : "	Visibility
'		Singleton: True
'		Branch: False"
'INFO : "	Ambient Lighting
'		Singleton: True
'		Branch: True"
'INFO : "	Scene_Material
'		Singleton: True
'		Branch: True"
'INFO : "	Geometry Approximation
'		Singleton: True
'		Branch: True"
'INFO : "	Display
'		Singleton: True
'		Branch: True"
'INFO : "	MyCustomParam
'		Singleton: False
'		Branch: False"

See Also

siBranchFlag SceneItem.Properties SceneItem.LocalProperties Scene.Properties XSIProject.Properties