was successfully added to your cart.
Uncategorized

3ds Max – Freezing Transforms using MaxScript

By June 1, 2017 No Comments

In this post I am going to show a little MaxScript function that allows to freeze the transforms of an object programatically using MaxScript (useful when when writing auto-riggers in 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
  )
)

Leave a Reply