macroScript snapPointOrient category:"Comet Cartoons" toolTip:"snapPointOrient: Select objects, all get Aligned to the last ones Position and Orientation." Icon:#("Classic",57) ( -- -- snapPointOrient - Michael B. Comet - comet@comet-cartoons.com -- http://www.comet-cartoons.com/ -- -- Copyright ©2002 Michael B. Comet All Rights Reserved -- -- -- This script will "Align" the Pos and Orientation of all selected objects -- to the LAST selected object. This is pretty much the same as using -- the align tool, except that you can more easily assign this as a one -- step shelf button or hotkey. -- -- In addition, unlike the align tool, this will snap objects even if they -- parented, such that you can snap a parent to a childs original place. -- -- Version 1.10 - 06/07/2002 - Fixed bug where master might not really snap -- if object was a bone or mirrored bone. So used "transform" attr -- instead which works. -- /* * snapPointOrient() - Main snapping proc */ fn snapPointOrient = ( slaves = getCurrentSelection(); oc = slaves.count; if (oc <= 1) then ( format "-- snapPointOrient: You must select at least one Slave and one Master object!\n"; return(); ) masterObj = slaves[oc]; -- last one is master -- Now make a temp locator which is what we will really snap to. -- This way even if we are snapping to a child and the child gets -- moved etc...we'll always snap to the same place for each. -- master = Point pos:masterObj.pos isSelected:off centermarker:on axistripod:off cross:on Box:off constantscreensize:off drawontop:off size:10; /* coordsys world ( master.rotation = masterObj.rotation; master.position = masterObj.position; ) */ master.transform = masterObj.transform; clearSelection(); undo on ( setWaitCursor(); -- now snap em for i in 1 to (oc-1) do ( coordsys world ( slaves[i].rotation = master.rotation; slaves[i].position = master.position; ) selectMore slaves[i]; -- we'll end with the slaves selected. ) delete master; setArrowCursor(); ) -- end undo format "-- snapPointOrient: Done.\n"; ) -- End of main proc snapPointOrient(); -- lets do it! ) -- End of script