Create a knob changed callback for a rotopaint curves knob. Optionally confirm the rotopaint node name is something specific you setup. Query the x/y pos of the first vertex and delete the paint stroke the user just created (or even the whole rotopaint node). You can automate everything so it is practically as good as API access to mouse events. I've used it for calculating worldspace coords given a camera track and two clicks on an object such as a marker etc. To streamline things, the first click on each marker zoomed in closer by inserting a crop node focused on that region so you could then do a precise pixel accurate click that got the coords (viewer peers set to auto fit the image res... there is no API access to viewer pan and zoom, hence the crop technique). In another instance, when QC'ing stuff and spotting a problem, a diagonal paint stroke over the region grabbed the first and last coords of the strokes and prompted for a string describing the problem, which was burnt into a crop-in of the defined region (it generated an animated GIF ping-ponging between left and right views too). A further use I found for it was gestural control, I took it as far as determining the length of the stroke and which of the 8 points on a compass rose best matched the angle. Left/Right stokes navigated backwards/forwards on the timeline an amount defined by the length of the stroke (to held you quickly find another good frame to click on the markers mentioned above). Other angles triggered tools. (You can reuse the same code to analyze paint strokes created with RV's annotation features while getting the coords and frame number too)
One you have pixel coords in Nuke it's easy to sample the values, handy on some other tool I once made. Oh yeah, it's coming back to me... Click out a roto on one frame of one view of a cg render and it would sample the AOC values or take xy + sampled z + camera and calculate the world space coords for each vertex and bake out a stereo rotoshape that stuck to your cg in both views for the duration of the shot. If a point was clicked outside the object on black, the edge was traced until a z value was found, which was used to fire a ray from the camera on the vertex's xy to get the worldspace. It could also sample in an outwards spiral rather than just along the edge. It also baked the position of the tangent handles... but I'm getting OT All past tense cause I'm spending most of my time on Maya at another facility now. Erich Eder did all the clever matrix math for me. Cheers, Tim Baier +61 (0)419 480 504 On 02/04/2013, at 9:49 PM, Fredrik Averpil <fredrik.aver...@gmail.com> wrote: > Hi, does anyone know how I could ask the user to choose a pixel using i.e. a > crosshair using Python? > > What I want is X,Y - I do not need the rgb values or anything like that. Just > the pixel selected by the user. > > // Fredrik > > > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python