sverchok icon indicating copy to clipboard operation
sverchok copied to clipboard

Deal with empty lists in List Mask Join (In) inputs

Open ArpegorPSGH opened this issue 2 years ago • 6 comments

Sometimes, the List Mask Join (In) node can be used to switch between empty lists and non empty ones, in order to make sure no empty list get to the rest of the treatment (especially for the Loop In node). In this case, the chosen data with the mask is of course that of the non-empty lists, but the node outputs nothing when choice option is checked because of the match length option. So, I suggest to modify the node to make it compatible with this usage, as deactivating the choice option works the same way only when there is one list in each input (whatever its level of nesting).

ArpegorPSGH avatar Sep 22 '22 11:09 ArpegorPSGH

It seems Switch can do this

image

Durman avatar Sep 22 '22 12:09 Durman

Yeah, probably because there is no length matching. However, it only works on 2-level data, whereas I work with 1-level data, and any nesting level should be considered. That means there is a solution for 1-level and 2-level nested data, but no further.

ArpegorPSGH avatar Sep 22 '22 14:09 ArpegorPSGH

It seems List Mask Join node works too even with other dimensions.

image

Durman avatar Sep 23 '22 04:09 Durman

Okay, it works, but without checking choice option, the behaviour is different. Although it works fine in my case, it may not always be the case, as it is just a corner case not intended by the node designer.

ArpegorPSGH avatar Sep 23 '22 07:09 ArpegorPSGH

If it works I don't see the problem.

Durman avatar Sep 23 '22 09:09 Durman

It works in this particular case, but if you use an arbitrary number of non-empty lists, it won't behave as wished anymore, but as intended by the node designer. In my case, I use only one list in each input, so it is fine, but I just say this solution isn't neat as it is making use of a corner case of the node, not intended to be used, so it might be broken with further development. So, ideally, this issue should be formally addressed.

ArpegorPSGH avatar Sep 23 '22 10:09 ArpegorPSGH