Jump to content
defc0n1

String parsing in Font SOP

Recommended Posts

Hi guys

I'm relatively new to Houdini, and I've been trying to make this little digital asset. Basically what I need is to set the 'Number Of Copies' integer field of a duplicate SOP to the number of RETURN characters in the text field of a Font SOP. Is this even possible? I can do this easily in C++ but I can't get the syntax right in Houdini and I don't know how to assign it to the current field for which I'm writing the expression. I tried using the foreach() loop on the text field, but I can't figure out how to do the string comparison. Please help.

Thanks!

Share this post


Link to post
Share on other sites
`chs("../duplicate1/ncy")`

Be careful of back-ticks, needed to evaluate the expression.

An easy way is to a right-click on channel you want to copy and paste into the text field of Font SOP.

Share this post


Link to post
Share on other sites

I think you didn't quite understand my question. Let me clear the confusion - I want to SET the number of copies AS the number of return characters in the text field of the Font SOP. Not the other way around.

Share this post


Link to post
Share on other sites
2 minutes ago, defc0n1 said:

I think you didn't quite understand my question. Let me clear the confusion - I want to SET the number of copies AS the number of return characters in the text field of the Font SOP. Not the other way around.

Indeed, i misunderstood your question.

Strange approach, on my side, i would make an integer parameter on my sop/hda/null, then put it in font sop and duplicate node.

How do you access to text field to enter your number ?

Share this post


Link to post
Share on other sites

Yeah sorry about that. It really is a weird request. I can access the text field using ch("../font/text") but I was hoping I could do like a for loop to iterate through the characters and find the number of RETURNs in it. Basically the situation is that I need a progress bar sort of a thing (using a grid) for every line in the Font SOP. For example, if I have 4 lines, the duplicate SOP duplicates the grid 4 times.

Edited by defc0n1
typo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×