# CollectScenes

Builds a scene by bundling multiple input scenes together, each under their own root location. Instead of using an array of inputs like the Group node, a single input is used instead, and a Context Variable is provided so that a different hierarchy can be generated under each root location. This is especially powerful for building dynamic scenes where the number of inputs is not known prior to building the node graph.

Since merging globals from multiple scenes often doesn’t make sense, the output globals are taken directly from the scene corresponding to rootNames[0].

## user

Container for user-defined plugs. Nodes should never make their own plugs here, so users are free to do as they wish.

## out

The processed output scene.

## enabled

The on/off state of the node. When it is off, the node outputs the input scene unchanged.

The input scene

## rootNames

The paths to the root locations to create in the output scene. The input scene is copied underneath each of these root locations.

Often the rootNames will be driven by an expression that generates a dynamic number of root locations, perhaps by querying an asset management system or listing cache files on disk.

## rootNameVariable

The name of a Context Variable that is set to the current root location when evaluating the input scene. This can be used in upstream expressions and string substitutions to generate a different hierarchy under each root location.

## sourceRoot

Specifies the root of the subtree to be copied from the input scene. The default value causes the whole scene to be collected.

The rootName variable may be used in expressions and string substitutions for this plug, allowing different subtrees to be collected for each root location in the output.

Tip

By specifying a leaf location as the root, it is possible to collect single objects from the input scene.

## mergeGlobals

Controls how the output globals are generated from the collected scenes. By default, the globals from the first scene alone are passed through. When mergeGlobals is on, the globals from all collected scenes are merged, with the last scene winning in the case of multiple scenes specifying the same global.