[Closed] Delete ALL keys on selected objects?
Does anyone know how (with maxscript) to delete all keyframes from a section of objects? They could be custom attribute keys on spinners or sliders on PENattribute holders or just on standard attribute holders, or Pos/Rot/Scl keys that are part of list controllers etc etc.
I know how to delete keys once you know what the controllers are. It’s the how to dig through everything to find the animated controllers in the first place that’s got me stumped.
Cheers,
Cg.
You can use Numsubs to loop through all properties of an object. This function deletes all keys from a node at a given frame. You maybe able to change it to delete all keys. Typically I’ll run this function on an object then again on its modifiers.
fn deleteAllKeysAtFrame ThisTrack ThisFrame =
(
if ThisTrack != undefined do
(
if ThisTrack.controller != undefined do
(
if ThisTrack.controller.supportsKeys do
(
try(deleteKey ThisTrack.controller (getKeyIndex ThisTrack.controller ThisFrame))catch()
)
)
for v = 1 to ThisTrack.numsubs do
(
deleteAllKeysAtFrame ThisTrack[v] ThisFrame
)
)
)
deleteKeys selection
should be enough. does it miss some keys or something?
Hey Gravey, that worked just as well too. Thanks
And here I was thinking I’d have to write a recursive subanim function to find all the tracks.
I love 1 line solutions to what I thought would be a complex, time consuming effort.
So glad this forum is here.
Thanks y’all
Cg.
FYI i’m positive it says somewhere in the reference that deleteKeys is a mapped function and that it operates recursively. i’m pretty sure this is the same for other key related functions like moveKeys etc