PDA

View Full Version : Adding Strings Help


LGABoarder
08-25-2009, 09:49 PM
I'm looking to add a bunch of strings together to form a key or legend of elements in my project. The names(strings) of each object are added together with Math:Add which sets the text parameter of a Text Object. The problem is that this forms a run-on sentence, eg: "Cone Sphere Cube" rather than a paragraph of names eg:
Cone
Sphere
Cube

Is there anyway to separate each string on its own line? Perhaps the Math:Add node isn't the best choice? Thanks for the help!

Srek
08-26-2009, 06:42 AM
You will need to add a linebrake. The Math:Add node can't know if you want a new line or not, it will just connect the strings you give to it.
Cheers
Björn

LGABoarder
08-26-2009, 02:15 PM
So is that just a symbol that tells the math node to break that would be added to a new input port? Or are you suggesting that the math node is the incorrect node to use altogether because I need linebreaks?

I've tried adding all the linebreaks I know (<br/>, \r, BLANK, etc.) to input nodes and nothing seemed to work but I may be misunderstanding.

Thanks Srek!

Srek
08-26-2009, 02:35 PM
Change the input box of the string field in a math node to multiline string and just press enter in it. Then you have your Linebreak
Cheers
Björn

LGABoarder
08-26-2009, 02:56 PM
Hmm, I just dove into 10.5 and 11 and there doesn't seem to be a multiline string function? Another option I guess is to use the COFFEE node but again it comes down to, is there a coffee code that will insert a line break? Sorry if I'm missing something here.

Edit: Figured out a solution with the COFFEE node, line break code is /r so this script seems to work
main()
{
Output1 = "Input1" +"\r" + "Input2" +"\r" + "Input3";
}

tcastudios
08-26-2009, 10:58 PM
A linebreak is expressed as "\n".

Use that in your example and it works. And skip the quotes
on you Input1 etc as they are already strings.
(The in- and output ports must be of String type).


Cheers
Lennart

CGTalk Moderation
08-26-2009, 10:58 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.