Skip to content

Instantly share code, notes, and snippets.

@tpoveda
Created February 18, 2018 01:19
Show Gist options
  • Save tpoveda/fd49f0adfec846b790e7a0f3673083e0 to your computer and use it in GitHub Desktop.
Save tpoveda/fd49f0adfec846b790e7a0f3673083e0 to your computer and use it in GitHub Desktop.
FreezeTransforms programatically in 3ds Max - MaxScript
fn FreezeTransforms obj =
(
local curObj = obj
if classOf curObj.rotation.controller != Rotation_Layer do
(
-- Freeze rotation
curObj.rotation.controller = Euler_Xyz()
curObj.rotation.controller = Rotation_List()
curObj.rotation.controller.available.controller = Euler_Xyz()
-- Rename rotation controllers
curObj.rotation.controller.SetName 1 "Frozen Rotation"
curObj.rotation.controller.SetName 2 "Zero Euler XYZ"
-- Set the new rotation controller as the active controller
curObj.rotation.controller.SetActive 2
)
if classOf curObj.position.controller != Position_Layer do
(
-- Freeze position
curObj.position.controller = Bezier_Position()
curObj.position.controller = Position_List()
curObj.position.controller.available.controller = Position_XYZ()
-- Rename rotation controllers
curObj.position.controller.SetName 1 "Frozen Position"
curObj.position.controller.SetName 2 "Zero Pos XYZ"
-- Set the new position controller as the active controller actual
curObj.position.controller.SetActive 2
-- Reset the position of the actual position controller to zero
curObj.position.controller[2].x_Position = 0
curObj.position.controller[2].y_Position = 0
curObj.position.controller[2].z_Position = 0
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment