Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Multi paragraph text in .str files

 Post Reply Post Reply
Author
Message
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 300
Post Options Post Options   Quote peterakos Quote  Post ReplyReply Direct Link To This Post Topic: Multi paragraph text in .str files
    Posted: 2016 Oct 21 at 5:12am

User Information:

Cinema 4D Version:   R18 
Platform:   Windows  ;   
Language(s):     C++  ;   

---------

Hello.

Can I have a text paragraph as STATICTEXT in a NodeData plugin ?
I have tried using \n but it doesn't work.

Thank you.
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1497
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2016 Oct 24 at 1:57am
Hi,

in your resource file you'd use a STRING with CUSTOMGUI MULTISTRING. Additionally add the READONLY flag to mimic the static text behavior.
Like so:
STRING MY_PARAGRAPH { ANIM OFF; CUSTOMGUI MULTISTRING; WORDWRAP; READONLY; }

Inside of the string you can use the pipe symbol ("|") for newline.

Cheers,
Andreas
SDK Support Engineer
Back to Top
RenatoT View Drop Down
Member
Member


Joined: 2004 Nov 03
Location: Italy
Online Status: Offline
Posts: 449
Post Options Post Options   Quote RenatoT Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 10 at 6:53pm
Hi all,

Andreas, is still valid the pipe symbol for the newline?

Thanks in advance
Renato

Edited by RenatoT - 2017 Aug 10 at 6:54pm
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1497
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 11 at 2:17am
Hi Renato,

I'm not aware of any changes on our end. But as you are asking, you are probably having problems with it?
Cheers,
Andreas
SDK Support Engineer
Back to Top
RenatoT View Drop Down
Member
Member


Joined: 2004 Nov 03
Location: Italy
Online Status: Offline
Posts: 449
Post Options Post Options   Quote RenatoT Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 11 at 9:21am
Hi Andreas,

yes, i'm trying to output some lines to:
STRING MY_TEXT_INFO { ANIM OFF; CUSTOMGUI MULTISTRING; WORDWRAP; READONLY; }

adding the Pipe Symbol.. but the output is with pipe instead a newline:

here the example:
Grid Name: density - Grid Class: unknown | Grid Name: temperature - Grid Class: unknown | Grid Name: v - Grid Class: unknown |

would be good to have:
Grid Name: density - Grid Class: unknown
Grid Name: temperature - Grid Class: unknown
Grid Name: v - Grid Class: unknown


Edited by RenatoT - 2017 Aug 11 at 9:22am
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2549
Post Options Post Options   Quote NiklasR Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 11 at 6:07pm
If you create the string in your code, you need to use
actual newlines.
Back to Top
RenatoT View Drop Down
Member
Member


Joined: 2004 Nov 03
Location: Italy
Online Status: Offline
Posts: 449
Post Options Post Options   Quote RenatoT Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 11 at 7:49pm
Hi Niklas, what do you mean with "actual newline" ?
I tried to construct my string with '\n' without luck.
Back to Top
RenatoT View Drop Down
Member
Member


Joined: 2004 Nov 03
Location: Italy
Online Status: Offline
Posts: 449
Post Options Post Options   Quote RenatoT Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 12 at 5:59pm
I'm sorry... but maybe too hot in the brain.

Thanks all for your time :)
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1497
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 14 at 8:49am
Hi,

just for future readers, as it might not be completely clear: When setting a multi-line string parameter via code, one needs to use newline '\n' to add additional lines. While in the string file it is the pipe symbol '|'.

I will add this information also to one of the code examples.

Cheers,
Andreas
SDK Support Engineer
Back to Top
RenatoT View Drop Down
Member
Member


Joined: 2004 Nov 03
Location: Italy
Online Status: Offline
Posts: 449
Post Options Post Options   Quote RenatoT Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 14 at 9:57am
Thanks Andreas :)
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2549
Post Options Post Options   Quote NiklasR Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 25 at 11:56am
I was just giving this a try in a c4d_strings.str stringtable. I get the string with the Pipe symbol still in
the text (using GeLoadString in Python), rather than it being replaced by a newline. Does this only work
in C++ or in description/dialog stringtables?

Thanks!


Edited by NiklasR - 2017 Aug 25 at 11:57am
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1497
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 29 at 8:20am
Hi Niklas,

indeed GeLoadString() does not care for line wraps, neither in C++ nor in Python.
A small helper function could look like this:
static String GeLoadStringUpd(Int32 id)
{
Int32 i;
String str = GeLoadString(id);
for (i = str.GetLength() - 1; i >= 0; i--)
{
if (str[i] == '|')
{
str.Delete(i, 1);
str.Insert(i, GeGetLineEnd());
}
}
return str;
}

Cheers,
Andreas
SDK Support Engineer
Back to Top
Klaus Heyne View Drop Down
Member
Member
Avatar

Joined: 2003 Jan 28
Location: Germany
Online Status: Offline
Posts: 286
Post Options Post Options   Quote Klaus Heyne Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Aug 30 at 2:31am
for me, \u000d works to create a line break in a str file.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.