Notifications
Clear all
[Closed] Need Help: Script to place note keys on Note Track automatically
Feb 08, 2008 2:31 am
Hi
I’m almost done with this script and got most of it working. The only problem is that I need it to be able to add a Note Key to a track without it affecting a Note Key that was perviously placed on the same track. Right now, it’ll either remove the previous Note Key, or save over it’s text properites, etc…
I just want to be able to place more than one Note Key on the same track without it messing up any of the other Note Keys on that same track.
I appreciate any help you can lend.
(Copy and paste the code into your max script and run it).
rollout crappyface "Sound Tagger" width:651 height:317
(
editText edt_Text "" pos:[19,219] width:593 height:19 enabled:true
spinner spn_Frame "" pos:[187,170] width:70 height:16 range:[0,100,0] type:#integer
label lbl1 "On Which Frame?" pos:[180,147] width:98 height:20
button btn_AddNote "New Note Track" pos:[89,69] width:92 height:25 toolTip:"Creates a new note track on selected object"
button btn_RemoveTrack "Remove Note Track" pos:[463,44] width:140 height:25 enabled:false toolTip:""
groupBox grp_CreateNew "Create New Track" pos:[9,8] width:621 height:107
button btn_DopeSheet "Dope Sheet" pos:[204,253] width:96 height:25 toolTip:"Opens the Dope Sheet for selected object"
button btn_NewKey "Place New Key" pos:[23,253] width:167 height:25 toolTip:"Places a new note key on a selected object"
dropDownList DropList "On Which Track?" pos:[23,149] width:141 height:10 selection:1
label lbl2 "Text Property" pos:[24,198] width:129 height:18
editText edt_TrackName "" pos:[118,27] width:171 height:24 enabled:true
label lbl3 "Note Track Name" pos:[17,31] width:95 height:20 enabled:true
groupBox grp2 "Create New Note Key" pos:[10,128] width:622 height:172
button btn_RemoveKeys "Remove All Keys" pos:[460,168] width:144 height:25 toolTip:"Removes all note keys on selected object"
button btn_Close "Exit" pos:[508,251] width:96 height:25 toolTip:"Closes this application"
global NTP = notetrack
on btn_AddNote pressed do
Try
(
NTP = notetrack "Note Track"
NTP.name = edt_TrackName.Text
addNoteTrack $.pos.controller NTP
(
if edt_TrackName.Text == ""Then
(
messageBox "There is no name for this track" beep:true
)
EndIf
)
DropList.items = append DropList.items (NTP.name)
edt_TrackName.Text = ""
btn_RemoveTrack.enabled = True
)
Catch messageBox "No Object Selected"
on btn_RemoveTrack pressed do
(
if DropList.selection > 0 then
(
deleteNoteTrack $.pos.controller NTP
DropList.items = deleteItem DropList.items DropList.selection
)
else
(
messageBox "The Track List is empty"
)
EndIf
)
on btn_NewKey pressed do
(
Track = DropList.selection
(
if Track == 1 then
(
n = getNoteTrack $.pos.controller 1
addNewNoteKey n 1
n.keys.time = spn_Frame.value
n.keys.value = edt_Text.Text
)
if Track == 2 then
(
p = getNoteTrack $.pos.controller 2
addNewNoteKey p 2
p.keys.time = spn_Frame.value
p.keys.value = edt_Text.Text
)
if Track == 3 then
(
q = getNoteTrack $.pos.controller 3
addNewNoteKey q 3
q.keys.time = spn_Frame.value
q.keys.value = edt_Text.Text
)
if Track == 4 then
(
r = getNoteTrack $.pos.controller 4
addNewNoteKey r 4
r.keys.time = spn_Frame.value
r.keys.value = edt_Text.Text
)
if Track == 5 then
(
s = getNoteTrack $.pos.controller 5
addNewNoteKey s 4
s.keys.time = spn_Frame.value
s.keys.value = edt_Text.Text
)
EndIf
)
edt_Text.Text = ""
)
)
createDialog crappyface
2 Replies
Feb 08, 2008 2:31 am
works now , changed only ‘Track 1’ case, but you can correct other parts in a similar way
if Track == 1 then
(
n = getNoteTrack $.pos.controller 1
addNewNoteKey n spn_Frame.value
i = getNoteKeyIndex n spn_Frame.value
n.keys[i].value = edt_Text.Text
)
Feb 08, 2008 2:31 am
Thanks a lot! It works perfectly! I really appreciate the help You rock man.