[Closed] Align, mimic align tool
I have searched and read many thread on aligning like the align tool and as far as I saw, no conclusive solution was given, or that I found on how the align tool works in mxs.
So in good tradition (thanks to Denis!) I’m proposing my solution in encrypted form (for now) to align under any circumstance (in hierarchies and whatnot).
So maybe I missed something, but so far my solution seems to work.
So load the mse (remove .txt) file and call
alignMXS selection[1] selection[2]
It aligns P, R & S, no axis in/exclusion yet.
So show your solutions!
-Johan
something is not working. i run the script but the alignMXS function is undefined.
by the way what has this function to do? to align all P,R, and S is:
node1.transform = node2.transform
I think that the trick is to alway work in world space so a bit of matrix fun is enclosed to just get you out of parent space.
This is not quite align, but similar I guess. These are what I use when I want to reset all or specific transforms. It may help you. Especially the rotation one.
macroScript Zero
category:"CgRay"
(
for obj in selection do
(
obj.transform = (matrix3 1)
)
)
macroScript ZeroPos
category:"CgRay"
(
for obj in selection do
(
obj.position = [0,0,0]
)
)
macroScript ZeroRotation
category:"CgRay"
(
for obj in selection do
(
theOldTM = obj.transform
theNewTM = (matrix3 1)
theOldScale = theOldTM.scalepart
theNewTM.row1 *= theOldScale.x
theNewTM.row2 *= theOldScale.y
theNewTM.row3 *= theOldScale.z
theNewTM.row4 = theOldTM.row4
obj.transform = theNewTM
)
)
macroScript ZeroScale
category:"CgRay"
(
for obj in selection do
(
obj.scale /= obj.scale
)
)