Property.Singleton operator

説明

1 種 1 オブジェクトのみを親にリンクできる(シングルトンである)場合は True を戻します。

C#構文

// get accessor

Boolean rtn = Property.Singleton;

1. VBScript の例

'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 の例

'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"

関連項目

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