Multi-Lists
In Nodebox you can group paths and geometries, but nothing else. You can't group points or strings or numbers or colors. Any subnetwork you make will output a single list of items, even if those items come in different flavors or categories that you might later wish to distinguish.
Hence, the multi-list, which is not just a new node, but a whole new way of dealing with lists.
The multi_list node looks and works like a combine node. It has seven list ports. You can feed lists to any of these ports; you can leave gaps if you like or even feed in other multi-list nodes.
The first list it sees will be list 0, the next: list 1, and so forth. If you need more than 7 lists just feed a subset into one multi_list node and feed that into another multi-list node. You can build a whole tree of multi-lists if you want, but in any case the final multi_list node will contain 0 to n lists in the order in which they were received.
The output of the multi-list node is actually just a table with two columns: multi-list number and multi-list item. To recover a particular list from a multi-list, just filter this table. For your convenience, I also provide a multi_switch node in the demo that takes a multi-list and a list number and outputs the desired list no matter how many different lists are in the multi-list.
The fact that a multi-list is actually just a table also means that you can easily save it as a CSV file - and load it in later just as easily.
MULTI-LISTS AND COMBINE NODES
You can use multi_list and combine nodes together in two different ways: you can feed combine nodes into a multi-list, or feed multi_list nodes into a combine node. These have different effects.
Lists in Nodebox are generally homogeneous, that is, all of the same type: all points or all colors, etc. But by using a combine node you can create heterogeneous lists. For example, by feeding a list of strings, a list of numbers, and a list of colors into a single combine node, you will produce a single heterogeneous list which consists of all three types of object, one after another.
If you then feed that combine node into one port of a multi_list node, you can associate them together as a single heterogeneous list. You can feed other combine nodes into other ports of the same multi_list node to create a multi-list of different heterogeneous lists: heterogeneous list 0, heterogeneous list 1, etc. In this way you could, for example, produce a single multi-list that contains metadata (name, phone number, color code, etc.) about 7 different people.
Feeding multiple multi_list nodes into a single combine node is entirely different.
If you feed nothing but multi-lists into a combine node, the result will be a single multi-list containing a mixture of those lists. All items in list 0 of multi-list A will be combined with all list 0 items in multi-list B; the same thing with list 1 items from A and list 1 items from B, and so forth. You could use this to turn two multi-lists with five homogeneous lists each into a single multi-list with five heterogeneous lists.
The total number of lists in this combined multi-list will be equal to the maximum number of lists in whatever multi-lists were originally combined. So if you combine two multi-lists with 5 lists each with a third multi-list containing 7 lists, the combined multi-list will have 7 lists; lists 0-4 will be a mix from all three multi-lists, while lists 5 and 6 will only come from the last multi-list.
NOTE: the lists in such a combined multi-list will not be entirely sorted by list number as they normally are. This does not affect the functionality. If you feed that combined multi-list into yet another multi-list node, the lists will once again be fully sorted by list number.
In order for a combine node to be used in this way, ALL lists fed into that combine node must be multi-lists. If you feed ANYTHING OTHER THAN A MULTI-LIST into one port of that combine node, the output will just be a big heterogeneous list and will NOT be recognized as a multi-list.
To summarize: feed combine nodes into a multi_list node to add heterogeneous lists. Feed multi-lists into a combine node to mix multi-lists together. Feed multi-lists into a multi_list node to create a multi-list with more than seven lists.
DEMOS
I have just posted one demo which shows a nice use case for multi-lists, my identify node: http://support.nodebox.net/discussions/show-your-work/883-identify-...
This demo shows a display of ten data types, each with its own representation and label. To do this I created a multi-list with TEN lists, one for each data type. Each of those ten lists is a heterogenous list consisting of one or more examples of each type (e.g. 6 points) followed by a geometry storing a visual representation of those objects. For each list I use a combine node to combine the objects with their representation, feed five of those combine nodes into a multi_list node, then feed that and another five combine nodes into a second multi_list node.
I can then feed that final multi-list into several other nodes downstream which separate out the representations and use the identify node to supply labels for each one. Multi-lists allow for a cleaner, easier to maintain structure.
I have included a second demo here (screenshot and zip file attached).
This demo is an homage to the famous Robert Indiana LOVE sculpture (done in Verdana font so everyone here can see it). It creates four groups of points, one for the L, one for the tilted O, one for the V and one for the E.
These are all just ordinary points, so I can have thousands of them without bogging things down. The multi_list node allows me to do something I couldn't otherwise do: arrange them into four different groups. I use a delete node to separate the points belonging to each letter, then simply feed each list of points into a separate input node of the multi_list1 node. This gives me a single list containing four sub-lists of points.
I then take a heart-shaped magnifying glass and place that over part of the display to create a region which can then be magnified and replaced with more complex objects. To facilitate this I create a SECOND multi-list, this one containing four HETEROGENEOUS lists. I use combine nodes to place the points from each letter which fall within the magnifying glass, preceded by its colored letter textpath. All of that goes into multi_list2.
I can then feed that single multi-list into my magnify subnetwork, which turns each point into a colored dot with a letter label inside. This magnified region is displayed to the right of the main display.
This demo produces a still image, but you could easily move the heart magnifying glass around to produce a movie. I posted a fancier version of this on my Instagram account, which you can see here: https://www.instagram.com/p/DGA5KYHpLDM/
In addition to allowing a much simpler an easier to maintain network, this use of multi-list makes things more efficient. I could create a hundred thousand individual color dots each with its own label and then zoom into that, but that would start to bog things down and increase render times. Creating a hundred thousand points, though, and then only fully visualizing the magnified ones, makes everything go faster.
This and the identify node demo show two possible use cases. I see many more which I hope to share in future posts here on the forum.
I am particularly curious to see what you all do with this new capability. Please enjoy and share!
-
multi-list_screenshot.png 1.54 MB
- love_multi-list_demo.ndbx.zip 46.5 KB
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac