Set Font Text from Vex - Render Alphabet

   9015   11   2
User Avatar
Member
604 posts
Joined: July 2013
Online
I can create a detail attribute from this:

string alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
s@letter = alphabet[int(@Frame - 1)];

…and there is a ‘text’ parameter for the Font SOP node.

How can I change the ‘text’ parameter on the Font SOP node in Vex? I'm pretty sure I've seen this done before in a tutorial video somewhere.

My goal is to render each letter of the alphabet into a separate image.
Houdini Indie
Karma/Redshift 3D
User Avatar
Member
604 posts
Joined: July 2013
Online
Looks like the Font SOP or ForEach looping has changed since H15

I cant get the effect achieved at the end of the “H15 MasterClass - Loops” video to work in H15.5.537

I knew I'd seen that done somewhere before. Anyone know of what to do this in H15.5?
Houdini Indie
Karma/Redshift 3D
User Avatar
Member
402 posts
Joined: June 2014
Offline
Hi,

Don't forget that, if you don't need to use vex for any other reason, you can use a python expression in the ‘Text’ field of the font SOP… something like:
alphabet = 'ABC...'
return alphabet[int(hou.frame())]
Henry Dean
User Avatar
Member
1743 posts
Joined: March 2012
Offline
An example of how to do something like this is in the Point Attribute Text asset on Orbolt [orbolt.com]. It also shows how to adjust the font face, size, orientation, etc per point.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
604 posts
Joined: July 2013
Online
ndickson
An example of how to do something like this is in the Point Attribute Text asset on Orbolt [orbolt.com]. It also shows how to adjust the font face, size, orientation, etc per point.

Thanks, I D/L the HDA, and he's using a HScript expression ‘points’ to read upstream point attribute data.

So, looks like this is possible, you just have to use ‘points’ to read point attributes. I was trying to use ‘detail’ to read detail attributes, but, for some reason, the Font SOP didnt like that.

Oh well, another day, another Houdini mystery solved.

Thanks all!

…until next time

-DjD-
Edited by TwinSnakes007 - July 21, 2016 23:08:05
Houdini Indie
Karma/Redshift 3D
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
Always Be Closing Neil!
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
1743 posts
Joined: March 2012
Offline
Daryl Dunlap
I was trying to use ‘detail’ to read detail attributes, but, for some reason, the Font SOP didnt like that.
Yeah, it's a bit confusing, but the “points”, “vertexs”, “prims”, and “details” functions return a string value, whereas “point”, “vertex”, “prim”, and “detail” return numerical values. The latter set probably returns something like zero if the attribute in question is a string attribute, since they need to choose some arbitrary numeric value.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
604 posts
Joined: July 2013
Online
OOOOOOH!
Houdini Indie
Karma/Redshift 3D
User Avatar
Member
604 posts
Joined: July 2013
Online
Dude! Thanks so much. Working like a champ over here, Geesh.

…for leaving breadcrumbs sake

`details("opPath", "detailStringAttribute")`
Edited by TwinSnakes007 - July 22, 2016 12:24:32
Houdini Indie
Karma/Redshift 3D
User Avatar
Member
339 posts
Joined: June 2013
Online
Just a breadcrumb patch!

`detail("oppath", "attribute_name", attribute_index)`

In my case detailwould not work without putting the ,0for attribute index at the end. In the documentation page there's no mention of attribute index.
http://www.sidefx.com/docs/houdini/vex/functions/detail [www.sidefx.com]

Is there something I'm missing here? If there would be a need for documentation update what would be the best venue to report it?
Cheers

Edited by probiner - Aug. 6, 2017 08:49:27
User Avatar
Member
1743 posts
Joined: March 2012
Offline
probiner
`detail("oppath", "attribute_name", attribute_index)`

In my case detailwould not work without putting the ,0for attribute index at the end. In the documentation page there's no mention of attribute index.
http://www.sidefx.com/docs/houdini/vex/functions/detail [www.sidefx.com]

Is there something I'm missing here? If there would be a need for documentation update what would be the best venue to report it?

Backtick expressions are HScript expressions for use in string parameter values. The detailexpression function is documented here [www.sidefx.com], (not to be confused with the VEX function of the same name). It has an attribute index parameter, as documented. However, it looks like you're probably also wanting to use the detailsexpression function, documented here [www.sidefx.com], instead, to get a string attribute value instead of a numeric value. It doesn't have an attribute index parameter. Hopefully that helps clear things up.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
77 posts
Joined: Feb. 2017
Offline
there is a parameter called ‘single pass’ in foreach end node
it can let you control which iteration will be displayed
gif… [i.imgur.com]

Besides, i do not work well with detail function…
oh. it is ‘details’ to get string value, i miss ‘s’…

Finally, i really recommend you to watch Ari Danesh's tutorial [vimeo.com], there are some useful info about font and foreach node…
Edited by zengchen - Aug. 27, 2017 11:46:02
My Youtube Channel [www.youtube.com]
  • Quick Links