Using subcompositions inside of other compositions

If you find yourself copying and pasting the same group of nodes and cables into many compositions, you may want to turn those nodes and cables into a subcomposition. A subcomposition is a composition that can be used as a node inside of other compositions. A subcomposition saves you the effort of having to recreate the same nodes and cables over and over. They’re packaged neatly inside a node, which you can drag from the Node Library onto your canvas just like any other node.

Let’s walk through an example. Suppose you often draw hemispheres (half spheres) in your 3D compositions, and it would be convenient to have a Make Hemisphere node in your Node Library. The first step is to identify the nodes and cables that you want to package into a subcomposition.

The composition above renders two rotating hemispheres to a window. (The Trim 3D Object node cuts off half of the sphere. The Show Back of 3D Object node makes the inside of the sphere visible.)

In other compositions, you may want to create any number of hemispheres. The hemispheres could have different rotations, positions, sizes, and colors. They could be rendered to a window or an image. So, for the subcomposition, let’s choose a piece of the composition that’s flexible enough to be used in all of these scenarios: the nodes and cables tinted magenta.

New in Vuo 2.0

To turn these nodes and cables into a subcomposition, select them, then right-click on them and go to Package as Subcomposition.

This extracts the selected part of the composition into a new window, where you’re asked to pick a name for the subcomposition.

Having named the subcomposition, you now have two windows: one with the subcomposition and one with the original composition, in which the selected part has been replaced with a subcomposition node.

In the original composition, the nodes and cables outside of the selected part (which was packaged into a subcomposition) connected to the selected part at three points of contact:

When the selected part was packaged into a subcomposition, these three points of contact became published input and output ports within the Make Hemisphere subcomposition. Correspondingly, they became input and output ports on the Make Hemisphere node.

Now that you have a Make Hemisphere node available, you can search for it in the Node Library and add more instances of it to your composition.

Making a subcomposition available to other compositions


Which other compositions can access a subcomposition

Package as Subcomposition installs the subcomposition in a Composition-Local Library. This makes the subcomposition appear in the Node Library only when the composition it came from (or another composition in the same folder) is open. If you want the subcomposition to appear in the Node Library for all compositions, click on the subcomposition window and go to File > Move to User Library.

For an explanation of Composition-Local and User Library folders, see Installing a node.