Project Tree Management

The new IProjectTree61 interface gives the client access to all of the objects and elements in a project through the Project Tree structure. Client applications can control the appearance of the tree (i.e. expand groups, move items from one group to another etc.), delete single entries or entire groups from the tree and add their own content to it.

Create and modify groups

Using the IProjectTree61 interface you can create new groups in the project. You can create regular groups or locked groups under the root area or any other group in the tree. Using the IProjectTree61 interface you can also modify existing groups (i.e. expand or collapse a group using the IProjectTree61::ExpandGroup() method)

Find and modify objects in a project

One of the most important capabilities of the IProjectTree61 interface is to provide a means of traversing the TerraExplorer Information Tree. This, in conjunction with other features, is a very powerful tool that can be used to achieve many different goals. For example, the client can traverse the tree and change the color for all or a subset of the objects. You can also use this method to present the project’s content in another format. Traversing the tree might also be used to search items in the project that match a set of criteria (i.e. all the models that are in a certain area on the terrain). You can even delete objects from the project using the IProjectTree61::DeleteItem() method.

 

var node = SGWorld.ProjectTree.GetNextItem(group, 11); // code 11 get the first child in the group

while (node > 0)

{

var object = SGWorld.ProjectTree.GetObject(node);

              // Here you can perform operation on the object ...

                node = SGWorld.ProjectTree.GetNextItem(node, 13); // code 13 gets the next sibling

}