1. 程式人生 > >Max刪除時間範圍外的幀——DeleteKeysOutOfRange

Max刪除時間範圍外的幀——DeleteKeysOutOfRange

這是個可以幫助藝術家快速刪除無用幀的工具,比如客戶做檔案的時候是整場做得Layout,有時間長度達到上千幀;但到動畫環節的時候,就不需要那麼多幀了,只需保持鏡頭範圍內的幀數就行了;只需設定對正確的時間滑塊範圍,點選按鈕,就可快速地刪除調無用的幀。




fn CleanOutRangeKeys inputObject = 
(
    startTime = AnimationRange.Start
    endTime = AnimationRange.End
for i = 1 to inputObject.numSubs do
    (
        tempSubAnim = GetSubAnim inputObject i
        tempController =
tempSubAnim.Controller if tempController != undefined do ( tempKeyList = tempController.Keys outEndKeysIndex = for i = 1 to tempKeyList.Count where tempKeyList[i].Time > endTime collect i if outEndKeysIndex.Count > 0 do for i = 1 to outEndKeysIndex.Count do DeleteKey tempKeyList tempKeyList.
count outStartKeysIndex = for i = 1 to tempKeyList.Count where tempKeyList[i].Time < startTime collect i for i = 1 to outStartKeysIndex.Count do DeleteKey tempKeyList 1 ) if tempSubAnim.numSubs > 0 do CleanOutRangeKeys tempSubAnim ) ) fn RemoveAllObjectKeys = ( for
tempObject in Objects as Array do CleanOutRangeKeys tempObject ) try destroyDialog ::deleteKeysOutOfRange catch() rollout deleteKeysOutOfRange "Delete Keys" ( label lab1 "Please set correct frame range before deleting invalid keys" pos:[10,8] Label devider1 "________________________________________________" button btn1 "DeleteKeysButton" pos:[100,50] on btn1 pressed do ( RemoveAllObjectKeys() ) ) createdialog deleteKeysOutOfRange width:300 height:80

這裡刪除程式碼是從網上找到的一段,自己找不到那個網頁了,沒法在這裡貼連結了。