سؤال

I am trying to use MAXScript to delete all animation Keys from my scene using MAXScript. At the moment I am using the mouse and pressing CTRL + A to select all objects thus bringing up the keys for all objects in my scene. I am then selecting all Keys on the animation timeline using my mouse, and then selecting all keys on the timeline, and then deleting them. How do I do it in MAXScript?

I have found this in the MAXScript documentation, but I don't know how to use it:

deleteKeys <controller> [#allKeys | #selection]  

I tried using

deleteKeys globaltracks #allKeys

but that didn't seem to do anything.

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

المحلول

this is a method I posted as part of this challenge on CGTalk. I've modified it to delete all keys on animated controllers. It manipulates the built-in Trackbar custom filter functions to automatically iterate all controllers of all objects, instead of having to retrieve all controllers youself.

(   
fn filterCallbackFunction theAnimatable theParent theSubAnimIndex theGrandParent theNode = 
(       
    if isController theAnimatable do deleteKeys theAnimatable #allKeys
    true
)

with redraw off
(   
    trackbar.filter = #all
    local filtind = maxops.trackbar.registerFilter filterCallbackFunction undefined "." 1 active:on
    disableRefMsgs()
    local sel = getCurrentSelection()
    select objects
    maxops.trackbar.redraw forceRedraw:on
    maxops.trackbar.unregisterfilter filtind        
    select sel
    enableRefMsgs()
    ok
)
)

Edit: Sorry, or just use this :)

deleteKeys objects #allKeys

نصائح أخرى

max select all
macros.run "Animation Tools" "DeleteSelectedAnimation"
clearSelection()

or drag this code to a toolbar to make a macro!

OR to just delete keys from a limited group of objects try

for o in objects where matchpattern o.name pattern:"*somename*" do deleteKeys o #allKeys

or select the objects to delete keys from and try this

for o in selection do deletekeys o #allkeys

I used to delete all keys using this command:

deletekeys $*.controller #allkeys

Without scripting: Hit Ctrl-A, then Main Menu > Animation > Delete selected animation

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top