Jump to content

Undeclared Wrangle Variables Are Always Floats (0.0)


Atom

Recommended Posts

Hi All,

 

I am watching Ari Danesh video on the PointWrange, introduced in H12.5

 

His example no longer works in H14.

 

In this scene the VEX code should randomize the Y points on the grid but the point wrangle seems to have no effect. What am I doing wrong?

post-12295-0-26095000-1434381250_thumb.j

ap_point_wrangle_porblem.hipnc

Edited by Atom
Link to comment
Share on other sites

Ah, thank you..(again).

 

That does seem odd to me, however. Shouldn't undeclared variables throw an error in the Wrangle node itself? (or at least a warning)

 

For instance if I simply type a single line @my_var;  (which is of an unknown type) I get a float attribute in the Geometry sheet with a value of 0.0. It seems the act of using a variable declares it as a float and initializes it with 0.0. That is why my mis-spelled variable produced no errors. A mis-spelled variable is a declared variable. And with it's value being zero it did not make any change in the y-direction. Because multiplying by zero is zero.

 

This certainly compounds the end-users ability to detect errors based upon typos. Ugh..

Edited by Atom
Link to comment
Share on other sites

Ah, thank you..(again).

 

That does seem odd to me, however. Shouldn't undeclared variables throw an error in the Wrangle node itself? (or at least a warning)

 

For instance if I simply type a single line @my_var;  (which is of an unknown type) I get a float attribute in the Geometry sheet with a value of 0.0. It seems the act of using a variable declares it as a float and initializes it with 0.0. That is why my mis-spelled variable produced no errors. And with it's value being zero it did not make any change in the y-direction. Because multiplying by zero is zero.

 

This certainly compounds the end-users ability to detect errors based upon typos. Ugh..

undeclared variables throw error and everything is as expected

the difference in your case is that you are not using variables, but attribute bindings

so @attribname, automatically binds that to an attribute and if that attribute doesn't exist it will be created and initialized with specified type(if specified by Attributes To Create pattern)

your example using actual variables would look like

vector pos = set(0,1,0);
float rnd_y = random(@ptnum);
vector rnd_v = set(0,rnd_y * 3.11,0);
@P += pos + rnd_v;

if you misspell variable names in there you would see errors

Link to comment
Share on other sites

Got it, thanks Tomas.

 

Ari Danesh explained the difference between temporary variables and @variables later on in the video. I guess I should I have watched the entire video before posting.

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