peppino3d Posted March 29, 2008 Share Posted March 29, 2008 Hello, I'm reading the forum about accessing variables and attributes in expressions. I think I understand the difference and the use of both (thanks to this thread), but I'm still a little confused on how to access both in expressions: How do I access the first value of a vector attribute in an expression? And how do I access a the first value of a vector variable instead ? In fact coming from other script languages I could think of $VX, $V[0], $V0, $V.x etc. etc. Are there other ways of accessing the data (maybe if they're variables brought by a varmap attribute) ? Thanks! Peppino Quote Link to comment Share on other sites More sharing options...
stevenong Posted March 29, 2008 Share Posted March 29, 2008 It depends on what attribute and/or variable. If it's local like Normals, you use $NX, $NY, $NZ. The Point SOP has some of the defaults or standard variables that's commonly used. Also, you should check out the Point SOP's help page for more information. If the attribute is created with an AttribCreate SOP, for floats, you do $FOO1, $FOO2 etc. For vectors, $FOOX, $FOOY etc. Again, please check the help page of the SOP. To access the first value of a vector, you do $FOO[0], for example though it's quite rare. This help page is also pretty useful: http://localhost:48626/expressions/ Hope the above helps! Cheers! steven Quote Link to comment Share on other sites More sharing options...
edward Posted March 29, 2008 Share Posted March 29, 2008 - $VX - well, the mapping between local variable and attribute name is determined by the varmap attribute. Quote Link to comment Share on other sites More sharing options...
grasshopper Posted March 31, 2008 Share Posted March 31, 2008 The varmap method isn't always available. For example, when you are accessing the attribute from another network so you can substitute the point, vertex, prim or detail expressions instead something like this: point("/obj/geo/sop",0,"v",0) Quote Link to comment Share on other sites More sharing options...
peppino3d Posted March 31, 2008 Author Share Posted March 31, 2008 Could I access a point attribute from another network let's say by using point("/obj/geo/sop",$PT,"v",0) ? Also I can easily access local and global variables, but as far as attributes go I'm still a bit confused: does the varmap detail attribute preserve local variables outside of the sop operator? if so how does it do it? Thanks peppino The varmap method isn't always available. For example, when you are accessing the attribute from another network so you can substitute the point, vertex, prim or detail expressions instead something like this: Quote Link to comment Share on other sites More sharing options...
grasshopper Posted April 2, 2008 Share Posted April 2, 2008 Could I access a point attribute from another network let's say by using point("/obj/geo/sop",$PT,"v",0) ? You can use $PT but as it is a local variable it will evaluate in the local SOP not the SOP that is referenced in the expression. That may or may not be what you want. Quote Link to comment Share on other sites More sharing options...
peppino3d Posted April 2, 2008 Author Share Posted April 2, 2008 Thanks, but this leads to a new question: Let's say I want to access a pop attribute (randpp) from a copy sop. If I plug the popnet into the right plug of a copy sop and middle click randpp is not there anymore. How can I access this per point pop attribute from the copy sop? I was thinking of retrieving it using an exp like point("../popnet1","randpp",$ID,0) in the copy1/val1 field. Thanks Peppino Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted April 2, 2008 Share Posted April 2, 2008 Thanks, but this leads to a new question:Let's say I want to access a pop attribute (randpp) from a copy sop. If I plug the popnet into the right plug of a copy sop and middle click randpp is not there anymore. How can I access this per point pop attribute from the copy sop? I was thinking of retrieving it using an exp like point("../popnet1","randpp",$ID,0) in the copy1/val1 field. Thanks Peppino Try turning on Use template Point attributes in copySop Attribute TAB 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.