Well it seemd to be a bit more complicated... If I use Nathan's script and make a blur node with, it snaps to the grid, but if I make a second blur node with the first blur still selected, it isn't snapped to the grid and that one I have to repo by hand. The second blur seems to be positioned a relative amount offset under the first node. I am trying to reduce all the repositioning I have to do in the dag throughout the day. Isn't there a way to have every node always be forced onto the grid. I am also trying to avoid that situation where one node is directly on top of another after snapping (by making sure that eveything is initially on the grid).
Did I miss this page in the manual? Pete On Tue, Apr 12, 2011 at 5:30 PM, Pete O'Connell <[email protected]>wrote: > That works! > > Thanks Nathan > Pete > > > On Tue, Apr 12, 2011 at 5:22 PM, Nathan Rusch <[email protected]>wrote: > >> What about just using the .autoplace() node method? >> >> def apCreated(): >> nuke.thisNode().autoplace() >> >> nuke.addOnUserCreate(apCreated) >> >> -Nathan >> >> >> *From:* Pete O'Connell <[email protected]> >> *Sent:* Monday, April 11, 2011 6:39 PM >> *To:* [email protected] >> *Subject:* [Nuke-python] snap to grid on user create? >> >> Hello Nuke python enthusiasts. I am trying to have every node I create be >> snapped to the grid as I create them. It is proving trickier thatn I >> thought. >> I have been working on variations on the code below which doesn't work I >> assume because the node becomes selected after it is created. Maybe the node >> needs to be an argument to the autosnap function? >> >> ################################################3 >> import nuke >> def autoplaceSnapSelectedNodesOnUserCreate(): >> m = nuke.selectedNodes() >> for i in m: >> nuke.autoplaceSnap(i) >> if __name__ == '__main__': >> autoplaceSnapSelectedNodesOnUserCreate() >> >> >> nuke.addOnUserCreate(autoplaceSnapSelectedNodesOnUserCreate) >> ######################################################################## >> >> Any Suggestions would be greatly appreciated >> Pete >> >> ------------------------------ >> _______________________________________________ >> Nuke-python mailing list >> [email protected] >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> _______________________________________________ >> Nuke-python mailing list >> [email protected] >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> > > > -- > Pete > -- Pete
_______________________________________________ Nuke-python mailing list [email protected] http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
