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:
yes.
The naming of IsDefaultSpread
should be IsVVVVDefaultSpread
though
</joreg>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.