Jump to content

Why Attribute Create has many unneeded locals?


Recommended Posts

Hi,

Beginner question.

 

https://www.sidefx.com/docs/houdini15.5/nodes/sop/attribcreate#locals

In "attribute create" node, I found many generic locals that does not make sense to be there, for example: (NX,NY,NZ), Mass (point mass), etc. My question, why define such generic locals in "attribute create" node? Would not make more sense to define these locals in nodes that need them? e.g. "box" node defines its normals, dynamic node defines its mass? As far as I understand it, "attribute create" should define geometrical attributes and not locals...

 

I would really appreciate it If someone can explain why "attribute create" has all these locals and most importantly what are their use cases...

 

 

Link to comment
Share on other sites

Okay, I think I need to rephrase my question :) Let's say I a create grid SOP, then I am allowed to use $PT (point number) in expressions, NOW, if I check grid SOP node documenation, I see no reference to $PT? However, I see a reference to its definition in Create Attribute SOP node? So, my question is: why there is no reference to $PT in grid SOP, and why its definition is found a "Create Attribute"?

Thanks

Link to comment
Share on other sites

You can use them to set your values inside expressions.

They may contain:

  1. "Common" geometry attributes, if they exist on this type of geometry and even if there is no local variable for them exist. They listed in help page: $N, $AGE, and so on. They just predefined for this node by devs, and attributes itself are not special. $NX (@N.x) will access point normal's first component when create point attribute.
  2. User-defined geometry attributes, if they have local variable defined. $MYATTR1 will access first component of any vector attribute with local MYATTR defined. Probably it will be @myattr, but there is no restriction to use same name in uppercase, it's just a convention.
  3. Default values of non-existent attributes. Usually 0, it may be -1 or something else for unknown subset of "common" attributes with "common" defaults. So, if you have no @id attribute, but use $ID in expression, it will be evaluated to -1.
  4. Global expression variables like $T (@Time).
  5. Some shortcut values, like $XMIN (no @-syntax alternative?).
  6. Implicit geometry attributes like $PT (it's attribute notation is also uses wrangle-style names like @ptnum, not @pt).

You still may want to use locals for some variables which have no (known?) alternatives: $XMIN, $BBZ and so on. Otherwise, access existing attributes in @-style, because you don't have to maintain locals for such cases anymore.

attribcreate_locals.hipnc

Edited by f1480187
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...