Notifications
Clear all

[Closed] Keep the position key for the first and the last frame

Hi , i wrote a script that kills the position or/and rotation or/and scale for selected objects ,what i want to know is how can i keep for example the postion key for the first and the last frame of selected objects.
Here’s a piece from the code i wrote:

        on trsf pressed do 
            (
            for i in selection do deleteKeys i.pos.controller
            )
        on rot pressed do 
            (
            for i in selection do deleteKeys i.rotation.controller
            )
        on scl pressed do 
            (
            for i in selection do deleteKeys i.scale.controller

The objects don’t have the same animation lenght.
Thanks!

4 Replies

In the maxscript documentation look up “Controller Key Functions”.

You are going to want to get the number of keys on the controller (total), make sure they are in order, and delete key 2 through to key (total-1) in a loop.

-Edit:duplicate-

for n = 2 to (numKeys $.pos.controller)-1 do deleteKey $.pos.controller 2

Sorry for the late reply.
skywisenight: yeah i looked in to the documentation , i found what i wanted but couldn’t translate it in a proper clean code (still learning maxscript), dutch_delight made it for me.
Many Thanks both of you , really appreciate it !