Curve combing tool, for hair authoring

got this about as far as I need it for now

//youtu.be/7TGtm6Lf_N8

Hi prolow,

This is awesome! I have been wanting to do the same thing. Can you give me some tips?

I can tell you that MFnNurbsCurve seems lacking some of the object editing functions that MFnMesh has like add or delete components. I have yet to figure how to properly modify anything other than the component positions. Instead resorted to just creating a new curve and deleting the old, every time I cut or grow the curves.

Hi prolow,

I have three additional questions…

  1. What brush are you using to select and translate the cvs? Are you drawing your own or using something like the artisan brush?
  2. Are you using a ray intersect function of some type to determine which cvs are under your cursor?
  3. How are you getting the the cursor movement (i.e., for translating the cvs)? Are you using QT in some way to capture the mouse location/movement?

it’s a mix of python maya.cmds and maya.OpenMaya API.
Using draggerContext gives me the mouse point in view screen space.
I project the cv positions into screen space using M3dView.worldToView.
Then determine what cvs are under my “brush”, which is drawn with openGL calls to the MHardwareRenderer.
I get the translation by converting the screen space mouse coords to world space using M3dView.worldToView.
Which gives me points(mouseWorldPointA,B) and a view direction vector(DirectionA,B). Earlier when I found what cvs were under my cursor I stored their average position(center).
A is current mouse position
B is the previous mouse position

zDist = center.distanceTo(mouseWorldPointA)
movePointA = (DirectionA * zDist) + om.MVector(mouseWorldPointA)
movePointB = (DirectionB * zDist) + om.MVector(mouseWorldPointB)
moveVector = movePointB - movePointA

prolow,

That’s awesome. Thanks for the pointers. I am anxious to give them a try.