Jump to content

Add Point on Surface by Mouse

Recommended Posts

Im looking for function or code how to add points on surface by vex or python, if it possible, like the Stroke node do! Or at least expand this node and see how it works (its locked).

Actually Im trying to create basic hand scatter (that exist in most 3d soft) where you can pick on surface and create point, only one, by each clicking left mouse, and when you hold it, you can move this point on surface, but this is the next level, and even create a orient for this point =) 

Btw I created this with Stroke node and vex, but Stroke node is too slow with much points and create too much extra attributes

Ps I know about Spray Paint, and its not exactly what i need, i want to create one point at time and move it on surface or change orient, thats it, Spray create only a bunch of points with random position and orientation.

If somebody want this asset let me know, ill upload it here, but u can create it yourself, on GIF only 2 nodes you need, stroke and wrangle with this code

int points[] = primpoints(0, @primnum);

@up = point(0, "P", points[0])-point(0, "P", points[-1]);

foreach(int x; points[1:len(points)])
    removepoint(0, x);


Edited by eistan

Share this post

Link to post
Share on other sites

AFAIK the stroke node is your way to interact with brushes of any kind unless you want to go down to HDK. 

Also, is it really slow? For a point by point operation? Upload your file, that's interesting 

Share this post

Link to post
Share on other sites

I couldn't make yours work :lol:, but here's a different take on it. I can't really see how this can be slow 


If the stroke node gets too big, you can use the Stash SOP to save your current state to it and start over, in fact, you probably want to do something like that anyway


Edited by vtrvtr

Share this post

Link to post
Share on other sites

in your example i have delay after click mouse, about 1 sec or less, its not even close to interactive method =) if u download my hda asset u see only 2-3 node inside and without foreach cuz its too slow, better dont use it if it possible.

Stash SOP do the same thing as lock Null node, and its not interactive, im trying to make a system where u dont have to paint big curve line by hand with so many attributes and points, but just 2 points, first one to create the main point and the second one to pick direction and holding it to see where your object look at

I actually found great function selectPositions this is what i need! and made some Python code with it, but this code not interactive too, u cant see where the objects look when u create a direction by second point, i dont know how to make it interactive and how use it inside Python node maybe, if it possible

Here is the new version hda


the Python code on hda node in Type Parameter

Click on Scatter button every time you need new object, and this is the second problem im trying to solve, the first one to make it interactive to see where the objects look while holding and moving second point direction

Edited by eistan

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now