I'm new to Houdini, so please forgive my basic questions.
I have two questions:
1)) I'm using shelf curve tool, to create a curve, I want to set an standard on distance using vex, let's say, every time user clicks to make a point it will automatically will find the direction of the normal and adjust the distance to the previous point. I'm using a wrangle node to do that. It almost works, the only problem is if the previous point has been changed in position, in the for loop it will use the old position not the updated one. Here I attached the code and a screen capture of the scene.
int pnts[] = primpoints(geoself(), 0); vector pos, pos_prev, up, normal, val; for (int i = 1; i < 3; i++){ pos = point(geoself(), 'P', i); pos_prev = point(geoself(), 'P', i-1); up = set(geoself(), 1, 0); setpointattrib(geoself(), 'up', i, up, "set"); normal = normalize(pos - pos_prev); setpointattrib(geoself(), 'N', i, normal, "set"); float dis = distance(pos, pos_prev); int had_growth = 0; if (dis < 1.0){ val = pos; while (dis < 1.0){ setpointattrib(geoself(), 'P', i, val, "set"); pos = point(geoself(), 'P', i); val += normal*0.01; dis = distance(val, pos_prev); } had_growth = 1; setpointattrib(geoself(), 'dist', i, dis, "set"); } }
2) How can I enable curve drawing mode, after I have pressed enter and stooped drawing?
Thanks,
Ehsan