BlackPariah Posted August 15, 2018 Share Posted August 15, 2018 Hello again! I have a simple IF condition here that fetches an attribute value from a geometry & prints a result according to the comparison but for some reason it's not behaving as expected. It's just 2 nodes & very simple yet as a non-programmer I'm scratching my head. If anyone can take a look & tell me what I did wrong I'd really appreciate it If_condition.hipnc Quote Link to comment Share on other sites More sharing options...
toadstorm Posted August 15, 2018 Share Posted August 15, 2018 You're trying to fetch the X component of your point's P attribute, but you're just going about it the wrong way. P is a vector, and you can't just fetch a piece of an attribute... you have to fetch the whole value. So instead of "int point_to_compare" you'd need to use "vector point_to_compare", and just fetch "P" instead of "P.x". (Incidentally, P.x would be a float, if you could fetch it that way.) Once you have that vector, you can just compare "point_to_compare.x" against 0 and the rest of your code should work as expected. 1 Quote Link to comment Share on other sites More sharing options...
BlackPariah Posted August 15, 2018 Author Share Posted August 15, 2018 I assumed I could just directly fetch it with the dot "." operator... good to know! And indeed it works now! Thanks toadstorm Quote Link to comment Share on other sites More sharing options...
BlackPariah Posted August 15, 2018 Author Share Posted August 15, 2018 I ran into another small problem :-| It's with the "point" function this time. I want to specify a specific node to grab the attribute from, rather than input 0, 1 etc... The help states that the geometry parameter can be a string... so I put a relative path but it's a no go. Point_function_geometry_parameter.hipnc Quote Link to comment Share on other sites More sharing options...
toadstorm Posted August 15, 2018 Share Posted August 15, 2018 Try adding "op:" to the beginning of your path string. 1 Quote Link to comment Share on other sites More sharing options...
BlackPariah Posted August 15, 2018 Author Share Posted August 15, 2018 That did it lol. Not sure why I didn't have to use the "op:" in the For Each copy tutorial in the help... Same "point" function, didn't need "op:"... strange. The exact line in the exercise was: point("../foreach_begin1", 0, "divisions", 0) I think because it's a "point" expression & not a "point" vex function... ahhh, contexts contexts... Thanks again toad! Quote Link to comment Share on other sites More sharing options...
toadstorm Posted August 15, 2018 Share Posted August 15, 2018 yep, you're right! the point expression syntax doesn't work the same way as VEX. generally speaking, in VEX when you're trying to grab data from something that's not directly connected to your given node, you need the op: syntax to signify that you want to fetch the underlying data. for example, the point() function's help shows that the first parameter is <geometry>, not a string. the op: syntax signifies that you're trying to cook that operator and return the geometry data. similarly, you use op: syntax to fetch pixel data from COPs when you want to use a COP as a texture input rather than a file on disk. 2 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.