Having problems with VEX Syntax

   3189   2   1
User Avatar
Member
2 posts
Joined: Sept. 2016
Offline
I am following the steps of one the courses provided by “Pluralsight” and I have an error when it comes to compile the VEX code. I verified several times if I have a typo or the like… I asked several times in Pluralsight but they never reply (with other courses, not this one).

I wonder if there is a problem with the Syntax of this:

int seed = chi(“seed”);
int branches = 10;
float min_u = ch(“min_u”);
float max_u = ch(“max_u”);

int current_pt;
vector current_pos;
float current_grad, current_width;

for (int i=0; i < branches; i++) {
float u = fit01(rand(@primnum + i +seed +149), min_u, max_u);

prim_attribute(@OpInput1, current_pos, “P”, @primnum, u, 0.0);
prim_attribute(@OpInput1, current_grad, “grad”, @primnum, u, 0.0);
prim_attribute(@OpInput1, current_width, “width”, @primnum, u, 0.0);
current_pt = addpoint(geoself(), current_pos);
setpointattrib(geoself(), “grad”, current_pt, current_grad);
setpointattrib(geoself(), “width”, current_pt, current_width);
setpointattrib(geoself(), “level”, current_pt, i@level + 1);
}

As I wrote before, I followed the steps they provide and I even downloaded the .hip files and when I open his file there's no error like this.



These are the errors I get: "Not matching function for prim_attribute()“ and ”Using uninitialised variable: nameofthevariable".

Anyone has any idea about what I am doing wrong?
User Avatar
Member
1743 posts
Joined: March 2012
Offline
Strange. It seems to compile fine in an Attribute Wrangle SOP set to Run Over Primitives for me, in 15.5.660… (after changing all of the double-quote characters to directionless double-quotes, instead of right or left double-quote characters, though that was probably added automatically when you posted. You can use code blocks in your posts to keep code text verbatim.)

In what way are you using this VEX code? In a shader? In an Attribute Wrangle SOP? In a separate VFL file used by a VEX SOP?
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
333 posts
Joined: Oct. 2012
Offline
I think the wrangle is run over a curve and scatters 10 points on it. The Code works. Tested with 15.5.673. Must be some weird error in your file.

can you upload a file?

cheers

ps: you could just use a scatter sop which can scatter points on lines. in combination with a carve you can get the same results. just merge the result back with the line.
  • Quick Links