ProjectItem.Parent3DObject

導入

v5.0

詳細

プロジェクト項目が属する X3DObject オブジェクトを戻します。このプロパティは、クラスタプロパティや 3DObject 階層の深い位置にあるその他のオブジェクトを処理するときに便利です。

注:このプロパティは、CustomOperatorUpdate 関数では使用できません。

C#構文

// get accessor

X3DObject rtn = ProjectItem.Parent3DObject;

1. VBScript の例

'

' Demonstrating how the Parent3DObject property can be used

'

NewScene , false

set oRoot = Application.ActiveProject.ActiveScene.Root

set oModel = oRoot.AddModel( , "Sally" )

set oNull = oModel.AddNull

set oNull1 = oNull.AddNull

Application.LogMessage oNull1.Name & " is a child of the object " & oNull1.Parent3DObject

Application.LogMessage TypeName( oRoot.Parent3DObject )

Application.LogMessage oModel.Parent3DObject

Application.LogMessage oNull.Parent3DObject

Application.LogMessage oNull.Kinematics.Parent3DObject

' Expected Result:

'INFO : null1 is a child of the object Sally.null

'INFO : Nothing

'INFO : Scene_Root

'INFO : Sally

'INFO : Sally.null

2. JScript の例

/*

	The Parent3DObject property can be very useful when dealing with cluster properties or

	other objects that are buried deep in a hierarchy. 

*/

NewScene( null, false );

var oModel = Application.ActiveSceneRoot.AddModel();

oModel.Name = "MyModel";

var obj = oModel.AddGeometry( "Cube", "MeshSurface" );

// Add a textured image to the polygon mesh 

BlendInTextureLayers( "Image", obj, 1, true, siReplaceAndNoBlendInTextureLayers );

obj.ActivePrimitive.Geometry.AddCluster( siSampledPointCluster, "TextureCluster" );

GenerateUniqueUVs( obj, "TextureProperty" );

SetInstanceDataValue( obj, obj.Material + ".Phong.Image.tspace_id", "TextureProperty" );

// Get at the uv property

var oUVProperty = Dictionary.GetObject( obj + ".polymsh.cls.TextureCluster.TextureProperty" );

// Which 3dobject does the UVProperty belong to?

var o3DObject = oUVProperty.Parent3DObject;

Application.LogMessage( "UV Property belongs to : " + o3DObject.FullName );

// Expected Result:

//INFO : UV Property belongs to : MyModel.cube