Getting the contents of docked views

I was recently asked whether it’s possible to find docked FxTree views and figure out 1) what specific tree is loaded, and 2) what nodes are selected in the Fx tree.

You can find docked Fx Tree views, but unfortunately there’s no way to find out what’s in that view.
Here’s a Python snippet that finds docked Fx Tree views:

# Find docked Fx Tree views
oVM = Application.Desktop.ActiveLayout.Views.Filter( "View Manager" )
oFxTreeViews = oVM(0).Views.Filter( "Fx Tree" )

for view in oFxTreeViews:
    Application.LogMessage(view.Name+": "+view.Type)

In the XSI SDK, you use attributes to access the contents of a view, and there are no attributes defined for Fx Tree views.

For example, here’s how it works for an ICE Tree view:

# Find docked ICE Tree views
oVM = Application.Desktop.ActiveLayout.Views.Filter( "View Manager" )
oICETreeViews = oVM(0).Views.Filter( "ICE Tree" )

# Get the ICE tree that is loaded into the view
Application.LogMessage( oICETreeViews(0).GetAttributeValue( "container" ) );

# Get the selected nodes in the ICE tree
Application.LogMessage( oICETreeViews(0).GetAttributeValue( "selection" ) );