Jump to content

How does P attribute works for primitives?


Recommended Posts

I know points have P attribute by default and you can see it in the Details View, but you can also access P for primitives even though they aren't visible in the Details View.

I thought an attribute has to be there for it to be accessed.

Is this a special case, kind of like an on-demand attribute? Also are there other attributes like this that aren't visible by default, but accessible?

Thanks :)

Link to comment
Share on other sites

Well you're getting the centroid of a primitive. It shows an example in the help, I can't see what issue you're having with it.

Usage

prim(surface_node, prim_num, attrib_name, attrib_index)

When given the “P” or “Pw” attribute, returns the centroid of the primitive.

Examples

prim("/obj/geo1/facet1", 3, "P", 0)

Evaluates the X component of the centroid of primitive 3 in the specified surface node.

http://www.sidefx.com/docs/houdini11.1/expressions/prim

Link to comment
Share on other sites

A variable is not necessarily an attribute. There are a lot of other variables, $CEX, $BBX, $NPT etc.

Nor is an attribute necessarily available as a variable, eg custom attributes need to have a varmap mapping for that.

  • Like 1
Link to comment
Share on other sites

Most likely if the expression code detects it is looking for "P" instead of an actual attribute it calls GEO_Primitive::baryCenter() and returns the selected index component for the axis you want.

  • Like 1
Link to comment
Share on other sites

Thanks guys.

@Graham, that's what I was wondering. So P is handled specially in this case. Otherwise I was thinking an attribute has to be present before it's accessed, and Details View shows all attributes available (given they are selected) and P doesn't show up for primitives by default, but yet accessible.

Link to comment
Share on other sites

Thanks guys.

@Graham, that's what I was wondering. So P is handled specially in this case. Otherwise I was thinking an attribute has to be present before it's accessed, and Details View shows all attributes available (given they are selected) and P doesn't show up for primitives by default, but yet accessible.

If you read eetu post , there is statement that ATTRIBUTE is not equal(!=) VARIABLE .

So there is no special case here.

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...