main() ;
function main()
{
NewScene( null, false );
var oRoot = Application.ActiveSceneRoot;
// Stick all the x3dobjects in the current scene into a model
var oModel = oRoot.AddModel( oRoot.Children, "TopModel" );
// Create two models, each of which contain a Null and nest them inside the TopModel.
oNull = oRoot.AddNull( "mynull");
oModel.AddModel( oNull, "SubModel" );
oNull2 = oRoot.AddNull( "mynull" );
oModel.AddModel( oNull2, "AnotherSubModel" );
WriteModels( oRoot ) ;
}
function WriteModels( in_obj )
{
var mdls = in_obj.Models;
n = mdls.Count;
for ( var i=0; i<n; i++ ) {
m = mdls.Item(i);
Application.LogMessage( "Model " + m.Name + " is nested inside " + m.model ) ;
}
}
// Expected results:
//INFO : Model TopModel is nested inside Scene_Root
//INFO : Model SubModel is nested inside TopModel
//INFO : Model AnotherSubModel is nested inside TopModel
|