I have a process which i really want to automate as its a fair few clicks and i do it everyday when exporting models into our engine from max:
The process is this:
center pivot to the object,
move the pivot down to the base of the model
move the object to 0,0,0 so its on the origin (this sould mean the base of the object is at 0 on Z axis)
reset transform
reset scale
reset xform
convert to editable mesh
file > export
The problem is i cant align the pivot to the lowest point on the model and then move the whole model to 0,0,0. I currently have this:
CenterPivot $;
*this is where i need to add the "move pivot to base of object stuff"*
resettransform $;
resetscale$;
resetxform $;
macros.run "Modifier Stack" "Convert_to_Mesh"
actionMan.executeAction 0 "40011" -- File: Export File
Any help with this would be appreciated as all those unneccesary clicks is driving me mad! I know its not exactly mind boggling code but it would help me out a lot.
Thanks in advance.
Replies
(--Sets the pivot to the lowest point in a mesh, then center the object to world zero
if $ != undefined then
(
ResetPivot $
CenterPivot $
for i in selection do
(
i.pivot = [i.pivot.x, i.pivot.y, i.min.z]
)
$.pos = [0,0,0]
)
else
(
messageBox "Select an object then run this script again." title:"Selection Error" beep:true
)
)
resettransform $;
resetscale$;
resetxform $;
macros.run "Modifier Stack" "Convert_to_Mesh"
actionMan.executeAction 0 "40011" -- File: Export File
--Thanks go out to Vig from Polycount
(final thing if anyone is interested)
dont know maxscript but looks like the min.z part in the for loop.