Old 02-19-2018, 11:50 AM   #1
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default Lua: Track tags (show and hide track groups)

Edit: About storing and restoring the script state...there is a bug/oversight in reaper: project (id) is freed from memory before script runs its atexit() function.
  • The script has to be closed first (from its main menu or by closing the script window)
  • Then the project has to be saved
  • Finally reaper can be closed




Here's a preview of a script I've been working on:
(This is an old version - see latest posts for new versions)




...and here's a video of Tracktion 6 track tags:

Last edited by spk77; 01-05-2020 at 06:16 AM.
spk77 is offline   Reply With Quote
Old 02-19-2018, 02:54 PM   #2
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Location: Los Angeles, CA
Posts: 1,701
Default

This is really fantastic! Would there be any way to assign a key command or MIDI CC to enable/disable specific tags/groups?
Klangfarben is offline   Reply With Quote
Old 02-20-2018, 02:43 AM   #3
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

Awesome!!!
Sexan is offline   Reply With Quote
Old 02-20-2018, 02:48 AM   #4
SoulOne82
Human being with feelings
 
SoulOne82's Avatar
 
Join Date: Sep 2008
Location: Illville - Germany
Posts: 972
Default

Holy cow!

Assigning tags from all folder parent tracks at once is a stroke of genius.
SoulOne82 is offline   Reply With Quote
Old 02-20-2018, 03:42 AM   #5
lachinhan
Human being with feelings
 
lachinhan's Avatar
 
Join Date: Nov 2014
Location: Can Tho - Viet Nam
Posts: 305
Default Hi Spk77

Where can I find this script? It's great and useful. Thank you
__________________
NK Recording Studio
Email: lachinhan@gmail.com or admin@thuamninhkieu.com
Website:nkpro.top and ntmusicpro.com
lachinhan is offline   Reply With Quote
Old 02-20-2018, 07:48 AM   #6
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Perfect!
vitalker is online now   Reply With Quote
Old 02-20-2018, 11:53 AM   #7
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 3,795
Default

Nice!!!
Vagelis is offline   Reply With Quote
Old 02-20-2018, 01:13 PM   #8
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Thanks!
There's an alpha version available in post#1.
  • Right click on script window: shows the main menu
  • Right click on button: remove or rename button


Quote:
Originally Posted by Klangfarben View Post
This is really fantastic! Would there be any way to assign a key command or MIDI CC to enable/disable specific tags/groups?
I'm not sure...maybe that would be possible with reaper.get_action_context:

Code:
Lua: reaper.get_action_context()

is_new_value,filename,sectionID,cmdID,mode,resolution,val = reaper.get_action_context()
Returns contextual information about the script, typically MIDI/OSC input values.

val will be set to a relative or absolute value depending on mode (=0: absolute mode, >0: relative modes). resolution=127 for 7-bit resolution, =16383 for 14-bit resolution.
Notes: sectionID, and cmdID will be set to -1 if the script is not part of the action list. mode, resolution and val will be set to -1 if the script was not triggered via MIDI/OSC.
spk77 is offline   Reply With Quote
Old 02-20-2018, 03:30 PM   #9
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

Omg, I won't even use reaper without this....
Bugs or not implemented yet:
1. You can add same folders again and again, maybe some check to only add new ones?

FR:

can it vertically align little sooner?
Sexan is offline   Reply With Quote
Old 02-21-2018, 03:15 AM   #10
DynamicK
Human being with feelings
 
Join Date: Nov 2017
Location: Gloucestershire, UK
Posts: 223
Default

Very useful...thanks for your work.
DynamicK is offline   Reply With Quote
Old 02-21-2018, 08:25 AM   #11
azimuth
Human being with feelings
 
azimuth's Avatar
 
Join Date: Apr 2014
Location: The place that's round on the ends and high in the middle
Posts: 243
Default

Nice script spk77, great idea.
azimuth is offline   Reply With Quote
Old 02-22-2018, 08:10 AM   #12
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Glad to see some interest here, thanks!
Quote:
Originally Posted by Sexan View Post
Omg, I won't even use reaper without this....
Bugs or not implemented yet:
1. You can add same folders again and again, maybe some check to only add new ones?
That's a good suggestion. Also, new tracks that are added to a tagged folder should stay visible.
(I don't know what should happen when user changes folder state from "parent" to something else )


Quote:
Originally Posted by Sexan View Post
FR:

can it vertically align little sooner?
I'll add some layout options.



This script doesn't work correctly with non-English language packs (I assume). The buttons and REAPER's TCP/MCP are updated when the script "sees" certain words in last undo point name:

Code:
  local proj_change_count = GetProjectStateChangeCount(0)
  if proj_change_count > last_proj_change_count then
    local last_action = reaper.Undo_CanUndo2(0)
    -- try to catch changes in track list
    if last_action:find("track") and not last_action:find("selection") then
      on_track_list_change(last_action)
    end
    last_proj_change_count = proj_change_count
  end
spk77 is offline   Reply With Quote
Old 02-22-2018, 10:18 AM   #13
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

Hi, this seem really useful! Here are my thougths:

- it should remember the last docker it was attached in. Also I think the first run should be in a floating window

- somehow incorporate folder colors. Maybe BG of a button in a track color and when the tag is selected, put a yellow(confirugable) border around it

- click into the empty area should unselect/show all tracks

- tags should be remembered on a project level

- tag ordering options - like in a project / alphabetically / user order by dragging? (remembered and freely switchable to other options)

- options - show only tagged tracks, select only tagged tracks, maybe expand only tagged folders/compress others

- UI-wise - center buttons horizontally, center buttons vertically

- on creating new tag from track selection, pop up name dialog

- focus should not stay on the script window (now when unselecting all tags, it stays). Maybe also when the mouse is moved out of the boundaries of the window switch focus to tracks. I want to play/pause any time.

-switchable horizontal/vertical ordering (e.g. I want them all in a collumn all the time in a floating window)
bFooz is online now   Reply With Quote
Old 02-22-2018, 10:30 AM   #14
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

Some more:

- tags should be selectable not only by clicking, but also by draggin over them

- "clear all" action buried somewhere deeper

- two types of tags - "folder type" and "bunch of tracks type".
With the folder type, any track added to the folder is added to the tag. When the folder is disassembled, the tag type is changed to the "bunch of tracks". This tag type could be either internal or a feature. In a feature case, buttons should be changed to mirror tag type. Maybe soft-edged button (like) for a "bunch of tracks" and a rectangular for a "folder type"

- slight accenuaton of a button on a hover would be nice

- shift+click to select a range of buttons

- create new tag from selected tags - sum all tracks to the new tag

These just went into my head on the first try.

Last edited by bFooz; 02-22-2018 at 10:48 AM.
bFooz is online now   Reply With Quote
Old 02-22-2018, 10:34 AM   #15
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

BUG - when adding new track into an existing tagged folder, the new track cannot be selected until some other track is selected.
bFooz is online now   Reply With Quote
Old 02-22-2018, 11:40 AM   #16
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

wow spk this is going to be super useful... I do have a wish even for the alpha version...

what can I edit to not have it automatically put itself into the docker at the top of the screen... I'd like to have it go into a different docker at the right side of the arrange window?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 02-23-2018, 11:52 AM   #17
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

@bFooz
Very good FRs/suggestions! (Several of these things are on "TODO" list, but not implemented yet )

@hopi

Try to change this...
Code:
local dock = 257
to this:
Code:
local dock = 513
(the line can be found here - line 565):
Code:
function init()
  --track_list = get_track_info()
  local left, top, right, bottom = reaper.my_getViewport(0, 0, 0, 0, 0, 0, 0, 0, 0)
  local center_w = 0.5*(right-left)
  local center_h = 0.5*(bottom-top)
  local w = 0.2*(right-left)
  local h = 0.2*(bottom-top)
  local dock = 257
  gfx.clear = 3355443  -- matches with "FUSION: Pro&Clean Theme :: BETA 01" http://forum.cockos.com/showthread.php?t=155329
                       -- (Double click in ReaScript IDE to open the link)   
  gfx.init(title, w, h, dock, center_w-0.5*w, center_h-0.5*h)
  gfx.setfont(1, btn_font, btn_font_size)
  last_proj_change_count = reaper.GetProjectStateChangeCount(0)
  gui_w, gui_h = gfx.w, gfx.h
  last_gui_w, last_gui_h = gui_w, gui_h
end
spk77 is offline   Reply With Quote
Old 02-24-2018, 06:16 AM   #18
benf
Human being with feelings
 
benf's Avatar
 
Join Date: Oct 2008
Location: France
Posts: 3,697
Default

Hi spk77,

Very useful script. Thanks a lot for sharing.

Quote:
Originally Posted by bFooz View Post
- on creating new tag from track selection, pop up name dialog
+1
__________________
Ma Zique
Mes Partoches
benf is offline   Reply With Quote
Old 02-24-2018, 07:49 AM   #19
Lau
Human being with feelings
 
Join Date: May 2011
Location: Colombes
Posts: 749
Default

Many thanks for sharing your script which is very useful.

Like bFooz says, tags are not saved in the project, it's so sad!
That would be great to add this functionality to the script
Lau is offline   Reply With Quote
Old 02-24-2018, 10:00 AM   #20
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by benf View Post
Hi spk77,

Very useful script. Thanks a lot for sharing.


+1
Quote:
Originally Posted by Lau View Post
Many thanks for sharing your script which is very useful.

Like bFooz says, tags are not saved in the project, it's so sad!
That would be great to add this functionality to the script
Thanks!
Load/save script data is not implemented yet - this is an alpha version.
I don't know yet where to store the script data:
  • save as project ext state -> data might be too big for this
  • to script path -> I should put this script to ReaPack (for easier maintenance)
  • to project path -> ...maybe

Quote:
Originally Posted by Sexan View Post
Omg, I won't even use reaper without this....
Bugs or not implemented yet:
1. You can add same folders again and again, maybe some check to only add new ones?
I have fixed this and will upload the new version soon.
spk77 is offline   Reply With Quote
Old 02-24-2018, 10:20 AM   #21
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

Regarding storing I can show you the way of my people, how we do it
Sexan is offline   Reply With Quote
Old 02-24-2018, 11:11 AM   #22
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Sexan View Post
Regarding storing I can show you the way of my people, how we do it
Thanks! I should add this to ReaPack first. Should I just run reapack-index from my local repo (my computer)? I added the script header - it should be ReaPack-ready

New features implemented and coming soon:
spk77 is offline   Reply With Quote
Old 02-24-2018, 11:41 AM   #23
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

I'm thinking about a nomenclature:

We create tags(=buttons) from tracks, so those tracks become "tagged" when they are assigned to a tag.

And there is an option to "show only tagged tracks". This would mean to show only tracks that are assigned to any tag. In reality this means to show only tracks which are assinged to a selected tag.

Maybe just rename the option to "Show only selected" or "Link selection and visibility".

Anyway, this is going to be so useful script. Did not Heda made something like this embedded in the track inspector?
bFooz is online now   Reply With Quote
Old 02-24-2018, 11:44 AM   #24
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by spk77 View Post
Thanks! I should add this to ReaPack first. Should I just run reapack-index from my local repo (my computer)? I added the script header - it should be ReaPack-ready
No need to run reapack-index yourself when submitting to the ReaTeam repository: it's run automatically after uploading or sending a pull request.

1. Add header (examples, documentation) 2. Upload files to the desired category directory in a new branch 3. Create a pull request for that branch.

If everything is OK reapack-index puts the Pull Request status in green (or in red in case of errors).
cfillion is offline   Reply With Quote
Old 02-24-2018, 11:45 AM   #25
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

Maybe for someone would be useful that when no tag is selected, no tracks are visible, kind of a hard version of "show only selected". But I cannot tell now if that would be useful enough.
bFooz is online now   Reply With Quote
Old 02-24-2018, 12:04 PM   #26
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

Here you go my good sir!
I've commented all edits with "-- GORAN" (needed to convert track to guid some minor adjustments)

https://stash.reaper.fm/32974/%28spk...%20restore.lua

Sexan is offline   Reply With Quote
Old 02-24-2018, 12:04 PM   #27
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

spk... thanks so much for solving the docker issue... that works great now

I'm looking forward to whatever else you add\change because this lua is so useful for moving around on big projects

PS: question... is there some code tweak that would make the tags in the GUI always show in a vertical order rather than
automatically arrange themselves? In fact, could there also be a way to drag the tags into whatever order I wanted?
So that say a tag made recently can be put anywhere in the list of tags?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva

Last edited by hopi; 02-24-2018 at 12:23 PM.
hopi is offline   Reply With Quote
Old 02-24-2018, 12:36 PM   #28
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by bFooz View Post
I'm thinking about a nomenclature:

We create tags(=buttons) from tracks, so those tracks become "tagged" when they are assigned to a tag.

And there is an option to "show only tagged tracks". This would mean to show only tracks that are assigned to any tag. In reality this means to show only tracks which are assinged to a selected tag.

Maybe just rename the option to "Show only selected" or "Link selection and visibility".

Anyway, this is going to be so useful script. Did not Heda made something like this embedded in the track inspector?
This script is based on Tracktion 6 track tags, that's why there's "show only tagged tracks" :


Quote:
Originally Posted by cfillion View Post
No need to run reapack-index yourself when submitting to the ReaTeam repository: it's run automatically after uploading or sending a pull request.

1. Add header (examples, documentation) 2. Upload files to the desired category directory in a new branch 3. Create a pull request for that branch.

If everything is OK reapack-index puts the Pull Request status in green (or in red in case of errors).
Very nice, thank you!
Quote:
Originally Posted by bFooz View Post
Maybe for someone would be useful that when no tag is selected, no tracks are visible, kind of a hard version of "show only selected". But I cannot tell now if that would be useful enough.
Maybe also "inverted" behavior for tags: selecting a tag (button) would hide all tracks that are tagged to that button.

Quote:
Originally Posted by Sexan View Post
Here you go my good sir!
I've commented all edits with "-- GORAN" (needed to convert track to guid some minor adjustments)

https://stash.reaper.fm/32974/%28spk...%20restore.lua
Thank you!

Quote:
Originally Posted by hopi View Post
spk... thanks so much for solving the docker issue... that works great now

I'm looking forward to whatever else you add\change because this lua is so useful for moving around on big projects
I hope you find it useful
spk77 is offline   Reply With Quote
Old 02-24-2018, 12:49 PM   #29
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default repeated question

PS: question... is there some code tweak that would make the tags in the GUI always show in a vertical order rather than
automatically arrange themselves? In fact, could there also be a way to drag the tags into whatever order I wanted?
So that say a tag made recently can be put anywhere in the list of tags? __________________
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 02-24-2018, 03:50 PM   #30
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

Not sure how other user feel,but for me solo & mute would be mind blowing (shift click to solo or something so its buttonless, space saving)
Haha never been so excited regarding scripts as this one,my standard projects are 60+ tracks so this will be life savior,donation incoming!

Last edited by Sexan; 02-24-2018 at 04:24 PM.
Sexan is offline   Reply With Quote
Old 02-24-2018, 04:46 PM   #31
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

Yea, solo mute good idea. Maybe:

shift + left click = solo
shift + right click = mute
(+option to swap)

and then for additional function like "exclusive solo" or "unsolo all" use the same additional modifiers as are hardbaked into reaper itself over track panel buttons (e.g. ctrl+alt on solo button = exclusive solo). Notice the usage of the shift there, so using the shift in the script is the best option.
bFooz is online now   Reply With Quote
Old 02-24-2018, 04:55 PM   #32
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

Another design idea:

say, we have guitar in tag1, bass in tag2, and both in tag3.

We select tag1, only the guitar is visible, but that is also a part of the tag2. So maybe in this case use 50% yellow to highlight tags where some tracks from them are already visible.

And maybe not each time 50%, but calculate how much yellow it would be from a ratio of visible/all tracks from that particular tag. But I am not too sure about usability of this, this would need to be tested.
bFooz is online now   Reply With Quote
Old 02-25-2018, 01:55 PM   #33
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Added to ReaPack.
Thanks Sexan for the "load/save script state" -code! (There is still a lot to do, but I have to sleep occasionally )
spk77 is offline   Reply With Quote
Old 02-25-2018, 02:00 PM   #34
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Jeez, amazing work spk77, Thanks so much !
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 02-25-2018, 02:22 PM   #35
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

No problem, will help as much as I can, btw probably a bug but folder tags are automatically created when creating a folder or having a folder in project
Sexan is offline   Reply With Quote
Old 02-26-2018, 08:29 AM   #36
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by vanhaze View Post
Jeez, amazing work spk77, Thanks so much !
Thanks!

Quote:
Originally Posted by Sexan View Post
No problem, will help as much as I can, btw probably a bug but folder tags are automatically created when creating a folder or having a folder in project
Hopefully fixed now:
Code:
ReaTeam Scripts/Various/Track Tags (based on Tracktion 6 track tags)
v0.2 by spk77 – February 26 2018
  - Fix: Update track list when all tags removed
  - Fix: Don't auto-create buttons
  - (Fix) Adding new tracks to already tagged folder automatically tags the new tracks
  - Create tags from folder parents: don't create new buttons if folder(s) already tagged
spk77 is offline   Reply With Quote
Old 02-26-2018, 08:36 AM   #37
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

now script crashes if you create a track
Code:
738: attempt to index a nil value (local 'btn')
Sexan is offline   Reply With Quote
Old 02-26-2018, 08:44 AM   #38
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Sexan View Post
now script crashes if you create a track
Code:
738: attempt to index a nil value (local 'btn')
It seems to crash if there's no tags and a new track is created...fixing.
spk77 is offline   Reply With Quote
Old 02-26-2018, 08:58 AM   #39
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Fixed.
spk77 is offline   Reply With Quote
Old 02-26-2018, 09:13 AM   #40
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,588
Default

yep,working like a charm now!
Sexan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.