X3DObject.Children

X3DObject.Children

説明

このオブジェクトの子である、すべての X3DObject を含む X3DObjectCollection を戻します。再帰的検索は行われません。言い換えれば、直接の子のみ戻され、子の子は戻されません。

C#構文

// get accessor

X3DObjectCollection rtn = X3DObject.Children;

1. VBScript の例

set oRoot = Application.ActiveProject.ActiveScene.Root

oRoot.AddGeometry "Sphere", "MeshSurface"

oRoot.AddNull

for each oChild in oRoot.Children

	Application.LogMessage oChild.Name & ", " & oChild.Type

next

' Expected results:

'INFO : Camera_Root, CameraRoot

'INFO : light, light

'INFO : sphere, polymsh

'INFO : null, null

2. JScript の例

/*

	Compare this example with the similar example 

	for X3DObject.FindChildren

*/

// Create a sample scene

NewScene( null, false ) ;

var oRoot = Application.ActiveSceneRoot;

var oNull = oRoot.AddNull( "MyNull" ) ;

var oSphere = oRoot.AddGeometry( "Sphere", "MeshSurface", "MySphere" ) ;

var oNestedSphere = oNull.AddNull( "NestedNull" ) ;

var oConeInModel = oRoot.AddGeometry( "Cone", "NurbsSurface", "ConeInMdl" ) ;

var oModel = oRoot.AddModel(oConeInModel, "MyModel") ;

// The X3DObject.Children collection returns all X3DObjects 

// but it is not recursive.

PrintChildren( "Children of SceneRoot:", oRoot.Children ) ;

PrintChildren( "Children of Null:", oNull.Children ) ;

PrintChildren( "Children of Model:", oModel.Children ) ;

// Expected result:

//INFO : Children of SceneRoot:

//INFO :		Camera_Root

//INFO :		light

//INFO :		MyNull

//INFO :		MySphere

//INFO :		MyModel

//INFO : ----------------------------

//INFO : Children of Null:

//INFO :		NestedNull

//INFO : ----------------------------

//INFO : Children of Model:

//INFO :		MyModel.ConeInMdl

//INFO : ----------------------------

// Helper function showing the contents of a collection

function PrintChildren( in_msg, in_oChildren )

{

	Application.LogMessage( in_msg ) ;

	for ( var i=0 ; i<in_oChildren.Count; i++ ) {

		Application.LogMessage( "\t" + in_oChildren.Item(i).FullName ) ;

	}

	Application.LogMessage( "----------------------------" ) ;

}

関連項目

X3DObject.FindChildren X3DObject.FindChildren2 X3DObject.FindChild X3DObject.FindChild2 EnumElements