Using attributes and local variables

   778   3   2
User Avatar
Member
28 posts
Joined: Sept. 2019
Offline
Hi.

I'm trying hard to figure out how attributes and local variables are different and how they work exactly. Though I don't understand how they work exactly due to my lack of overall knowledge in Houdini yet, I managed to get that they are two different factors and how I can distinguish them more or less. But I'm really confused in referencing and using them… here's a short excerpt from SideFX's Houdini 18 guide (Parameter expressions).

- Global variables such as $F (the current frame number) and $T (the current time in seconds). See the list of global variables below.

- Geometry attributes. In HScript expressions on geometry you can reference the value of an attribute using @attributename. For example, you can use @pscale to get the value of the pscale (point scale) attribute on the current point.
For vector attributes such as P (position), you can use dot notation to grab a component, for example @P.x. You can use .x/.y/.z or .1/.2/.3 or .r/.g/.b, whichever makes sense for the type of data.

- Local variables. Nodes often provide variables that are useful for expressions on nodes of that type. For example, a node that operates over the points in a geometry will have a @ptnum variable representing the point number of the current point. The help for a node will list the local variables you can use in expressions on that type of node.


So in order to reference a certain VALUE of attributes or local variables, I need to use ‘@’ mark in front of the name of them. Is this right? This was very confusing because in some other sources they were explaining that I needed to add just ‘$’ sign for local variables just like for global variables. Am I being confused between referencing a certain value of them and simply indicating them, or is there something else that I lost…?
Edited by sweetroll - Jan. 10, 2020 16:58:40
User Avatar
Member
888 posts
Joined: July 2018
Offline
Your confusion is just reasonable. Houdini is constantly in a state of flux and this is one example. $ was the old way, @ the new and better. Where you can, use @ for local values but there's no substitute for globals like $F.
B.Henriksson, DICE
User Avatar
Member
28 posts
Joined: Sept. 2019
Offline
Thank you kahuna031!
User Avatar
Member
122 posts
Joined: Aug. 2013
Offline
Perhaps some example could help you to understand or not.
I understand age and time like conventions.

`@age/@time > .05` comparition = out

Composition
Cd.x = @speed* @time*.1

Not try to understand all the use of thats conventions all in houdini go to state of flux likecin mind of painter



Some time you know quite well what should happen if @age> some sort sometime you must see if that that what you want or need other combinations and decisions for you purpose
Star to simple not to the complex
  • Quick Links