Select/Cut/Click DAG/Paste to where you clicked does not work for you/your artists?
Not being a smart ass, but since the click on your DAG already dictates where nodes can be created/pasted, why not go simple... On Wed, Jul 3, 2013 at 8:46 PM, Ben Dickson <[email protected]> wrote: > Is there any way to get the location of the cursor in the node graph? > > There's a few reasons this would be useful, but.. currently I'm trying to > write a tool where you select a bunch of nodes, press a button and have > those nodes be moved to the mouse location - theoretically making it easier > to move nodes around while zoomed > > > I tried creating a node with nuke.createNode(), and querying it's > location.. but this isn't reliable: if I click first then it works, but > subsequent runs create the temp node just below the previous location, no > where near the mouse > > > def thing(): > selection = nuke.selectedNodes() > [n.setSelected(False) for n in selection] > > # Get mouse position > n = nuke.createNode("NoOp") > x, y = (n.xpos(), n.ypos()) > nuke.delete(n) > > # Restore selection > [n.setSelected(True) for n in selection] > > # Do something interesting with mouse position > b = nuke.nodes.Blur() > b.setXYpos(x, y) > > nuke.menu("Nodes").addCommand(**"thing", thing, "alt+a") > > > Only other way I can think of is with PySide: you could get the mouse > coordinates, and using the DAG widget get "widget space" coordinates.. but > I can't think of a way to transform these into nodegraph coordinates (maybe > impossible without changes to Nuke, at which point it would be just as easy > to add a "getMouseCoordinates" method) > -- > ben dickson > 2D TD | [email protected] > rising sun pictures | www.rsp.com.au > ______________________________**_________________ > Nuke-python mailing list > Nuke-python@support.**thefoundry.co.uk<[email protected]>, > http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> > http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/**nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python> > -- "Attention, attention. Here and now, boys," the mynah repeated. "Here and now, boys."
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
