Default empty spread

In VL if I create an input pin of type Spread(MyObject) by default it contains 1 slice of that object. Is there any way to set a default of 0 slices?

The default value of spread is the empty spread - so I can’t really follow. Maybe you can post a little screenshot or patch even?
Or do you mean from vvvv to VL?

Yes this particular process is connected to vvvv, is there any way to make it default to empty spread in that case?

this is introduced by the vvvv pin. with c# you can do safeguarding like this

   public static bool IsAnyInvalid(this ISpread spread)
                if (spread == null) return true;
                if (spread.SliceCount == 0 || spread[0] == null) return true;

                return false;

on vl, IsAssigned does the null check


@velcrome I’m not totally sure how to apply this to VL process. Can you do this from inside the VL editor UI?

Hi @Tobyk,
You’re creating an input pin in VL. So the vvvv node isn’t connected to anything at this point but it has a single value (for example a spread of float input would put a single float of “0.00” in the pin by default). I think that you need to either
a) connect something to the node in vvvv. If its an emptyset in the logic of you vvvv patch it will be an emptyset in VL too. or
b) you could use ‘Spread:Clear’ with the apply pin (right-click the node to configure it) and setup acondition in which not to apply the clear node. I’ll send a picture later

Hi @Hadasi

What I’m trying to do is get an emptyset as the default input, eg when nothing is connected in vvvv.

The clear approach would work if there was a way to detect if the pin is connected.

I suppose to reword my question: Is there any way to set vvvv pin defaults from VL for spreads or datatypes that are not primitives?

I would be surprised if there is a way to do so, because the same problem has been around forever. if you look around in vvvv, you will NEVER find a node that has an empty pin by default. If you have an unconnected “node” pin, it will try to provide a default (for example the unity matrix for Transforms). This works well for primitives and structs, but seems to regularily fail for classes (for example Message).

That’s why I went straight to tell you how to detect “invalid” input, where the spread is correct, but the object inside is not properly initialized (i.e. null).

Anyway, I attached a pic to my other post.

@velcrome ok cool it’s a limitation. I’ll work with such a method then.

It is how velcrome explained it. The default for vvvv is a spread of length one. You’ll therefor have to check the first entry of that spread. Here is a little example of how it could be done:

MyRecord with a little helper operation:

And how it would be applied in the vvvv/VL node:



The naming of IsDefaultSpread should be IsVVVVDefaultSpread though


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.