سؤال

I have been using this simple MAXScript to clear an animation on 3DS Max 2010:

deleteKeys objects #allKeys

Is there a simple way like this to delete all the keyframes but keeping the first 2?

هل كانت مفيدة؟

المحلول

--Select objects in viewport , run script.
-- it keeps the 2 first keyframes for each controller and removes the rest.

for o in selection do
(
    if (o.position.controller.keys.count > 2) do
    (
        for i = 1 to (o.position.controller.keys.count - 2) do
        (
            deleteitem o.position.controller.keys (i + 2)
        )
    )   
    if (o.rotation.controller.keys.count > 2) do
    (
        temp = (o.rotation.controller.keys.count - 2)
        for i = 1 to temp do
        (
            deleteitem o.rotation.controller.keys (i + 2)
        )
    )   
    if (o.scale.controller.keys.count > 2) do
    (
        temp = (o.scale.controller.keys.count - 2)
        for i = 1 to temp do
        (
            deleteitem o.scale.controller.keys (i + 2)
        )
    )   
)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top