Working with Note Tracks

Changing the time property of a note key may cause it to go out of time order relative to the other keys in the controller. You must call the sortKeys() function on the controller or associated MAXNoteKeyArray once all key time manipulations of this kind is complete so that animation will perform correctly.

Example

s = sphere() -- create a sphere

--

ntp1 = NoteTrack "PosNT1" -- create a note track

ntp2 = NoteTrack "PosNT2" -- create another note track

addNoteTrack s.pos.controller ntp1 -- apply first note track to sphere's pos controller

addNoteTrack s.pos.controller ntp2 -- apply second note track to sphere's pos controller

numNoteTracks s.pos.controller -- check number of note tracks on pos controller

hasNoteTracks s.pos.controller -- test to see if pos controller has note tracks

--

addNewNoteKey ntp1.keys 20 #select -- add key to first note track, and select the key

addNewNoteKey ntp1.keys 40 -- add another key to first note track

--

n = getNoteTrack s.pos.controller 1 -- retrieve first note track on the pos controller

nk=n.keys -- retrieve an instance of the note track key array

--

nk[2].value = "Yo What's Up" -- set value for second note key

nk[2].time = 10 -- change the time for second note key. Now first key

nk[1].selected = true -- select the first note key

sortNoteKeys nk -- changed the time of the note keys, so re-sort

nk.count -- check number of keys

nk -- display the note keys

--

-- To delete the note tracks and note keys

deleteNoteKey nk 1 -- delete first note key

deleteNoteKeys n.keys #allKeys -- delete all the note keys

deleteNoteTrack s.pos.controller ntp1 -- remove note track from pos controller

deleteNoteTrack s.pos.controller ntp2 -- remove note track from pos controller

Output

$Sphere:Sphere02 @ [0.0,0.0,0.0] -- result line 1

Notetrack:PosNT1 -- result line 3

Notetrack:PosNT2 -- result line 4

OK -- result line 5

OK -- result line 6

2 -- result line 7

true -- result line 8

#Note key(1 @ 20f) -- result line 10

#Note key(2 @ 40f) -- result line 11

Notetrack: -- result line 13

#keys(20f, 40f) -- result line 14

"Yo What's Up" -- result line 16

10 -- result line 17

true -- result line 18

OK -- result line 19

2 -- result line 20

#keys(10f, 20f) -- result line 21

OK -- result line 24

OK -- result line 25

OK -- result line 26

OK -- result line 27