How can I ignoring empty text layers on render?

In the attached example composition how would you have the Arrange Layers in Column ignore a Make Text Layer if it’s empty (blank)? Currently because the Make Text Layeris set to 90pt font it renders the row as a 90pt high row. What I’m looking for is that it acts as if Row 2 isn’t even there if it contains no text and renders Row 1 and Row 3 right on top of each other, see attached image below. In my actual composition there are more text rows and some layers have different fonts and colours.

Vuo Text columns.png

Multiple Row Stack.vuo (3.81 KB)

Use the Process List node to collect the text into a list. As a bonus, you’ll get a tidier approach to the whole comp as well :)

This will depend on how you generate your text to begin with though as any open spaces in the list still will generate a split. I’ve included one possible option in the comp, but this will have to be adapted to your use case.

Multiple Row Stack_processList.vuo (3.34 KB)

Use the Process List node to collect the text into a list. As a bonus, you’ll get a tidier approach to the whole comp as well :)

Thanks Magneson (@MartinusMagneson) but I’m not sure I understand how that would work to use different fonts and colours for the different rows as mentioned above. In my original comp I have several sources for the text strings, I just left the Make Text Layerportion for the attached comp to simplify the example. In the original comp a barcode (data matrix) is read which generates some of the text strings used and also calls some other information from an XML file (that is provided to me) which generates the other portions of the text I need rendered. I have a subcomp I use to break the long text strings into smaller word chunks operating them into different rows. All of the sources are positioned on various layers for rendering to a window. The problem is that it will render all rows even if they contain no text so I end up with large gaps between my blocks of text. I would like to find a way to remove the empty rows from the final render.

OK, Magneson I just noticed the Process List can retain Font and formatting as part of the list so that’s something to keep in mind in the future.

I ended up solving my issue just now by using a Select Input (Boolean) and to only passthrough the text into the Arrange Layers in Column node if text was present. This gave me the formatting control I needed and prevented empty rows from making it into the list. I’ll try playing around with your method a little more once I have more time, I think using it with the Append Texts node may help me get the result I’m looking for. Thanks for your help.  

2 Likes

Yup, by using the “Append Text” node, you can collect everything into a long string from different sources, and then use the “Split Text” node to separate it into a list of texts based on a separating character (“:” for instance). That character may be added in the XML, or by using the “Append Text” node for other sources. “Split Text” might also be able to “ignore empty” iirc, cutting out the empties if there are any. I.e. if using : as separator, a :: text list entry will not be made I think, but a : : will as it contains a space which is a character in itself (looks empty but isn’t technically).

To clarify the formatting a bit; when making a text layer it will apply the style formatting to the text and create an image (in a broad sense). Making a text (as in "Append Text) is only a string, so that won’t have style info attached. So in the composition I attached previously you process a list of text (strings) into a list of layers (images). If you process a list of text by attaching or adding something to the text instead, you’d end up with a list of strings that wouldn’t have any style info attached. That can again be processed into a list of layers though.

2 Likes

Mmm yeah don’t know why Make Text Layer outputs a layer with no text, if it’s a bug or if it’s the desired behavior that can be helpful in some cases.

• You can either yes use a boolean like you did, probably something “Multiple Row Stack 1.1”

• Or based on Martinus idea to use Split Text but without Process List if you don’t want to, you can directly make use of the “Include Empty Parts” set to “False” and this will block the text (use a split character that you’re sure won’t appear in your text strings). See “Multiple Row Stack 1.2”

So for possible future improvement either Make Text Layer could have a “Ignore empty texts” port, or a new node like “Remove Empty List Values” could be great, something that would shrink a list only to its non-empty elements (maybe part of More list nodes — sort, find occurrences of an item, remove duplicates ?)

Capture d’écran 2019-04-25 à 00.16.38.png  

Multiple Row Stack 1.1.vuo (5.82 KB)

Multiple Row Stack 1.2.vuo (5.35 KB)

And if you wanna use Process List and still have font styles yes you can for example do something like this

Multiple Row Stack 1.3.vuo (4.63 KB)

Multiple Row Stack 1.4.vuo (4.28 KB)

Great information, I’ll definitely keep this advice available if I go back to streamline my composition. Thanks!