-- // ************************************ -- // ***** align object to slice plane -- // ***** by le1setreter -- // ***** 2011 --- info@le1setreter.de -- // ************************************ -- clearListener() rollout align2Slice "align2SlicePlane" width:240 height:106 ( local mySlicedObj local myAlignObj pickbutton sclObj "pick sliced object" width:200 tooltip:"pick the object to is sliced" pickbutton algObj "pick object to align" width:200 tooltip:"pick the object to be aligned" label lab01 "----------------------------------------" button alignObj "align to sliced object" width:200 tooltip:"do the align" fn alignPlane = ( myAlignObj.position.controller=position_script() posScriptString = "$"+mySlicedObj.name as string +".modifiers[#Slice].Slice_Plane.position * (inverse (getModContextTM $"+mySlicedObj.name as string+" $"+mySlicedObj.name as string+".modifiers[#Slice])) * $"+mySlicedObj.name as string+".objecttransform" myAlignObj.position.controller.script = posScriptString myAlignObj.rotation.controller=rotation_script() rotScriptString = " (($"+mySlicedObj.name as string+".objecttransform.rotation) + (inverse $"+mySlicedObj.name as string+".modifiers[#Slice].Slice_Plane.rotation * (inverse (getModContextTM $"+mySlicedObj.name as string+" $"+mySlicedObj.name as string+".modifiers[#Slice])) * $"+mySlicedObj.name as string+".objecttransform))" myAlignObj.rotation.controller.script = rotScriptString ) on sclObj picked obj do ( if (obj != undefined) and (obj.modifiers[#Slice] != undefined) then ( sclObj.text = "pick sliced object: "+obj.name mySlicedObj = obj print mySlicedObj ) else ( messagebox ("object needs to have the slice modifier") ) --end if ) --end on on algObj picked obj do ( if obj != undefined do ( algObj.text = "pick object to align: "+obj.name myAlignObj = obj print myAlignedObj ) --end if ) --end on on alignObj pressed do ( alignPlane() ) --end on ) -- end rollout createdialog align2Slice