Notifications
Clear all

[Closed] Question about controllers and different objects

I have in the same scene objects that contain this structure in their position controller[transform][position][XYZ][X_Position] and several common objects [transform][position][X_position].
How is it possible to execute this code without an error?

$[#transform][#position][#XYZ][#X_Position].controller.keyable = false
$[#transform][#position][#X_position].controller.keyable = false

My knowledge of maxscript is deficient

Tnx.

6 Replies

for node in selection do node.pos.controller[1].controller.keyable = off

1 Reply
(@dg3duy)
Joined: 10 months ago

Posts: 0

Thank you for responding
When I want to apply this to other objects that have XYZ in position
for node in selection do node.pos.xyz.controller[1].controller.keyable = off

Now the question is the following, what is needed to make these 2 lines of code work together in the same scene?
Here image controllers


fn getSubanimsByName node name subs:#() =
(
   for k=1 to node.numsubs do
   (
      anim = getsubanim node k
      if (getsubanimname node k asstring:off) == name do appendifunique subs anim
      getSubanimsByName anim name subs:subs
   )
   subs
)


for obj in selection do
(
   subs = getSubanimsByName obj #x_position
   for sub in subs do 
   (
      sub.controller.keyable = off 
      format "obj:% sub:% keyable:%
" obj sub sub.controller.keyable
   )
)   

1 Reply
(@dg3duy)
Joined: 10 months ago

Posts: 0

I am eternally grateful to you!
It works like a charm.
Thank you very much denisT

I’ve got a consult denisT
When the code is executed, the entire controller hierarchy is automatically selected, it is possible that only x position?
regards

Thanks to your help denisT I was able to make the key filtering script here you can see the result, for a character animator as I see it very useful.
Now that it’s finished my wish is to be able to optimize it, there are many lines of code the final result

a question, about this line, is it possible to filter more than 1 controller at a time?

subs = getSubanimsByName obj #x_position

pseudocode:
subs = getSubanimsByName obj #x_position #y_position #z_position