magneto Posted April 9, 2012 Share Posted April 9, 2012 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 Quote Link to comment Share on other sites More sharing options...
Annon Posted April 9, 2012 Share Posted April 9, 2012 Jump into the help of any node and look at the available attributes to you: http://www.sidefx.com/docs/houdini11.1/nodes/sop/primitive#locals Quote Link to comment Share on other sites More sharing options...
magneto Posted April 9, 2012 Author Share Posted April 9, 2012 Thanks, I am talking about accessing it via the prim expression that can be used anywhere. How is it possible to access the "P" attribute of a primitive when I can't see it listed in the details view? Quote Link to comment Share on other sites More sharing options...
Annon Posted April 9, 2012 Share Posted April 9, 2012 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. Usageprim(surface_node, prim_num, attrib_name, attrib_index) When given the “P” or “Pw” attribute, returns the centroid of the primitive. Examplesprim("/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 Quote Link to comment Share on other sites More sharing options...
magneto Posted April 9, 2012 Author Share Posted April 9, 2012 I know it's the centroid. I am just looking to know how this "special case" works behind the scenes. Quote Link to comment Share on other sites More sharing options...
eetu Posted April 9, 2012 Share Posted April 9, 2012 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. 1 Quote Link to comment Share on other sites More sharing options...
graham Posted April 9, 2012 Share Posted April 9, 2012 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. 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted April 9, 2012 Author Share Posted April 9, 2012 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. Quote Link to comment Share on other sites More sharing options...
rade Posted April 9, 2012 Share Posted April 9, 2012 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. Quote Link to comment Share on other sites More sharing options...
magneto Posted April 9, 2012 Author Share Posted April 9, 2012 Yes but the Details View shows attributes not variables. Also you supply the attribute name to the prim expression. I never said anything about variables. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.