X3DObject.FindChildren

廃止

v9.0 (2011) -- 「X3DObject.FindChildren2」を参照

説明

検索基準に一致する X3DObject オブジェクトの子の X3DObject をすべて検索します。デフォルトでは、検索は再帰的に行われます。関数は、基準(名前、タイプ、およびファミリ)を満たすオブジェクトをすべて戻します。このメソッドは一般的に、3d オブジェクトからなるシーンを階層的に移動する際に使用します。

指定された Model の下の X3DObject の子をすべて取得するには(すべての X3DObject 内にネストされているもの、X3DObject の子として関連付けられているものを含む)、引数を指定せずにこのメソッドを呼び出します。シーン内のすべてのX3DObjectオブジェクトを取得する場合は、FindObjectsを使用する方が効率的です。

C#構文

X3DObjectCollection X3DObject.FindChildren( Object in_varName, String in_pbstrType, Object in_famArray, Boolean in_bRecursive );

スクリプト構文

oReturn = X3DObject.FindChildren( [Name], [Type], [Family], [Recursive] );

戻り値

X3DObjectCollection

パラメータ

パラメータ タイプ 説明
Name String または CollectionItem 名前表現または CollectionItem。表現にはワイルドカード文字を含めることもできます。
Type String siType で定義されているオブジェクトのタイプ。タイプを使用しない場合は空の文字列になります。タイプには、特定の x3DObject タイプ(siModelType、si3DObjectType など)とプリミティブタイプ(siPolyMeshType、siSrfMeshPrimType など)があります。プリミティブタイプを指定した場合は、このタイプのプリミティブが定義されている子オブジェクトのみが関数の対象になります。有効なタイプを以下に示します。

指定可能な値:

説明:

si3DObjectType 3D Object タイプ
siArcPrimType Implicit Arc Primitive タイプ
siAttractorCtrlType Attractor Control Object タイプ(電気力)
siCameraPrimType Camera Primitive タイプ
siCameraRootPrimType Camera Root primitive タイプ
siChainBonePrimType Chain Bone Primitive タイプ
siChainEffPrimType Chain End Effector Primitive タイプ
siChainRootPrimType Chain Root Primitive タイプ
siCirclePrimType Implicit Circle Primitive タイプ
siCloudPrimType Cloud Primitive タイプ
siConePrimType Cone Primitive タイプ
siCrvListAggregatePrimType NURBS Curve List Aggregate Primitive タイプ
siCrvListPrimType NURBS Curve List Primitive タイプ
siCubePrimType Cube Primitive タイプ
siCylinderPrimType Cylinder Primitive タイプ
siDiscPrimType Disc Primitive タイプ
siDodecahedronPrimType Dodecahedron Primitive タイプ
siDragCtrlPrimType Drag Control Primitive タイプ
siEddyCtrlPrimType Eddy Control Primitive タイプ
siFanType Fan Force Object タイプ
siFurPrimType Fur Primitive タイプ
siGeoShaderPrimType GeoShader Primitive タイプ
siGravityCtrlType Gravity Force Control Object タイプ
siGridPrimType Grid Primitive タイプ
siIcosahedronPrimType Icosahedron Primitive タイプ
siLatticePrimType Lattice Primitive タイプ
siLightPrimType Light Primitive タイプ
siModelNullPrimType Model Null Primitive タイプ
siModelType 3D Model タイプ
siNullPrimType Null Primitive タイプ
siOctahedronPrimType Octahedron Primitive タイプ
siPolyMeshType Polygon Mesh タイプ
siSpherePrimType Sphere Primitive タイプ
siSpiralPrimType Implicit Spiral Primitive タイプ
siSpotInterestPrimType Spot Interest Primitive タイプ
siSpotRootPrimType Spot Root Primitive タイプ
siSquarePrimType Implicit Square Primitive タイプ
siSrfMeshPrimType NURBS Surface Mesh Primitive タイプ
siTetrahedronPrimType Tetrahedron Primitive タイプ
siTorusPrimType Torus Primitive タイプ
siTurbulenceCtrlPrimType Turbulence Control Primitive タイプ
siVolumeDeformType Volume Deform タイプ(インプリシット球のボリューム)
siVortexCtrlType Vortex Control Object タイプ(磁力)
siWaveCtrlType Wave Control Object タイプ
siWindType Wind Force Object タイプ
Family siFamily または siFamily エレメントの Array siFamily で定義されているファミリの配列、必要ない場合は空の配列。ファミリを使用して検索を絞り込みます。配列には、X3DObject ファミリ(si3DObjectFamily など)やプリミティブファミリ(siNurbsSurfaceMeshFamily、siNullPrimitiveFamily など)があります。指定されたファミリに一致する子オブジェクトだけが処理されます。プリミティブファミリを指定した場合は、そのファミリのいずれかに属するプリミティブが定義されているオブジェクトのみが対象になります。有効なファミリを以下に示します。

指定可能な値:

説明:

si3DObjectFamily 3D Object ファミリ
siCameraFamily Camera ファミリ
siChainElementFamily Chain Element ファミリ
siControlObjectFamily Control Object ファミリ
siCurveFamily Curve Geometry ファミリ
siGeometryFamily Geometry ファミリ
siGeometryShaderFamily Geometry Shader ファミリ
siImplicitGeometryFamily Implicit Geometry ファミリ
siLatticeFamily Lattice ファミリ
siLightPrimitiveFamily Light Primitive ファミリ
siMeshFamily Mesh Geometry ファミリ
siNullPrimitiveFamily Null Primitive ファミリ
siNurbsCurveListFamily Nurbs CurveList Geometry ファミリ
siNurbsSurfaceMeshFamily Nurbs Surface Mesh Geometry ファミリ
siSurfaceCurveFamily Surface Curve Geometry ファミリ
siSurfaceFamily Surface Geometry ファミリ
Recursive Boolean True の場合は、再帰的に検索します。False の場合は、直接の子について検索します。この再帰検索では、オブジェクトの下にネストされている任意の X3DObject の内容も検索されます。

デフォルト値: True

1. VBScript の例

NewScene , false

set oRoot = Application.ActiveProject.ActiveScene.Root

oRoot.AddGeometry "Sphere", "MeshSurface", "mySphere"

oRoot.AddGeometry "Cone", "MeshSurface", "myCone"

oRoot.AddGeometry "Cone", "MeshSurface", "anotherCone" 

oRoot.AddGeometry "Cube", "NurbsSurface", "myCube"

Application.LogMessage "** 1: Find all objects whose names start with 'Camera' **"

set kids = oRoot.FindChildren( "Camera*" )

for each pip in kids

	Application.LogMessage( "Found child: " & pip.Name )

next

Application.LogMessage "** 2: Find all objects of type siLightPrimType **"

set kids = oRoot.FindChildren( , siLightPrimType )

for each pip in kids

	Application.LogMessage( "Found child: " & pip.Name )

next

Application.LogMessage "** 3: Find all objects that belong to siNullPrimitiveFamily and siMeshFamily families **"

set kids = oRoot.FindChildren( , , Array( siNullPrimitiveFamily, siMeshFamily ) )

for each pip in kids

	Application.LogMessage( "Found child: " & pip.Name )

next

Application.LogMessage "** 4: Find all objects whose names start with 'my' and belong to siMeshFamily family **"

set kids = oRoot.FindChildren( "my*", , Array(siMeshFamily) )	

for each pip in kids

	Application.LogMessage( "Found child: " & pip.Name )

next

' Expected results:

'INFO : ** 1: Find all objects whose names start with 'Camera' **

'INFO : Found child: Camera_Root

'INFO : Found child: Camera

'INFO : Found child: Camera_Interest

'INFO : ** 2: Find all objects of type siLightPrimType **

'INFO : Found child: light

'INFO : ** 3: Find all objects that belong to siNullPrimitiveFamily and siMeshFamily families **

'INFO : Found child: Camera_Root

'INFO : Found child: Camera_Interest

'INFO : Found child: mySphere

'INFO : Found child: myCone

'INFO : Found child: anotherCone

'INFO : ** 4: Find all objects whose names start with 'my' and belong to siMeshFamily family **

'INFO : Found child: mySphere

'INFO : Found child: myCone

2. JScript の例

/*

	Compare this example with the similar example for X3DObject.Children

*/

// Create a sample scene

NewScene( null, false );

var oNull = Application.ActiveSceneRoot.AddNull( "MyNull" );

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

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

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

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

// FindChildren can be more powerful than X3DObject.Children because by default it will 

// recurse through the graph finding all nested children.

PrintChildren( "FindChildren of SceneRoot:", Application.ActiveSceneRoot.FindChildren() ) ;

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

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

//Expected Results:

//INFO : FindChildren of SceneRoot

//INFO :		Camera_Root

//INFO :		Camera

//INFO :		Camera_Interest

//INFO :		light

//INFO :		MyNull

//INFO :		NestedNull

//INFO :		MySphere

//INFO :		MyModel

//INFO :		MyModel.ConeInMdl

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

//INFO : FindChildren of Null

//INFO :		NestedNull

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

//INFO : FindChildren 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.Children X3DObject.FindChild EnumElements