» Subpatches
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

Subpatches

Mandarin | French | Russian | Italian

Introduction

Graphical programming tends to create huge and complex structures, which may look very beautiful some times, but if you are continuously working on a patch, you are likely to discover the advantages of subpatches sooner or later:

With a Subpatch, you can put a complete window (i.e. patch) full of nodes into one node. After that you are free to use that node in exactly the same way as you use the built-in nodes. You can store these subpatches to disk and use them all over again.

Creating a Subpatch is extremely easy. Strictly speaking, if you already created a patch, you have already created also a subpatch. To understand this, we have to take one step back and learn something more about the architecture of vvvv:

The Root Patch

If you select Show Root (ALT+R) from the main menu, you will see the root patch window of vvvv. It is the outermost subpatch of all. A super node so to say: Root

Window Modes

It is a very important architectural feature of vvvv that these nodes in the root patch and the patch windows are intrinsically the same.

Principally nodes can be displayed in four flavours: Windowed, Hidden, Boxed or Full Screen.

Almost all of the built-in nodes of vvvv like LFO, +, Damper, Quad etc. are always hidden - you just have the node representation and nothing else.

The built-in Render Nodes like the Renderer (EX9 or the Renderer (GDI) have an associated window. They default to the Windowed mode and you can switch them to all four modes by using the menu and keyboards commands.

Hidden<br>Alt+3<br>Only node visible
Windowed<br>Alt+1<br>Node with separate window
Boxed<br>Alt+2<br>Node as box, containingthe window
Full Screen<br>Alt+Enter<br>Window visible full screen
The key point in understanding the Subpatch concept is that all patches are also nodes.

When working, you usually encounter only the windows of the patches and don’t see the node. On the other side it is perfectly possible to select the node in the root patch and switch it to any of the four modes.

In boxed mode you can put patches into other patches. This can be very helpful if you want to prepare complex user interfaces, as you can hide everything but the important IOBoxes from your view.

Subpatches

Having said all that, a Subpatch is now nothing special at all: It is just a node containg a patch.

You create a new subpatch with CTRL+SHIFT+P, its good practice to save the new subpatch after creation in a folder called subpatches besides your main patch. You can also use existing patches as subpatches by dragging them onto another patch or open it with CTRL+SHIFT+O.

The term Subpatch describes only a specific point of view, as is ParentPatch: this means viewing the other way:
example:

Patch1 contains Patch2.
seen from Patch1: Patch2 is a Subpatch
seen from Patch2: Patch1 is the ParentPatch
Take care when working with a Subpatch - There is an important distinction between closing and hiding the window. If you hide the window (ALT+3), the patch will be still part of the system and continue working. If you close the window (CTRL+W), the patch will be removed from the system by deleting the node which it contains. So when you just want to close the window, use hide; when you want to remove the patch, use close.

Parameters

One aspect is still missing: How can we transmit data to and from the subpatch?

This is done in the patch with IOBoxes -- Usually you use IOBoxes as interface elements to change or display values. A very simple trick will make them parameters to the patch: As soon as you enter a string in the Descriptive Name (this is a configuration pin, so it will only appear in the Inspektor), the IOBox is working as a parameter. In case you do connect something downwards, it will work as an input parameter, and as soon as you connect something upwards, it will work as an output parameter. That’s basically all to know. Ah, except that you can use a middle-mouse-click on a connected IOBox to autoname it with the connected pins name.

IOBoxes which have been given a descriptive name have their name attached as a grey text box.

The above patch for example publishes two parameters: One input pin with the name get new and one output pin called kitchenboy of the week. Therefore this patch can be used in other patches as follows:

The Left-to-Right order of the parameter pins in the node is dependant on the x coordinate of the IOBoxes in the patch. You will notice that if you move the IOBoxes in the patch, the pins of the corresponding node will change their position.

Deepness

Another important feature of vvvv is that all patches with the same name are fundamentally the same. If you open the same patch multiple times and change something in one patch, you will notice, that the changes also occur in all other patches at the same time. This will happen to all value changes, and also to all changes in the patch. This is a very powerful feature for prototyping, as you can basically work on any level of detail while seeing all results in the full running system.

The values coming from the parameter pins and therefore the calculated results within a patch are separate in each instance of a subpatch. So each Subpatch can process different data.

Relative Paths

You can use relative or absolute paths to address your subpatches. If you use relative paths, they are always seen as relative to the directory of the parent patch. The advantage is that you can move your whole project freely on your hard disk without having to care about any missing files. Obviously you have to take care that you move all parts at the same time, but the patches don’t need to be touched at all.

There is one important caveat: If you save your patch to a different directory, you will need to take care, as vvvv will now assume all files relative to that new directory. You have to make sure, that all files do also exist relative to that new directory. Therefore a warning does appear, which will ask you to accept that behaviour.

Nesting

A Subpatch of course can contain other Subpatches (which contain other Subpatches...) as well....

anonymous user login

Shoutbox

~57min ago

u7angel: @mediadog, make it a forum question.

~59min ago

u7angel: @mediadog, tty renderer ?

~3h ago

microdee: however non-conductive objects are invisible for this so the pencil and the sticks in the video are still a mysteries

~3h ago

microdee: hey i just found a possible solution behind leap's black magic http://www.quora.com/Leap-Motion/What-is-the-technology-behind-Leap-Motion

~4h ago

mediadog: @u7agel: red node, no connections; can' drag&drop into patch either - 27.2

~8h ago

christosk: Thanx Elliot! UnixPath worked fine :-)

~8h ago

elliotwoods: or 'unix path' (for forward slash). also custom deliminators are accepted on other pins

~8h ago

elliotwoods: @christosk : check for 'dos path'

~9h ago

christosk: What's the node to use in order to separate elements inside a string by using slashes? Separate doesn't give a Slash enumeration.

~12h ago

metrowave: vvvv not loading, it says 'no DLLs were found in the waterfall procedure' to do with error at loading ippSP library. any ideas?