v5.0
Returns the X3DObject object to
which the project item belongs. This property can be very useful
when dealing with cluster properties and other objects that are
buried deep in a 3DObject hierarchy.
Note: This property cannot be used within the Update function of a
CustomOperator.
// get accessor X3DObject rtn = ProjectItem.Parent3DObject; |
' ' 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 |
/*
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
|