2 ["type"] = "EditorAction",
3 name = "Track Organizer",
4 author = "Mixbus Lua Taskforce",
5 description = [[Easily modifiable session overview and track property editor]]
8 function factory () return function ()
10 local rbow = { ["----"] = "", ["Red"] = 0xD10000FF, ["Orange"] = 0xFF6622FF, ["Yellow"] = 0xFFDA21FF,
11 ["Green"] = 0x33DD00FF, ["Blue"] = 0x1133CCFF, ["Indigo"] = 0x220066FF, ["Violet"] = 0x330044FF
14 --now starting to build our dialog
15 local dialog_options = {
16 { type = "label", colspan="4", title = "Change your Track settings here:" },
17 { type = "heading", title = "Track", col = 0, colspan = 1 },
18 { type = "heading", title = "Group", col = 1, colspan = 1 },
19 { type = "heading", title = "Comment", col = 2, colspan = 1 },
20 { type = "heading", title = "Color", col = 3, colspan = 1 },
23 --group option payload
24 --@ToDo: Add 'fake' groups for people to select, create them if they want it
25 local pl = {["----"] = "", ["Drums"] = "Drums", ["Bass"] = "Bass", ["Guitars"] = "Guitars",
26 ["Keys"] = "Keys", ["Strings"] = "Strings", ["Vox"] = "Vox"
29 for g in Session:route_groups():iter() do
33 --helper function to find default group option
34 function interrogate(t)
36 for g in Session:route_groups():iter() do
37 for r in g:route_list():iter() do
38 if r:name() == t:name() then v = g:name() end
43 function find_color(t)
45 for k, v in pairs(rbow) do
46 if(t:presentation_info_ptr():color() == v) then c = k end
50 --insert an entry into our dialog_options table for each track with appropriate info
51 for t in Session:get_tracks():iter() do
52 table.insert(dialog_options, {
53 type = "entry", key = t:name() .. ' n', col = 0, colspan = 1, default = t:name(), title = "" --@ToDo: Shorten Names so they can still see what track they're changing?
55 table.insert(dialog_options, {
56 type = "dropdown", key = t:name() .. ' g', col = 1, colspan = 1, title = "", values = pl, default = interrogate(t)
58 table.insert(dialog_options, {
59 type = "entry", key = t:name() .. ' cm', col = 2, colspan = 1, default = t:comment(), title = ""
61 table.insert(dialog_options, {
62 type = "dropdown", key = t:name() .. ' c', col = 3, colspan = 1, title = "", values = rbow, default = find_color(t)
67 local rv = LuaDialog.Dialog("Track Organizer", dialog_options):run()
68 if not(rv) then goto script_end end
69 assert(rv, 'Dialog box was cancelled or is ' .. type(rv))
71 --begin track operation
72 for t in Session:get_tracks():iter() do
73 local cgrp = interrogate(t)
74 local name = rv[t:name() .. ' n' ]
75 local ngrp = rv[t:name() .. ' g' ]
76 local cmnt = rv[t:name() .. ' cm']
77 local colr = rv[t:name() .. ' c' ]
79 if t:name() ~= name then t:set_name(name) end
81 if t:comment() ~= cmnt then t:set_comment(cmnt, nil) end
83 if not(colr == "") then t:presentation_info_ptr():set_color(colr) end
85 if type(ngrp) == "userdata" then
86 if cgrp ~= ngrp:name() then
91 if type(ngrp) == "string" and not(ngrp == "") then
92 ngrp = Session:new_route_group(ngrp)
93 if cgrp ~= ngrp:name() then