Notifications
Clear all

[Closed] Controller locks

I have a “direct path” to controller that I want to lock (CAT’s timewarp) which is something like this:
“$.controller.layers.controller[2].timewarp.controller”

How in the world do I lock that controller with this taken from maxscript help?
[left]<void>LockedTracksMan.SetLocks <bool>lock <&maxObject array>anims <&maxObject array>clients <&index array>subNums <bool>includeChildren
[/left]
Thanks.

2 Replies

This function needs an array of the track(s) to lock, an array of their parents and another array of indices of the tracks within their parents.

For example, if you create a Teapot and want to lock its Position and Rotation controllers including their sub-controllers, you would say

tp = teapot()
   select tp
   lockedTracksMan.setLocks true #(tp[3][1], tp[3][2]) #(tp[3], tp[3]) #(1,2) true
   trackviews.open "Test"

This creates the teapot, writes it to variable tp, then locks the sub-anims tp[3][1] (position track) and tp[3][2] (rotation track) which have both as parents tp[3] (one entry each in the second array). The third array contains the indices of the sub-anims within their respective parents (first and second sub-anim of Transform track). The last flag says that all their sub-controllers (X,Y,Z position and rotation sub-anims) should also be locked. The first argument (true) tells the function you want to set the flag, false unlocks, but the children unlocking doesn’t seem to work, at least in Max 2010, so you have to go through all the sub-controllers one by one.

This is equivalent to

lockedTracksMan.setLocks true #(tp.position.controller, tp.rotation.controller) #(tp.transform.controller, tp.transform.controller) #(1,2) true

So in your case you would say something like

lockedTracksMan.setLocks true #($.controller.layers.controller[2].timewarp.controller) #($.controller.layers.controller[2]) #(2) false

because the timewarp controller is the second sub-anim of $.controller.layers.controller[2]. I created a simple CAT character, added two layers and when I executed the above, the Timewarp track of the second layer got locked…

Thanks a lot Mr. Bobo, it works great.
Also thanks for the extra explanation.