Oh no doubt, querying things like cursor data would open a HUGE range of new tool and integration options and is something i've wanted for a long time.
- John Vanderbeck - http://www.johnvanderbeck.com On Wed, Jul 3, 2013 at 10:42 PM, Ben Dickson <ben.dick...@rsp.com.au> wrote: > A good point, there's definitely other ways around the problem. The idea > was based on a tool someone here wrote for Houdini - it seemed useful, and > I wanted to see how well it'd work in Nuke. > > Might have worked, or maybe not.. but regardless, being able to query the > cursor location has other interesting uses (one random example: being able > to do custom drawing on the nodegraph, I have the drawing part working, but > again encountered the same stumbling block of turning screen coordinates > into nodegraph space - > https://gist.github.com/dbr/**5167728<https://gist.github.com/dbr/5167728>) > > > On 04/07/13 13:55, Nico Dufort wrote: > >> 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 <ben.dick...@rsp.com.au >> <mailto:ben.dick...@rsp.com.au**>> 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 | ben.dick...@rsp.com.au <mailto:ben.dick...@rsp.com.au**> >> rising sun pictures | www.rsp.com.au <http://www.rsp.com.au> >> ______________________________**___________________ >> Nuke-python mailing list >> Nuke-python@support.__thefound**ry.co.uk <http://thefoundry.co.uk> >> >> <mailto:Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk> >> >, >> http://forums.thefoundry.co.__**uk/ <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<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 >> Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk>, >> 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> >> > > -- > ben dickson > 2D TD | ben.dick...@rsp.com.au > rising sun pictures | www.rsp.com.au > ______________________________**_________________ > Nuke-python mailing list > Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk>, > 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> >
_______________________________________________ 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